
Originally Posted by
kellewic
Pretty sure you would have to place RememberMeProcessingFilter before your form authentication filter for this to work. I assume this since you say you want the cookie to override any form authentication.
It also seems you need the TokenBasedRememberMeServices and not the default NullRememberMeServices configured.
The TokenBased definitely looks for a cookie and uses that for authentication unless the token is expired or simply doesn't exist (or if the user is not valid).
This is under the providers.rememberme.* package.
I extends AuthenticationProcessingFilter and modify doFilter.
If exist my custom cookie i run:
Code:
onPreAuthentication(httpRequest, httpResponse);
Create my custom token
Code:
authRequest = new CustomAuthenticationToken(custominfo1, custominfo2));
authRequest.setDetails(new WebAuthenticationDetails(httpRequest));
authenticate my token
Code:
Authentication auth = this.getAuthenticationManager().authenticate(authRequest);
Set context
Code:
SecurityContextHolder.getContext().setAuthentication(auth);
and
Code:
successfulAuthentication(httpRequest, httpResponse, auth);
If I have a error use.
Code:
unsuccessfulAuthentication(((HttpServletRequest) request), ((HttpServletResponse) response), authenticationException);