【发布时间】:2020-09-15 10:15:55
【问题描述】:
我想将自定义 AuthenticationProvider 添加到 micronaut-security as described in the docs。但我的自定义实现从未被调用:
控制器:
@Get("/team")
@Secured(SecurityRule.IS_AUTHENTICATED)
HttpResponse getTeam(@Body @Valid JoinTeamRequest req) {
log.info("Get own team")
return HttpResponse.ok()
}
自定义身份验证提供者
@Singleton
class LiquidoAuthenticationProvider implements AuthenticationProvider {
LiquidoAuthenticationProvider() {
println "============= INIT LiquidoAuthenticationProvider" // this gets called. Can set a breakpoint on it
}
@Override
public Publisher<AuthenticationResponse> authenticate(HttpRequest<?> httpRequest, AuthenticationRequest<?, ?> authenticationRequest) {
println "============= authenticate " // <=== this never gets called. Breakpoint is never reached ?????????? Why?
[...] some code to authenticate request that returns flowable UserDetails on succcess [...]
}
}
为什么从不调用 authenticate 方法?
更多可能相关的信息:
- 我在后端使用 micronaut。
- micronaut.security.authentication-provider-strategy:ANY(默认保留)
【问题讨论】:
标签: micronaut