You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Sudhir N <su...@yahoo.com> on 2012/06/18 18:18:01 UTC

execute code when remembered user returns ?


Is there any way to get notified when a remembered user returns - ?
When using shiro in servlet containers, session listeners aren't a solution ..  they won't trigger when a remembered user is associated with a session.

Thanks    
Sudhir 

Re: execute code when remembered user returns ?

Posted by Sudhir N <su...@yahoo.com>.
Hello Kalle,

Thanks for the suggestion, I will look in that direction.
Yes, I know about the session listener - but with grails, session isnt created when user is identified, it would already exist at that time.


It would have been great if shiro provided the built in mechanism by events or some how - I believe many apps may benefit.

Thanks    
Sudhir 
 


________________________________
 From: Kalle Korhonen <ka...@gmail.com>
To: user@shiro.apache.org 
Sent: Monday, 18 June 2012 10:42 PM
Subject: Re: execute code when remembered user returns ?
 
On Mon, Jun 18, 2012 at 9:18 AM, Sudhir N <su...@yahoo.com> wrote:
> Is there any way to get notified when a remembered user returns - ?
> When using shiro in servlet containers, session listeners aren't a solution
> ..  they won't trigger when a remembered user is associated with a session.

Well, a session listener is triggered when a session is created (or
destroyed). Of course it doesn't help you much with rememberme if the
session is already created for that user. One of the easiest options
is to create your own SubjectFactory
(http://shiro.apache.org/static/current/apidocs/org/apache/shiro/mgt/SubjectFactory.html).
SubjectFactory.createSubject(..) is invoked when a user is identified.

Kalle

Re: execute code when remembered user returns ?

Posted by Kalle Korhonen <ka...@gmail.com>.
On Mon, Jun 18, 2012 at 9:18 AM, Sudhir N <su...@yahoo.com> wrote:
> Is there any way to get notified when a remembered user returns - ?
> When using shiro in servlet containers, session listeners aren't a solution
> ..  they won't trigger when a remembered user is associated with a session.

Well, a session listener is triggered when a session is created (or
destroyed). Of course it doesn't help you much with rememberme if the
session is already created for that user. One of the easiest options
is to create your own SubjectFactory
(http://shiro.apache.org/static/current/apidocs/org/apache/shiro/mgt/SubjectFactory.html).
SubjectFactory.createSubject(..) is invoked when a user is identified.

Kalle