Error using Spring authorize tag to check to see if user is logged in?

前端 未结 2 1476
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 10:12

Trying to test to see if a user is logged in I am using the following code:

<%@ taglib prefix=\"sec\" uri=\"http://www.springframework.org/security/tags\" %&         


        
相关标签:
2条回答
  • 2021-02-19 10:53

    Setting use-expressions="true" in the http element will work but means all your security settings in both Java code and security contexts must use expression notations. This can be a problem if you are currently using the standard security notations.

    To use both expressions and standard notations just declare a new bean in your security context like so -

    <beans:bean class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
    
    0 讨论(0)
  • 2021-02-19 11:00

    To use expressions to secure individual URLs, you would first need to set the use-expressions attribute in the element to true

    <http use-expressions="true"> See Spring Security doc

    0 讨论(0)
提交回复
热议问题