Spring MVC Session handling with Shiro

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Spring MVC Session handling with Shiro

bcaramu
Hi,

I have implemented Shiro with Spring MVC. Everything is going well except
session expiry. Even I have session-timeout config in web.xml, session has
not been expiring after that time. It is kind of never expiration. Could
some tell me how to handle it in Shiro config or any other way to honor
based on session-timeout?


Thanks,
Rama.




--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Spring MVC Session handling with Shiro

bcaramu
Hi,

How to redirect to a Spring mvc controller Request mapping after session
expired?


Thanks,
Rama.




--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Spring MVC Session handling with Shiro

Brian Demers
Are you just trying to send the use back to the login page?

On Thu, Nov 30, 2017 at 8:23 AM, bcaramu <[hidden email]> wrote:
Hi,

How to redirect to a Spring mvc controller Request mapping after session
expired?


Thanks,
Rama.




--
Sent from: http://shiro-user.582556.n2.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Spring MVC Session handling with Shiro

bcaramu
This post was updated on .
Hi,

I would like to redirect user to logout page. From there user will have
option to login thru link.

Here is my application flow.

Application is designed to work on Windows machines only.

- Apache tomcat has configured to send windows logged in username in every requested url.
- We have a Spring mvc listener to grab them and do authentication on first request as there is no specific login page.
- Once session is expired it(Listener) is again pushing to login and redirecting to home page. So there is no way redirect to logout on session expiration.
- I tried to use ShiroSessionListener and throwing a Runtime Exception to catch it in Spring
 ExceptionHandler, But it has not been catching in exceptionHandler method.

Is there any way to redirect to any specific page on session expiration?

Thanks,
Rama.




--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Spring MVC Session handling with Shiro

Brian Demers
You might need to create and register a filter: https://shiro.apache.org/web.html#Web-DefaultFilters
Catch and handle an ExpiredSessionException.

Though just sending your user back to the login page directly (maybe with an optional error message) might prevent a couple user clicks.

On Fri, Dec 1, 2017 at 10:39 PM, bcaramu <[hidden email]> wrote:
Hi,

I would like to redirect user to logout page. From there user will have
option to login thru link.

Thanks,
Rama.




--
Sent from: http://shiro-user.582556.n2.nabble.com/