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

public class OktaEndSessionEndpoint extends AbstractEndSessionRequest
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:
  • Constructor Details

  • Method Details

    • getUrl

      protected String getUrl()
      Specified by:
      getUrl in class AbstractEndSessionRequest
      Returns:
      The url of the request
    • getArguments

      protected Map<String,Object> getArguments(io.micronaut.http.HttpRequest<?> originating, Authentication authentication)
      Specified by:
      getArguments in class AbstractEndSessionRequest
      Parameters:
      originating - The originating request
      authentication - 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 as id_token_hint. The OpenIdAuthenticationMapper.OPENID_TOKEN_KEY authentication attribute takes precedence. Otherwise, in AuthenticationMode.IDTOKEN mode, 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 Request
      authentication - 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 the SecurityContext by the authentication fetcher. Only this token is a candidate for id_token_hint: in AuthenticationMode.IDTOKEN mode 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 no id_token_hint is sent.
      Parameters:
      request - The HTTP Request
      Returns:
      The token which authenticated the request, if any
      Since:
      5.5.2