アプリケーションに春のセキュリティを統合したいと考えています。ユーザー情報は Oracle DB に保存され、パスワードは md5 でエンコードされます。最初にこれを試しましたが、うまくいきませんでした:
<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
orauthenticatioProvider
またはauthenticationManager
orの実装について多くの情報が見つかりましたFilter
。今、私は混乱しています:どれを実装する必要がありますか?