Class AbstractEndSessionRequest
java.lang.Object
io.micronaut.security.oauth2.endpoint.endsession.request.AbstractEndSessionRequest
- All Implemented Interfaces:
EndSessionEndpoint
- Direct Known Subclasses:
Auth0EndSessionEndpoint, AwsCognitoEndSessionEndpoint, KeycloakEndSessionEndpoint, OktaEndSessionEndpoint
A base class to extend from to log out of an OpenID provider.
- Since:
- 1.2.0
- Author:
- James Kleeh
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final OauthClientConfigurationprotected final EndSessionCallbackUrlBuilderprotected final Supplier<OpenIdProviderMetadata> -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEndSessionRequest(EndSessionCallbackUrlBuilder endSessionCallbackUrlBuilder, OauthClientConfiguration clientConfiguration, Supplier<OpenIdProviderMetadata> providerMetadata) -
Method Summary
Modifier and TypeMethodDescriptiongetArguments(io.micronaut.http.HttpRequest<?> originating, Authentication authentication) protected StringgetRedirectUri(io.micronaut.http.HttpRequest<?> originating) protected abstract StringgetUrl()@Nullable StringgetUrl(io.micronaut.http.HttpRequest<?> originating, Authentication authentication) Builds the end session redirect URL by appending thegetArguments(HttpRequest, Authentication)to the query component ofgetUrl().
-
Field Details
-
endSessionCallbackUrlBuilder
-
clientConfiguration
-
providerMetadataSupplier
-
-
Constructor Details
-
AbstractEndSessionRequest
public AbstractEndSessionRequest(EndSessionCallbackUrlBuilder endSessionCallbackUrlBuilder, OauthClientConfiguration clientConfiguration, Supplier<OpenIdProviderMetadata> providerMetadata) - Parameters:
endSessionCallbackUrlBuilder- The end session callback URL builderclientConfiguration- The client configurationproviderMetadata- The provider metadata supplier
-
-
Method Details
-
getUrl
public @Nullable String getUrl(io.micronaut.http.HttpRequest<?> originating, Authentication authentication) Builds the end session redirect URL by appending thegetArguments(HttpRequest, Authentication)to the query component ofgetUrl(). The end session URL is treated as an opaque URI, never as a URI template, so a provider cannot influence how the parameters are rendered. Argument values are percent-encoded. Anullargument value is skipped and anIterableor array value is rendered as a repeated parameter. The end session URL must be an absolutehttporhttpsURL with a host; a relative URL, another scheme or an authority component carrying user information (https://user:password@host/...) is rejected, since an end session endpoint never legitimately takes those forms.- Specified by:
getUrlin interfaceEndSessionEndpoint- Parameters:
originating- The originating requestauthentication- The authentication- Returns:
- The end session URL, or
nullifgetUrl()is empty, is not an absolute http(s) URL with a host and without user information, or is not a valid URI
-
getUrl
- Returns:
- The url of the request
-
getArguments
protected abstract Map<String,Object> getArguments(io.micronaut.http.HttpRequest<?> originating, Authentication authentication) - Parameters:
originating- The originating requestauthentication- The authentication- Returns:
- The parameters to include in the URL
-
getRedirectUri
- Parameters:
originating- The originating request- Returns:
- The absolute redirect URI
-