Class OktaEndSessionEndpoint
java.lang.Object
io.micronaut.security.oauth2.endpoint.endsession.request.AbstractEndSessionRequest
io.micronaut.security.oauth2.endpoint.endsession.request.OktaEndSessionEndpoint
- All Implemented Interfaces:
EndSessionEndpoint
Provides specific configuration to logout from Okta.
The id_token_hint parameter is populated with the ID token obtained during the authorization code flow when it is
available as the OpenIdAuthenticationMapper.OPENID_TOKEN_KEY authentication attribute. Otherwise, when
micronaut.security.authentication is idtoken, it is populated with the token which authenticated the current request,
as recorded in the SecurityContext. Other tokens present in the request, for example an Authorization header added
by a gateway, are never forwarded to the OpenID provider.
- Since:
- 1.2.0
- Author:
- Sergio del Amo
- See Also:
-
Field Summary
Fields inherited from class AbstractEndSessionRequest
clientConfiguration, endSessionCallbackUrlBuilder, providerMetadataSupplier -
Constructor Summary
ConstructorsConstructorDescriptionOktaEndSessionEndpoint(EndSessionCallbackUrlBuilder endSessionCallbackUrlBuilder, OauthClientConfiguration clientConfiguration, Supplier<OpenIdProviderMetadata> providerMetadata, SecurityConfiguration securityConfiguration) OktaEndSessionEndpoint(EndSessionCallbackUrlBuilder endSessionCallbackUrlBuilder, OauthClientConfiguration clientConfiguration, Supplier<OpenIdProviderMetadata> providerMetadata, SecurityConfiguration securityConfiguration, TokenResolver<io.micronaut.http.HttpRequest<?>> tokenResolver) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionauthenticatingToken(@NonNull io.micronaut.http.HttpRequest<?> request) Returns the token which authenticated the request, as recorded in theSecurityContextby the authentication fetcher.getArguments(io.micronaut.http.HttpRequest<?> originating, Authentication authentication) protected StringgetUrl()parseIdToken(io.micronaut.http.HttpRequest<?> request, Authentication authentication) Resolves the ID token to send asid_token_hint.Methods inherited from class AbstractEndSessionRequest
getRedirectUri, getUrl
-
Constructor Details
-
OktaEndSessionEndpoint
public OktaEndSessionEndpoint(EndSessionCallbackUrlBuilder endSessionCallbackUrlBuilder, OauthClientConfiguration clientConfiguration, Supplier<OpenIdProviderMetadata> providerMetadata, SecurityConfiguration securityConfiguration) - Parameters:
endSessionCallbackUrlBuilder- The end session callback URL builderclientConfiguration- The client configurationproviderMetadata- The provider metadata suppliersecurityConfiguration- Security configuration- Since:
- 5.5.2
-
OktaEndSessionEndpoint
@Deprecated(since="5.5.2") public OktaEndSessionEndpoint(EndSessionCallbackUrlBuilder endSessionCallbackUrlBuilder, OauthClientConfiguration clientConfiguration, Supplier<OpenIdProviderMetadata> providerMetadata, SecurityConfiguration securityConfiguration, TokenResolver<io.micronaut.http.HttpRequest<?>> tokenResolver) Deprecated.- Parameters:
endSessionCallbackUrlBuilder- The end session callback URL builderclientConfiguration- The client configurationproviderMetadata- The provider metadata suppliersecurityConfiguration- Security configurationtokenResolver- Token Resolver. No longer used: only the token which authenticated the request is sent asid_token_hint
-
-
Method Details
-
getUrl
- Specified by:
getUrlin classAbstractEndSessionRequest- Returns:
- The url of the request
-
getArguments
protected Map<String,Object> getArguments(io.micronaut.http.HttpRequest<?> originating, Authentication authentication) - Specified by:
getArgumentsin classAbstractEndSessionRequest- Parameters:
originating- The originating requestauthentication- The authentication- Returns:
- The parameters to include in the URL
-
parseIdToken
protected Optional<String> parseIdToken(io.micronaut.http.HttpRequest<?> request, Authentication authentication) Resolves the ID token to send asid_token_hint. TheOpenIdAuthenticationMapper.OPENID_TOKEN_KEYauthentication attribute takes precedence. Otherwise, inAuthenticationMode.IDTOKENmode, the token which authenticated the request is used. Tokens found in the request which did not authenticate it are ignored, so that a token added to the request by an intermediary is not disclosed to the OpenID provider.- Parameters:
request- The HTTP Requestauthentication- The authentication- Returns:
- An ID token if it could be resolved
-
authenticatingToken
protected @NonNull Optional<String> authenticatingToken(@NonNull io.micronaut.http.HttpRequest<?> request) Returns the token which authenticated the request, as recorded in theSecurityContextby the authentication fetcher. Only this token is a candidate forid_token_hint: inAuthenticationMode.IDTOKENmode the user authenticates with the ID token, so the authenticating token is the ID token. If no token authenticated the request, an empty optional is returned and noid_token_hintis sent.- Parameters:
request- The HTTP Request- Returns:
- The token which authenticated the request, if any
- Since:
- 5.5.2
-
OktaEndSessionEndpoint(EndSessionCallbackUrlBuilder, OauthClientConfiguration, Supplier, SecurityConfiguration)instead.