在我的configure(HttpSecurity)中,我有:
.antMatchers("/api/account/reset-password/finish").hasAnyAuthority(AuthoritiesConstants.BANK, AuthoritiesConstants.USER)
在这个特定端点中:
public void finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword)
我放在上面:
@PreAuthorize("hasAnyAuthority(\""+AuthoritiesConstants.BANK+"\", \""+AuthoritiesConstants.USER+"\")")
但是,当我使用邮递员与角色为“ ROLE_ADMIN”(未经授权)的管理员用户一起使用邮递员进行测试时,没有403,并且请求可以正常通过。
信息:
AuthoritiesConstants.USER = "ROLE_USER";
AuthoritiesConstants.BANK = "ROLE_BANK";
AuthoritiesConstants.ADMIN = "ROLE_ADMIN";