Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logout in Apache Shiro

Am trying to add a logout functionality in Shiro, I've add this in the JSP page:

<a href="/logout">Log Out</a>

and the shiro.ini look like this:

[main]
authc.loginUrl = /login.jsp
logout.redirectUrl = /logout.jsp

#[users]  
#admin = p  
#mike = p, reader
#joe = p, writer 

[urls]  
/login.jsp = authc
/logout.jsp = logout
/writer/** = user, roles[writer]
/success/** = user
#/** = anon 

but when I try to logout, it give me a

HTTP Status 404 ... The requested resource () is not available.

like image 446
Asme Just Avatar asked Feb 06 '26 05:02

Asme Just


1 Answers

If you reread the documentation they suggest to have

[urls]
/logout = logout

As is it looks like you have a redirect loop going: go to logout.jsp, invoke the logout filter, redirect to logout.jsp, invoke the logout filter, etc.

So far I've been able to get it to redirect properly using this method.

like image 154
Michael Gower Avatar answered Feb 09 '26 09:02

Michael Gower



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!