Class AbstractAuthenticationSecret

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    AbstractX509PemSecret, SharedSecret

    public abstract class AbstractAuthenticationSecret
    extends java.lang.Object
    implements java.lang.Cloneable
    Class representing a secret used for authentication.
    • Field Detail

      • SECRET_TYPES

        public static java.util.Map<java.lang.String,​java.lang.Class<?>> SECRET_TYPES
        Types of authentication secret.
    • Constructor Detail

      • AbstractAuthenticationSecret

        public AbstractAuthenticationSecret()
    • Method Detail

      • canSign

        public abstract boolean canSign()
        Tests if the secret can be used for signing or, alternatively, verification only.
        Returns:
        True, if the secret can be used for signing.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Clone support.
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • equals

        public boolean equals​(java.lang.Object obj)
        Check if equal (String representation matches).
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Hashcode is string representation hash code.
        Overrides:
        hashCode in class java.lang.Object
      • fromKeyPair

        public static final AbstractX509PemSecret fromKeyPair​(PemKeyPair keypair,
                                                              boolean ignorekey,
                                                              PemKeyPair... chain)
        Creates an authentication secret based on a pem key pair.
        Parameters:
        keypair - The key pair.
        ignorekey - If true, the secret will not include the key (verify-only).
        chain - Rest of the authentication chain.
        Returns:
        The secret.
      • fromString

        public static final AbstractAuthenticationSecret fromString​(java.lang.String secret)
        Decodes a secret from a string.
        Parameters:
        secret - The secret as string.
        Returns:
        The instantiated secret.
      • fromString

        public static final AbstractAuthenticationSecret fromString​(java.lang.String secret,
                                                                    boolean strict)
        Decodes a secret from a string.
        Parameters:
        secret - The secret as string.
        strict - If false, interpret invalid string as a password.
        Returns:
        The instantiated secret.
      • main

        public static void main​(java.lang.String[] args)