Spring Security Authorization Tag is always false

I have the equivalent of the following in my jsp. Neither here nor there are displayed!

My first release in Spring Security 3.0.5. I used 3.0.3 without any problems.

<sec:authorize ifNotGranted="ROLE_ACTIVE"> here </sec:authorize> <sec:authorize ifAnyGranted="ROLE_ACTIVE"> there </sec:authorize> 
+4
source share
3 answers

Thank you for understanding. I found that this is due to the ordering of the filter mappings. Spring security should appear before Sitemesh.

Not sure how anyone could get this if I hadn’t published so many seemingly trivial details of the project.

I will know how to publish web.xml in the future. Probably just pay more attention to what is causing the problems.

+7
source

It seems that ifNotGranted and ifAnyGranted are deprecated in favor of an access expression. Try something like

 <sec:authorize access="hasRole('ROLE_ACTIVE')">here</sec:authorize> 
+1
source

If you set filters = 'none' for the jsp page and wrote the code above on the same jsp above, then your authorize tag will always return false.

you can refer to this question, your problem may be the same as me.

Spring security login / logout issue

If your problem is different, you can talk more about your security configuration.

+1
source

Source: https://habr.com/ru/post/1339259/


All Articles