Class SignatureSupportingConfigProperties


  • public class SignatureSupportingConfigProperties
    extends Object
    Common properties required for creating/validating cryptographic signatures.
    • Constructor Detail

      • SignatureSupportingConfigProperties

        public SignatureSupportingConfigProperties()
    • Method Detail

      • getSharedSecret

        public final String getSharedSecret()
        Gets the secret used for creating and validating HmacSHA256 based signatures.
        Returns:
        The secret or null if not set.
      • setSharedSecret

        public final void setSharedSecret​(String secret)
        Sets the secret to use for creating and validating HmacSHA256 based signatures.
        Parameters:
        secret - The shared secret.
        Throws:
        NullPointerException - if secret is null.
        IllegalArgumentException - if the secret is < 32 bytes.
      • setKeyPath

        public final void setKeyPath​(String keyPath)
        Sets the path to the file containing the private key to be used for creating SHA256withRSA based signatures.

        The file must be in PKCS8 PEM format.

        Parameters:
        keyPath - The path to the PEM file.
        Throws:
        NullPointerException - if the path is null.
      • getKeyPath

        public final String getKeyPath()
        Gets the path to the file containing the private key to be used for validating RSA based signatures.
        Returns:
        The path to the file or null if not set.
      • getTokenExpiration

        public final long getTokenExpiration()
        Gets the period of time after which tokens created using this configuration should expire.
        Returns:
        The number of seconds after which tokens expire.
      • setTokenExpiration

        public final void setTokenExpiration​(long seconds)
        Sets the period of time after which tokens created using this configuration should expire.

        The default value is 600 seconds (10 minutes).

        Parameters:
        seconds - The number of seconds after which tokens expire.
        Throws:
        IllegalArgumentException - if seconds is <= 0.
      • setCertPath

        public final void setCertPath​(String certPath)
        Sets the path to the X.509 certificate containing the public key to be used for validating SHA256withRSA based signatures.

        The file must be in PKCS8 PEM format.

        Parameters:
        certPath - The path to the PEM file.
        Throws:
        NullPointerException - if the path is null.
      • getCertPath

        public final String getCertPath()
        Gets the path to the X.509 certificate containing the public key to be used for validating RSA based signatures.
        Returns:
        The path to the file or null if not set.
      • isAppropriateForCreating

        public final boolean isAppropriateForCreating()
        Checks if this configuration contains enough information for creating assertions.
        Returns:
        true if any of sharedSecret or keyPath is not null.
      • isAppropriateForValidating

        public final boolean isAppropriateForValidating()
        Checks if this configuration contains enough information for validating assertions.
        Returns:
        true if any of sharedSecret or certificatePath is not null.