spring <security:authorize not =“” working =“” with =“” annotated =“” controllers =“”

时间:2018-10-16 12:26:56

标签: java spring spring-mvc spring-security

=“”

我有一个具有
的控制器 @PreAuthorize("hasAnyRole('USER')")
并且当我尝试使用<security:authorize url="path-to-controller">呈现页面的某些特定部分时,即使登录的用户没有访问该控制器的权限,它也会通过。
在我的安全配置中,我添加了:
@EnableGlobalMethodSecurity(jsr250Enabled = true, prePostEnabled = true, securedEnabled = true)

在安全配置中配置了特定的url时,要禁止特定的角色访问它,安全标记可以工作,但不能与控制器上的注释一起使用。可以通过注释实现相同的行为吗?

0 个答案:

没有答案
相关问题