this is sort of close to my previous question but i have been looking up how to do it
Current code in applicationContext-security.xml:
<authentication-manager alias="authenticationManager">
<!-- DAO Based Security -->
<authentication-provider>
<password-encoder hash="sha-256" />
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT user_name AS username, user_password AS password, enabled FROM user where user_name=?"
authorities-by-username-query="SELECT user_name as username, R.name as authority FROM user U, roles R WHERE U.roles = R.Id AND user_name=?"/>
</authentication-provider>
</authentication-manager>
What i want to change:
<authentication-manager alias="authenticationManager">
<!-- DAO Based Security -->
<authentication-provider>
<password-encoder hash="sha-256" />
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT user_name AS username, user_password AS password, id, location, userFirstName, userLastName, enabled FROM user where user_name=?"
authorities-by-username-query="SELECT user_name as username, R.name as authority FROM user U, roles R WHERE U.roles = R.Id AND user_name=?"/>
</authentication-provider>
</authentication-manager>
basically i want to retrieve 4 more fields from the database
the issue i have at the moment is i do not know what i need to do, i've attempted to customize userDetails and userDetailsService but i cannot seem to get that to work using the code from this website http://www.theserverside.com/tip/-Spring-Security-Customizing-Your-User-and-Authorization-in
You can not do that with the original org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl
(thats the class behind jdbc-user-service
). You need to subclass it or, need to implement your complete own UserDetailsService
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With