Class PowerAuthVersionUtil

java.lang.Object
io.getlime.security.powerauth.rest.api.spring.util.PowerAuthVersionUtil

public final class PowerAuthVersionUtil extends Object
Utility class to assist with PowerAuth version checks and related functionalities. This class provides methods to validate different aspects of the PowerAuth protocol, such as version checks, nonce verification, and timestamp checks.

Note: The usage of these utility methods ensures the protocol adheres to the correct PowerAuth versions and avoids potential issues in processing requests.

Author:
Jan Dusil, jan.dusil@wultra.com
  • Method Details

    • checkUnsupportedVersion

      public static void checkUnsupportedVersion(String version) throws PowerAuthInvalidRequestException
      Checks if the provided PowerAuth protocol version is unsupported. Throws an exception if the version is unsupported.
      Parameters:
      version - Version string to be checked.
      Throws:
      PowerAuthInvalidRequestException - If the provided version is unsupported.
    • checkMissingRequiredNonce

      public static void checkMissingRequiredNonce(String version, String nonce) throws PowerAuthInvalidRequestException
      Checks if nonce is missing for the provided PowerAuth protocol version. Throws an exception if nonce is required and missing.
      Parameters:
      version - Version string to be checked.
      nonce - Nonce string to be verified.
      Throws:
      PowerAuthInvalidRequestException - If nonce is required and missing.
    • checkMissingRequiredTimestamp

      public static void checkMissingRequiredTimestamp(String version, Long timestamp) throws PowerAuthInvalidRequestException
      Checks if timestamp is missing for the provided PowerAuth protocol version. Throws an exception if the timestamp is required and missing.
      Parameters:
      version - Version string to be checked.
      timestamp - Timestamp value to be verified.
      Throws:
      PowerAuthInvalidRequestException - If timestamp is required and missing.
    • checkMissingRequiredTemporaryKeyId

      public static void checkMissingRequiredTemporaryKeyId(String version, String temporaryKeyId) throws PowerAuthInvalidRequestException
      Checks if temporary key ID is missing for the provided PowerAuth protocol version. Throws an exception if the temporary key ID is required and missing.
      Parameters:
      version - Version string to be checked.
      temporaryKeyId - Temporary key ID value to be verified.
      Throws:
      PowerAuthInvalidRequestException - If timestamp is required and missing.
    • checkEciesParameters

      public static void checkEciesParameters(String version, io.getlime.security.powerauth.rest.api.model.request.EciesEncryptedRequest request) throws PowerAuthInvalidRequestException
      Checks if required ECIES parameters are missing for the provided PowerAuth protocol version. Throws an exception if the required parameter is missing.
      Parameters:
      version - Version string to be checked.
      request - Request to be verified.
      Throws:
      PowerAuthInvalidRequestException - If timestamp is required and missing.