0
我想将弹簧安全性集成到我的应用程序中。 用户的信息保存在Oracle数据库中,密码使用md5进行编码。 我想这在第一,但它没有工作:将弹簧安全性3.1与现有应用程序集成
<bean id="customjdbcUserService" class="org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl">
<property name="dataSource" ref="dataSource" />
<property name="enableAuthorities" value="true" />
<property name="usersByUsernameQuery" value="SELECT mail,password,enabled FROM users WHERE mail = ?" />
<property name="authoritiesByUsernameQuery" value="select mail,authority from user_roles where mail = ?" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="url" value="jdbc:oracle:thin:@//localhost:8080/ex" />
<property name="username" value="user1" />
<property name="password" value="user1" />
</bean>
<bean id="daoAuthenticationProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="customjdbcUserService"/>
</bean>
<bean id="authenticationManager"
class="org.springframework.security.authentication.ProviderManager">
<property name="providers">
<list>
<ref local="daoAuthenticationProvider" />
</list>
</property>
</bean>
<sec:authentication-manager>
<security:authentication-provider user-service-ref="customjdbcUserService" >
<security:password-encoder hash="md5" />
</security:authentication-provider>
</sec:authentication-manager>
我搜索了网,发现了很多关于实现UserDetailsService
或authenticatioProvider
或authenticationManager
或Filter
。现在我只是困惑:我应该执行哪一个?
你是什么意思的“它没有工作”?你有错误信息吗?除此之外:你不应该用md5编码密码。 – micha 2013-05-11 17:50:33
@micha当我按下我的表单中的连接按钮时,它不会进入'default-target-url'页面,但它会重置我的登录窗体..以及有关密码,它们已经在数据库中编码我有,这不是我的选择 – M810 2013-05-11 19:24:20