Authenticate User manually

Posted by Sergey on Stack Overflow See other posts from Stack Overflow or by Sergey
Published on 2010-03-17T22:18:00Z Indexed on 2010/03/17 22:21 UTC
Read the original article Hit count: 215

Filed under:

I am trying to authenticate the user after I got credentials using oAuth (with Twitter if that makes a difference). As far as I could understand it, I can directly put the Authentication object into SecurityContextHolder. Here is how I do it:

Authentication auth = new TwitterOAuthAuthentication(member,
userDetailsService.loadUserByUsername(member.getUsername()).getAuthorities());
SecurityContextHolder.getContext().setAuthentication(auth);

This for some reason does absolutely nothing. What am I missing and what should I do to accomplish what need?

© Stack Overflow or respective owner

Related posts about spring-security