Class PKCEHelper

  • All Implemented Interfaces:

    
    public final class PKCEHelper
    
                        

    Proof Key for Code Exchange (PKCE) by OAuth 2.0 public clients.

    Where an OpenID Connect service provider has configured PKCE for authorization code-flow operations, generate a code verifier and code challenge.

    For example:

    <pre> {@code val codeVerifier = PKCE.generateCodeVerifier() val codeChallenge = PKCE.generateCodeChallenge(codeVerifier) print("SHA256 hash of codeVerifier: $codeChallenge") } </pre>
    Since:

    3.0.0

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      PKCEHelper()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static String generateCodeVerifier() Generates a cryptographically random string that is used to correlate the authorization request to the token request.
      final static String generateCodeChallenge(String codeVerifier) A challenge derived from the code verifier that is sent in the authorization request, to be verified against later.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PKCEHelper

        PKCEHelper()
    • Method Detail

      • generateCodeVerifier

         final static String generateCodeVerifier()

        Generates a cryptographically random string that is used to correlate the authorization request to the token request.

        Returns:

        Cryptographically random string

        Since:

        3.0.0

      • generateCodeChallenge

         final static String generateCodeChallenge(String codeVerifier)

        A challenge derived from the code verifier that is sent in the authorization request, to be verified against later.

        Parameters:
        codeVerifier - : A cryptographically random string.
        Returns:

        Base-64 URL encoded string

        Since:

        3.0.0