Results 1 to 3 of 3

Thread: HttpSession Management using Spring Security 2.0.2

  1. #1
    Join Date
    May 2006
    Posts
    142

    Question HttpSession Management using Spring Security 2.0.2

    With the introduction of Spring Security 2.0.2 we are revisiting the way we coded Session Management i.e.

    We retrieve the user credentials from the database and store in HttpSession object . We also store the same info in Thread Local variable so that its available to Spring beans in the business layer. We use JSF in the presentation layer. Here is the code snippet

    Code:
    final HttpSession userSession = (HttpSession) FacesContext.getCurrentInstance().getExternalContext()
                    .getSession(true);
    
    //userInfo is lightweight pojo with attributes userId, userRoles
    this.userInfo.setUserId(this.userId);
    this.userInfo.setUserRoles(this.userRoles);
    
    userSession.setAttribute("userInfo", this.userInfo);
    
    // UserInfoHolder is Thread Local Variable
    UserInfoHolder.setUserInfo(this.userInfo);
    Any pointers/suggestions on how to rewrite this code using Spring Security 2.0.2 framework will be highly appreciated. Currently i am able to get user credentials from User class which implements UserDetails. But if i replace my old code with User class how to handle session timeouts , session management etc.

  2. #2
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    Could you explain what you mean by session management in this context? The code you've shown doesn't seem to have anything to do with session timeouts etc.

  3. #3
    Join Date
    May 2006
    Posts
    142

    Default

    Could you explain what you mean by session management in this context
    I am excited looking at HttpSessionIntegrationFilter and ConcurrentSessionFilter. Wondering if it creates/destroys HttpSession object
    I am interested to know how exactly they work behind the scenes. This will help me make a decision to replace exisisting code with spring security filters

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •