Basta informar ao Spring que ele deve usar o DaoAuthenticationProvider como provedor de autenticação no Security. No applicationContext-security.xml:
1 2 3 | < authentication-manager alias = "authenticationManager" > < authentication-provider ref = "daoAuthenticationProvider" /> </ authentication-manager > |
Depois é só definir o bean do DaoAuthenticationProvider, vincular o bean JdbcDaoImpl como service, com o DataSource e Queries mapeadas. No applicationContext.xml:
1 2 3 4 5 6 7 8 9 | < bean id = "daoAuthenticationProvider" class = "org.springframework.security.authentication.dao.DaoAuthenticationProvider" > < property name = "userDetailsService" ref = "jdbcUserDetailsService" /> </ bean > < bean id = "jdbcUserDetailsService" class = "org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl" > < property name = "dataSource" ref = "?" /> < property name = "usersByUsernameQuery" value = "?" /> < property name = "authoritiesByUsernameQuery" value = "?" /> </ bean > |
Na property dataSource informe respectivo DataSource do projeto, a query para busca de usuários em usersByUsernameQuery e a busca de perfis em authoritiesByUsernameQuery.
Veja também mais sobre Spring Roo no Globalcoders e aqui no blog.
http://twitter.com/edermag
http://www.yaw.com.br/
No comments:
Post a Comment