You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Franz Amador <fg...@gmail.com> on 2008/04/26 00:48:47 UTC

T5: How can I initialize a logged-in user ASO from tapestry5-acegi?

I'm using tapestry5-acegi for authentication.  I'd like to use
@ApplicationState to make the logged-in user object accessible in my
pages, e.g.

@ApplicationState
private User user;

Somewhere, however, I must initialize my ASO variable when the user
logs in.  Where can I do this?

The only place I have thought of is in my
UserDetailsServiceImpl.loadUserByUsername method, which Acegi calls
during login.  I tried injecting the ApplicationStateManager into
UserDetailsServiceImpl and calling "asoManager.set(User.class, user)"
from loadUserByUsername, but that throws an exception.

Note that I cannot do it in my Login page class, because that submits
to something internal to Acegi; I do not get access to the logged-in
user there.

Surely someone out there has done this already.  Any help greatly
appreciated.  Even better, please add the solution to the
tapestry5-acegi documentation.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: T5: How can I initialize a logged-in user ASO from tapestry5-acegi?

Posted by Jonathan Barker <jo...@gmail.com>.
There was a thread a month or so ago that I participated in that covered
doing authentication within a login page class.

Take a look at:

http://thread.gmane.org/gmane.comp.java.tapestry.user/59931/

There was an important part cut off from the code I posted that wound up in
another thread:

http://article.gmane.org/gmane.comp.java.tapestry.user/60045


Jonathan




> -----Original Message-----
> From: Franz Amador [mailto:fgamador@gmail.com]
> Sent: Friday, April 25, 2008 6:49 PM
> To: users@tapestry.apache.org
> Subject: T5: How can I initialize a logged-in user ASO from tapestry5-
> acegi?
> 
> I'm using tapestry5-acegi for authentication.  I'd like to use
> @ApplicationState to make the logged-in user object accessible in my
> pages, e.g.
> 
> @ApplicationState
> private User user;
> 
> Somewhere, however, I must initialize my ASO variable when the user
> logs in.  Where can I do this?
> 
> The only place I have thought of is in my
> UserDetailsServiceImpl.loadUserByUsername method, which Acegi calls
> during login.  I tried injecting the ApplicationStateManager into
> UserDetailsServiceImpl and calling "asoManager.set(User.class, user)"
> from loadUserByUsername, but that throws an exception.
> 
> Note that I cannot do it in my Login page class, because that submits
> to something internal to Acegi; I do not get access to the logged-in
> user there.
> 
> Surely someone out there has done this already.  Any help greatly
> appreciated.  Even better, please add the solution to the
> tapestry5-acegi documentation.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org