Class DefaultOpenIdClient
- java.lang.Object
-
- io.micronaut.security.oauth2.client.DefaultOpenIdClient
-
- All Implemented Interfaces:
OauthClient,OpenIdClient
public class DefaultOpenIdClient extends java.lang.Object implements OpenIdClient
The default implementation ofOpenIdClient.- Since:
- 1.2.0
-
-
Constructor Summary
Constructors Constructor Description DefaultOpenIdClient(OauthClientConfiguration clientConfiguration, java.util.function.Supplier<OpenIdProviderMetadata> openIdProviderMetadata, OpenIdAuthenticationMapper authenticationMapper, AuthorizationRedirectHandler redirectUrlBuilder, OpenIdAuthorizationResponseHandler authorizationResponseHandler, io.micronaut.context.BeanContext beanContext, EndSessionEndpoint endSessionEndpoint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>>authorizationRedirect(io.micronaut.http.HttpRequest<?> originating)Responsible for redirecting to the authorization endpoint.java.util.Optional<io.micronaut.http.MutableHttpResponse<?>>endSessionRedirect(io.micronaut.http.HttpRequest<?> request, io.micronaut.security.authentication.Authentication authentication)Redirects to the end session endpoint of an OpenID provider.java.lang.StringgetName()protected SecureEndpointgetTokenEndpoint()protected booleanisErrorCallback(io.micronaut.core.convert.value.ConvertibleMultiValues<java.lang.String> responseData)org.reactivestreams.Publisher<io.micronaut.security.authentication.AuthenticationResponse>onCallback(io.micronaut.http.HttpRequest<java.util.Map<java.lang.String,java.lang.Object>> request)Responsible for receiving the authorization callback request and returning an authentication response.booleansupportsEndSession()
-
-
-
Constructor Detail
-
DefaultOpenIdClient
public DefaultOpenIdClient(OauthClientConfiguration clientConfiguration, java.util.function.Supplier<OpenIdProviderMetadata> openIdProviderMetadata, @Nullable OpenIdAuthenticationMapper authenticationMapper, AuthorizationRedirectHandler redirectUrlBuilder, OpenIdAuthorizationResponseHandler authorizationResponseHandler, io.micronaut.context.BeanContext beanContext, @Nullable EndSessionEndpoint endSessionEndpoint)
- Parameters:
clientConfiguration- The client configurationopenIdProviderMetadata- The provider metadataauthenticationMapper- The user details mapperredirectUrlBuilder- The redirect URL builderauthorizationResponseHandler- The authorization response handlerbeanContext- The bean contextendSessionEndpoint- The end session request
-
-
Method Detail
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceOauthClient- Returns:
- The provider name
-
supportsEndSession
public boolean supportsEndSession()
- Specified by:
supportsEndSessionin interfaceOpenIdClient- Returns:
- True if this client supports end session
-
endSessionRedirect
public java.util.Optional<io.micronaut.http.MutableHttpResponse<?>> endSessionRedirect(io.micronaut.http.HttpRequest<?> request, io.micronaut.security.authentication.Authentication authentication)Description copied from interface:OpenIdClientRedirects to the end session endpoint of an OpenID provider. Returns an empty optional if the provider does not support end session or anEndSessionEndpointcould not be resolved for the provider.- Specified by:
endSessionRedirectin interfaceOpenIdClient- Parameters:
request- The current requestauthentication- The current authentication- Returns:
- An optional response
-
authorizationRedirect
public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> authorizationRedirect(io.micronaut.http.HttpRequest<?> originating)
Description copied from interface:OauthClientResponsible for redirecting to the authorization endpoint.- Specified by:
authorizationRedirectin interfaceOauthClient- Parameters:
originating- The originating request- Returns:
- A response publisher
-
onCallback
public org.reactivestreams.Publisher<io.micronaut.security.authentication.AuthenticationResponse> onCallback(io.micronaut.http.HttpRequest<java.util.Map<java.lang.String,java.lang.Object>> request)
Description copied from interface:OauthClientResponsible for receiving the authorization callback request and returning an authentication response.- Specified by:
onCallbackin interfaceOauthClient- Parameters:
request- The callback request- Returns:
- The authentication response
-
isErrorCallback
protected boolean isErrorCallback(io.micronaut.core.convert.value.ConvertibleMultiValues<java.lang.String> responseData)
- Parameters:
responseData- The response data- Returns:
- True if the response indicates an error occurred.
-
getTokenEndpoint
protected SecureEndpoint getTokenEndpoint()
- Returns:
- The token endpoint
-
-