Results 1 to 5 of 5

Thread: How do I get at my UserDetails object from my controllers?

  1. #1

    Default How do I get at my UserDetails object from my controllers?

    Once Acegi has grabbed my custom UserDetails object from the database and validated it, how can I get at it again from later in my processing, i.e. a SimpleFormController. I've been looking around for the good part of the night and found that I can get to it from ContextHolder... but how do I get to ContextHolder? Thanks!

  2. #2
    Join Date
    Mar 2005
    Posts
    5

    Default

    I just using the following code to get my UserDetails Object again:
    Code:
    SecureContext sc = (SecureContext) (ContextHolder.getContext());
    (SecurityUser) sc.getAuthentication().getPrincipal();

  3. #3

    Default

    Yea, but where are you getting ContextHolder from?

  4. #4
    Join Date
    Dec 2004
    Location
    Buenos Aires, Argentina
    Posts
    73

    Default

    try
    import net.sf.acegisecurity.context.*;

    And may the Acegi "magic" be with you! :wink:

    Cheers,
    Gustavo

  5. #5

    Default

    Oh, it's a static method. hehe, I wasn't expecting it to be that simple. Sorry.

    EDIT: And as far as I'm concerned, a static method that returns a thread-specific object IS majic.

Similar Threads

  1. Replies: 2
    Last Post: Oct 10th, 2005, 05:12 PM
  2. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  5. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM

Posting Permissions

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