title: User Granted Authorities are always : ROLE_ANONYMOUS?
body: <p>I am using the following method to make a programmatic login after registration </p>
  
  <pre><code>private void autoLogin(User user,
              HttpServletRequest request)
      {
  
  GrantedAuthority[] grantedAuthorities = new GrantedAuthority[] { new GrantedAuthorityImpl(
                  "ROLE_ADMIN") };
  
          UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
                  user.getUsername(), user.getPassword(),grantedAuthorities);
  
          // generate session if one doesn't exist
          request.getSession();
  
          token.setDetails(new WebAuthenticationDetails(request));
          Authentication authenticatedUser = authenticationManager.authenticate(token);
  
          SecurityContextHolder.getContext().setAuthentication(authenticatedUser);
      }
  </code></pre>
  
  <p>the user is authenticated but always has the ROLE_ANONYMOUS I don't know why ?
  any ideas ?    </p>