The AppFuse user security advice has a good example of how to look up the
current user. Source code can be found here:

http://fisheye4.cenqua.com/browse/appfuse/trunk/service/src/main/java/org/appfuse/service/UserSecurityAdvice.java

Basically use the SecurityContextHolder to access the current user:
SecurityContextHolder.getContext() rather than accessing the session
directly.

Mike

On 4/30/07, sionsmith <[EMAIL PROTECTED]> wrote:


Hiya guys & girls,

i'm using the acegi security provider as my authentication Manger. If the
user is successfully authenticated the "Principal" object is placed the
session - however when retrieving the user object to use i'm unsure
whether
i shud be using:

SecurityContextImpl auth = (SecurityContextImpl)
getSession().getAttribute("ACEGI_SECURITY_CONTEXT");
user = (User) auth.getAuthentication().getPrincipal();

or implement a SessionRegistry which i play the user object in? Dont
really
get how you know which user is which in the registery tho? Has anyone used
the acegi session Registry before?

Any help or suggestions would be greatful :)
--
View this message in context:
http://www.nabble.com/Keeping-User-Object-in-Session-%28SecurityContextImpl---SessionRegistry%29-tf3668880s2369.html#a10251222
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to