我在try 创建自定义OpenIdAuthenticationMapper
时遇到此错误.此代码将向OAuth服务器发出请求,以获取识别码和令牌.我不知道怎么把AuthenticationResponse.success
路换成Publisher<AuthenticationResponse>
路.
作者:4.2.1
ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Failed to inject value for parameter [authenticationMapper] of class: io.micronaut.security.oauth2.endpoint.authorization.response.DefaultOpenIdAuthorizationResponseHandler
Message: Multiple possible bean candidates found: [DefaultOpenIdAuthenticationMapper, MyOpenIdAuthenticationMapper]
@Singleton
@Named("my")
class MyOpenIdAuthenticationMapper(
...
) : OpenIdAuthenticationMapper {
@NonNull
override fun createAuthenticationResponse(
providerName: String,
tokenResponse: OpenIdTokenResponse,
openIdClaims: OpenIdClaims,
@Nullable state: State?
): Publisher<AuthenticationResponse> {
# Make request to Oauth server
...
val attributes = mapOf(
...
)
return Mono.create { AuthenticationResponse.success(identificationCode, emptyList(), attributes) }
}
}