Hi Mark,

 

Great.  Yes, doing what you proposed I was able to find the previous
UserDetails information.
But how can I now 'chain backwards' to see how many levels deep I've
switched users?



If I do two switches and then call userDetails. getAuthorities() on the
userDetails retrieved about the switched user, the

GrantedAuthority List doesn't seem to hold an Authority that's an instance
of SwitchUserGrantedAuthority.
yet after j_acegi_exit_user, the then current userDetails will contain a
SwitchUserGrantedAuthority for the

original user.  

 

Should the SwitchUserGrantedAuthority value be in the previous users
userDetails and I have just missed finding it? 

Or, if it's not stored there, how can I chain through the list of switched
users?

 

Thanks

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Mark St.Godard
Sent: Tuesday, May 08, 2007 3:13 PM
To: acegisecurity-developer@lists.sourceforge.net
Subject: Re: [Acegisecurity-developer] SwitchUser

 

Hi Dick,

If you have the Acegi source code available, you can look at the
<code>private Authentication getSourceAuthentication(Authentication current)
</code>  method..

It basically iterates through the current Authentication object and get the
source from the SwitchUserGrantedAuthority 

i.e.

        // iterate over granted authorities and find the 'switch user'
authority
        GrantedAuthority[] authorities = current.getAuthorities();

        for (int i = 0; i < authorities.length ; i++) {
            // check for switch user type of authority
            if (authorities[i] instanceof SwitchUserGrantedAuthority) {
                original = ((SwitchUserGrantedAuthority)
authorities[i]).getSource(); 
                logger.debug("Found original switch user granted authority
[" + original + "]");
            }
        }


Cheers
Mark



On 5/8/07, Dick Weisinger <[EMAIL PROTECTED]> wrote:

I've started using a SwitchUserProcessingFilter.

It seems to be working and it seems like I can nest the 'switches' which is
nice.

How do I get the path of switches?  The document says:

 

"On successful switch, the user's SecurityContextHolder will be updated to
reflect the specified user and will also contain an additional
<http://www.acegisecurity.org/multiproject/acegi-security/apidocs/org/acegis
ecurity/ui/switchuser/SwitchUserGrantedAuthority.html>
SwitchUserGrantedAuthority which contains the original user."

 

How can I get the UserDetails for the previous (original) user(s)'s
information?

Is there a method on SecurityContextHolder ?

Is the data held as an array?

 

Thanks


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now. 
http://sourceforge.net/powerbar/db2/
_______________________________________________
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer 

 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to