Class AuthCodeTokenRequestEncoder

All Implemented Interfaces:
Function<ProfileRequestContext,org.apache.hc.core5.http.ClassicHttpRequest>, Component, DestructableComponent, InitializableComponent

public class AuthCodeTokenRequestEncoder extends AbstractRequestEncoderFunction
A token request encoder that builds an OAuth2.0 Access Token Request for an authorization_code grant and returns an HttpUriRequest.
  • Field Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • pkceCodeVerifierLookupStrategy

      @Nonnull private Function<ProfileRequestContext,String> pkceCodeVerifierLookupStrategy
      The lookup strategy to pull out the PKCE code_verifier to send in the token request.
    • redirectUriLookupStrategy

      @Nonnull private Function<ProfileRequestContext,URI> redirectUriLookupStrategy
      The strategy used to look up the redirect URI to use in the token request. This will typically be the same URI used in the authorization request, but may be overridden if necessary. If not set, no redirect URI will be included in the token request which may result in an error on the OpenID Provider.
  • Constructor Details

    • AuthCodeTokenRequestEncoder

      public AuthCodeTokenRequestEncoder()
  • Method Details

    • setRedirectUriLookupStrategy

      public void setRedirectUriLookupStrategy(@Nonnull Function<ProfileRequestContext,URI> strategy)
      Set the strategy used to look up the redirect URI to use in the token request. This will typically be the same URI used in the authorization request, but may be overridden if necessary. If not set, no redirect URI will be included in the token request which may result in an error at the OpenID Provider.
      Parameters:
      strategy - The RedirectUriLookupStrategy to set.
    • setPkceCodeVerifierLookupStrategy

      public void setPkceCodeVerifierLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
      Set the strategy used to look up the PKCE code_verifier to send in the token request.
      Parameters:
      strategy - The PKCE lookup strategy to set.
    • doApply

      @Nullable public org.apache.hc.core5.http.ClassicHttpRequest doApply(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull com.nimbusds.openid.connect.sdk.op.OIDCProviderMetadata providerMetadata)
      Description copied from class: AbstractRequestEncoderFunction
      Encode a ClassicHttpRequest from the given context. Implementations should override this method.
      Specified by:
      doApply in class AbstractRequestEncoderFunction
      Parameters:
      profileRequestContext - the profile request context.
      providerMetadata - the provider metadata.
      Returns:
      the request to execute.
    • convertHttpRequest

      @Nullable private org.apache.hc.core5.http.ClassicHttpRequest convertHttpRequest(@Nonnull com.nimbusds.oauth2.sdk.http.HTTPRequest request)
      Convert the internally used HTTPRequest to the externally presented HttpUriRequest.
      Parameters:
      request - the HTTP request to convert
      Returns:
      the convert HTTP request