【发布时间】:2021-01-17 16:52:13
【问题描述】:
当我启用全局方法安全性时,当我调用属于带有 @Preauthorized 注释的类的端点时,我会得到 404/NotFound
这是我的配置:
@Configuration @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true, jsr250Enabled = true)
class MethodSecurityConfig : GlobalMethodSecurityConfiguration()
这是控制器:
@RestController
@RequestMapping(Endpoints.BABBLE.ROOT)
@PreAuthorize("@authenticator.checkIfThunderkickAdmin()")
class BabbleRequestController() {
@PostMapping(Endpoints.BABBLE.APPEND)
public fun balances(@RequestBody requestData: AppendRequestData, @RequestHeader(HttpHeaders.AUTHORIZATION) authHeader : String): ResponseEntity<String> {
...
【问题讨论】:
-
您是否尝试将
proxyTargetClass = true设置为@EnableGlobalMethodSecurity?
标签: java spring spring-boot kotlin spring-security