Class AuthorizationCodeGrantTypeHandler


  • public class AuthorizationCodeGrantTypeHandler
    extends GrantTypeHandler
    A handler that can send an authorization code and optional PKCE verifier to the token endpoint to receive an access token. The authorization code should be obtained prior to creating this grant type handler.
    • Constructor Detail

      • AuthorizationCodeGrantTypeHandler

        public AuthorizationCodeGrantTypeHandler​(String clientId,
                                                 String authorizationCode,
                                                 String redirectUri,
                                                 String pkceVerifier)
        Initialises the grant type handler with the given parameters.
        Parameters:
        clientId - the id of the client making the request.
        authorizationCode - the authorization code.
        redirectUri - the redirect_uri that was used in the authorization request, or null if not used.
        pkceVerifier - the PKCE code verifier, or null if not used.
      • AuthorizationCodeGrantTypeHandler

        public AuthorizationCodeGrantTypeHandler​(String clientId,
                                                 String authorizationCode)
        Initialises the grant type handler with the given parameters. No redirect uri or PKCE verifier will be sent on the request.
        Parameters:
        clientId - the id of the client making the request.
        authorizationCode - the authorization code.
    • Method Detail

      • handle

        protected Promise<Form,​NoSuchSecretException> handle​(Request tokenEndpointRequest,
                                                                   Form form)
        Description copied from class: GrantTypeHandler
        Handles the request by adding appropriate parameters to the OAuth 2.0 token endpoint request.
        Overrides:
        handle in class GrantTypeHandler
        Parameters:
        tokenEndpointRequest - the original token endpoint request.
        form - the POST body to add parameters to.
        Returns:
        a promise for the token endpoint request with parameters appropriate for this grant type.