开发者

Spring Security 2.0, Getting the authentication status of a user

开发者 https://www.devze.com 2023-01-05 12:01 出处:网络
I am working on a webapp which uses Spring security 2.0 (not the new one), which we don\'t have the Java sources, but we do have access to the jsp.

I am working on a webapp which uses Spring security 2.0 (not the new one), which we don't have the Java sources, but we do have access to the jsp.

What is the easiest way to tell if a user is authenticated (any role will do) from the jsp?

Basically I want to display a different link depending on whether a user logged in or开发者_StackOverflow not.


I ended up using spring security taglib, security.tld, where I can do

<authz:authorize ifNotGranted="esp_consumer">
   link1
</authz:authorize>

<authz:authorize ifAllGranted="esp_consumer">
   link2
</authz:authorize>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号