Results 1 to 6 of 6

Thread: what's the authenticati object saved in session after logon?

  1. #1

    Default what's the authenticati object saved in session after logon?

    what's the authentication object saved in session after logon?

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    See HttpSessionContextIntegrationFilter, which also provides an ACEGI_SECURITY_CONTEXT_KEY for your convenience.

  3. #3

    Default

    what's the type of object stored in session?

    is it myself implemented UserDetails?

  4. #4
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Your UserDetails (as returned by AuthenticationDao) is accessible from the Authentication object's getPrincipal() method. You can get the Authentication from the ContextHolder. Please note from 0.9.0 (and current CVS) the ContextHolder has been refactored and you'll need to use SecurityContext.getAuthentication() instead.

  5. #5

    Default

    could you show me a exmaple?

    such as

    ContextHolder ccc = (ContextHolder)session.getAttribute("KEY")
    ccc.getXXX

    to get myself UserDetailsImpl Object



    thanks.

  6. #6
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    For release 0.8.2 and earlier:

    Code:
    UserDetails userDetails = (UserDetails) ((SecureContext)ContextHolder.getContext()).getAuthentication().getPrincipal()
    For release 0.9.0 and above (and current CVS):

    Code:
    UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()

Similar Threads

  1. OpenSessionInView and portlet support
    By garpinc2 in forum Web Flow
    Replies: 31
    Last Post: Apr 9th, 2010, 11:12 AM
  2. Replies: 2
    Last Post: Oct 10th, 2005, 05:12 PM
  3. OpenSessionInView + CMT Session usage
    By alesj in forum Data
    Replies: 7
    Last Post: Aug 16th, 2005, 02:32 AM
  4. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  5. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM

Posting Permissions

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