I am relatively new to Spring and Spring Security.
I tried to write a program where I needed to authenticate a user on a server using Spring security,
I came up with the following:
public class CustomAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider{ @Override protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken) throws AuthenticationException { System.out.println("Method invoked : additionalAuthenticationChecks isAuthenticated ? :"+usernamePasswordAuthenticationToken.isAuthenticated()); } @Override protected UserDetails retrieveUser(String username,UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { System.out.println("Method invoked : retrieveUser");
My information is that when a user authenticates, I need to put an attribute like:
session.setAttribute("userObject", myUserObject);
myUserObject is an object of some class, which I can get through the entire server code through several user queries.
spring spring-mvc spring-security
Salvin Francis Oct 27 '09 at 7:26 2009-10-27 07:26
source share