Spring security 春季安全如何处理没有权限的问题
使用Spring安全性,我们使用hasAuthority有条件地执行代码或有条件地在jsp中显示部分页面 例如: 或(在jsp中)Spring security 春季安全如何处理没有权限的问题,spring-security,Spring Security,使用Spring安全性,我们使用hasAuthority有条件地执行代码或有条件地在jsp中显示部分页面 例如: 或(在jsp中) .... 要显示/评估的内容 我想知道当你在没有权限的情况下想要展示/执行某些东西时如何处理 可能是 没有权限(“标记保存”) 我很确定,这不是一个突然出现的用例。 有人以任何方式处理过这个问题吗?事实上发现这可以使用EL。 所以使用一个!招牌有效 所以我让它像这样工作: <sec:authorize access="!hasAuthority('TAG_
.... 要显示/评估的内容
我想知道当你在没有权限的情况下想要展示/执行某些东西时如何处理
可能是
没有权限(“标记保存”)
我很确定,这不是一个突然出现的用例。
有人以任何方式处理过这个问题吗?事实上发现这可以使用EL。 所以使用一个!招牌有效 所以我让它像这样工作:
<sec:authorize access="!hasAuthority('TAG_SAVE')">
.... content to display / evaluate when the Authority is not present
</sec:authorize>
.... 权限不存在时显示/评估的内容
您是否尝试过!是否拥有权限
?谢谢Collin D,我用它工作了!权势
<sec:authorize access="hasAuthority('TAG_SAVE')">
.... content to display / evaluate
</sec:authorize>
<sec:authorize access="!hasAuthority('TAG_SAVE')">
.... content to display / evaluate when the Authority is not present
</sec:authorize>