Announcement Announcement Module
No announcement yet.
Create session for authenticated session Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create session for authenticated session

    I'm want to create a session for a user whose role I get from a SSO server.
    I was wondering what the flow for the process might look like.
    I get the user details in a controller, and want to set up a session as part of the controller, so that all users allowed access to a resource based of their resource can do so.

  • #2
    What technology are you using for your SSO system? This will dictate the best approach


    • #3
      I may have got it working...but given my first time working with Spring, I want to make sure I'm doing things properly.

      I'm using spring OAuth2.
      My OAuth2 server both authenticates and authorizes the user.
      So after authentication, I make a call to it to get the user authorization, and once I have that, I set the context for the session, as follows:

      UserAuthenticationImpl authentication = new UserAuthenticationImpl(userName, authorities);
      SecurityContextHolder.getContext().setAuthenticati on(authentication);

      where UserAuthenticationImpl is my class with the signature:

      public class UserAuthenticationImpl implements Authentication { ... }