Hi
I am using the following code to login programatically but it doesn't work (seems to not recognizing the authorities), can someone tell me what's wrong?
I didn't set the authorities because in the javadoc of UsernamePasswordAuthenticationToken, it says that I shouldn't call the setAuthorities method.Code:UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(user.getUsername(), user.getPassword()); auth.setDetails(request.getRemoteAddr()); auth.setAuthenticated(true); Context context = ContextHolder.getContext(); if (context instanceof SecureContext) { ((SecureContext) context).setAuthentication(auth); }
How can I get the AuthenticationManager? So that I can authenticate the UsernamePasswordAuthenticationToken.
Thanks


