Interface CNonceHandler

All Superinterfaces:
Provider
All Known Implementing Classes:
JwtCNonceHandler

public interface CNonceHandler extends Provider
Author:
Pascal Knüppel
  • Method Details

    • buildCNonce

      String buildCNonce(List<String> audiences, @Nullable Map<String,Object> additionalDetails)
      used to build a cNonce in any style. For jwt-based cNonces we will additionally require the audience-values that should be added into the cNonce
      Parameters:
      audiences - the audiences for jwt-based cNonces
      additionalDetails - additional attributes that might be required to build the cNonce and that are handler specific
      Returns:
      the cNonce in string representation
    • verifyCNonce

      void verifyCNonce(String cNonce, List<String> audiences, @Nullable Map<String,Object> additionalDetails) throws VerificationException
      must verify the validity of a cNonce value that has been issued by the buildCNonce(List, Map) method.
      Parameters:
      cNonce - the cNonce to validate
      audiences - the expected audiences for jwt-based cNonces
      additionalDetails - additional attributes that might be required to build the cNonce and that are handler specific
      Throws:
      VerificationException - if the cNonce cannot be verified
    • verifyCNonceAndGetToken

      default JsonWebToken verifyCNonceAndGetToken(String cNonce, List<String> audiences, @Nullable Map<String,Object> additionalDetails) throws VerificationException
      Verifies the validity of a cNonce value and returns its verified token representation.
      Parameters:
      cNonce - the cNonce to validate
      audiences - the expected audiences for jwt-based cNonces
      additionalDetails - additional attributes that might be required to build the cNonce and that are handler specific
      Returns:
      the verified cNonce token representation
      Throws:
      VerificationException - if the cNonce cannot be verified
    • supportsCNonceTokenRetrieval

      default boolean supportsCNonceTokenRetrieval()
      Returns:
      true if this handler can return the verified cNonce token representation.
    • consumeCNonce

      default void consumeCNonce(String cNonce) throws VerificationException
      Marks a verified cNonce value as consumed.
      Parameters:
      cNonce - the cNonce to consume
      Throws:
      VerificationException
    • consumeCNonce

      default void consumeCNonce(String cNonce, JsonWebToken cNonceToken) throws VerificationException
      Marks a verified cNonce value as consumed.
      Parameters:
      cNonce - the cNonce to consume
      cNonceToken - the already verified cNonce token
      Throws:
      VerificationException
    • supportsCNonceConsumption

      default boolean supportsCNonceConsumption()
      Returns:
      true if this handler can mark cNonce values as consumed.
    • ensureCNonceNotYetConsumed

      default void ensureCNonceNotYetConsumed(String cNonce) throws VerificationException
      Checks if cNonce is so far not yet consumed (without consuming it) for fail-fast purposes.
      Throws:
      VerificationException - if already consumed or check not supported.
    • close

      default void close()
      Specified by:
      close in interface Provider