java.lang.Object
io.micronaut.security.oauth2.endpoint.authorization.pkce.S256PkceGenerator
All Implemented Interfaces:
io.micronaut.core.naming.Named, io.micronaut.core.order.Ordered, PkceGenerator

@Named("S256") @Singleton @Requires(condition=Sha256Condition.class) public class S256PkceGenerator extends Object implements PkceGenerator
SHA-256 based PKCE Generator.
Since:
3.9.0
Author:
Sergio del Amo
See Also:
  • Field Details

  • Constructor Details

    • S256PkceGenerator

      public S256PkceGenerator(CodeVerifierGenerator codeVerifierGenerator)
      Parameters:
      codeVerifierGenerator - Code Verifier generator
  • Method Details

    • getName

      @NonNull public @NonNull String getName()
      Specified by:
      getName in interface io.micronaut.core.naming.Named
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface io.micronaut.core.order.Ordered
    • supportsAny

      public boolean supportsAny(@NonNull @NonNull List<String> codeChallengeMethods)
      Specified by:
      supportsAny in interface PkceGenerator
      Parameters:
      codeChallengeMethods - Code Challenge methods
      Returns:
      Whether the PKCE Generator supports any of the supplied code challenge methods.
    • generate

      @NonNull public @NonNull Pkce generate()
      Specified by:
      generate in interface PkceGenerator
      Returns:
      Generates a Pkce.
    • hash

      @NonNull public static @NonNull String hash(@NonNull @NonNull String value)
      Parameters:
      value - Value to be hashed
      Returns:
      a hash build with algorithm SHA-256