Class PasswordCredential

    • Constructor Detail

      • PasswordCredential

        public PasswordCredential​(Password password)
        Construct a new instance.
        Parameters:
        password - the password (must not be null)
    • Method Detail

      • getPassword

        public Password getPassword()
        Get the password.
        Returns:
        the password (not null)
      • getPassword

        public <P extends Password> P getPassword​(Class<P> type)
        Get the password if it is of the given type; otherwise return null.
        Type Parameters:
        P - the password type
        Parameters:
        type - the password type class
        Returns:
        the password, or null if the password is not of the given type
      • supportsParameters

        public boolean supportsParameters​(Class<? extends AlgorithmParameterSpec> paramSpecClass)
        Description copied from interface: AlgorithmCredential
        Determine whether this credential instance supports the given algorithm parameter type.
        Specified by:
        supportsParameters in interface AlgorithmCredential
        Parameters:
        paramSpecClass - the parameter specification class (must not be null)
        Returns:
        true if the parameter type is supported, false otherwise
      • getParameters

        public <P extends AlgorithmParameterSpec> P getParameters​(Class<P> paramSpecClass)
        Description copied from interface: AlgorithmCredential
        Get the algorithm parameters of the given type from this credential.
        Specified by:
        getParameters in interface AlgorithmCredential
        Parameters:
        paramSpecClass - the parameter specification class (must not be null)
        Returns:
        the parameter specification, or null if no parameters are present or available or the given type was not supported by this credential
      • impliesParameters

        public boolean impliesParameters​(AlgorithmParameterSpec parameterSpec)
        Description copied from interface: AlgorithmCredential
        Determine whether this credential implies the given parameters. The default implementation returns false always.
        Specified by:
        impliesParameters in interface AlgorithmCredential
        Parameters:
        parameterSpec - the parameters to test for (must not be null)
        Returns:
        true if the given parameters match this credential, false otherwise
      • impliesSameParameters

        public boolean impliesSameParameters​(AlgorithmCredential other)
        Description copied from interface: AlgorithmCredential
        Determine whether the other credential's parameters are implied by this one.
        Specified by:
        impliesSameParameters in interface AlgorithmCredential
        Parameters:
        other - the other credential (must not be null)
        Returns:
        true if the credentials have matching parameters, false otherwise
      • canVerify

        public boolean canVerify​(Class<? extends Evidence> evidenceClass,
                                 String algorithmName)
        Description copied from interface: Credential
        Determine whether this credential can, generally speaking, verify the given evidence type.
        Specified by:
        canVerify in interface Credential
        Parameters:
        evidenceClass - the evidence type (must not be null)
        algorithmName - the evidence algorithm name (may be null if the type of evidence does not support algorithm names)
        Returns:
        true if the evidence can be verified by this credential, false otherwise
      • canVerifyEvidence

        public static boolean canVerifyEvidence​(Class<? extends Evidence> evidenceClass,
                                                String algorithmName)
        Determine whether this credential type can, generally speaking, verify the given evidence type.
        Parameters:
        evidenceClass - the evidence type (must not be null)
        algorithmName - the evidence algorithm name (may be null if the type of evidence does not support algorithm names)
        Returns:
        true if the evidence can be verified by this credential, false otherwise
      • verify

        public boolean verify​(Supplier<Provider[]> providerSupplier,
                              Evidence evidence)
        Description copied from interface: Credential
        Verify the given evidence.
        Specified by:
        verify in interface Credential
        Parameters:
        providerSupplier - the provider supplier to use for verification purposes
        evidence - the evidence to verify (must not be null)
        Returns:
        true if the evidence is verified, false otherwise
      • verify

        public boolean verify​(Supplier<Provider[]> providerSupplier,
                              Evidence evidence,
                              Charset hashCharset)
        Verify the given evidence.
        Parameters:
        providerSupplier - the provider supplier to use for verification purposes (must not be null)
        evidence - the evidence to verify (must not be null)
        hashCharset - the character set to use when converting the password string to a byte array (must not be null)
        Returns:
        true if the evidence is verified, false otherwise
      • verify

        public boolean verify​(Evidence evidence,
                              Charset hashCharset)
        Verify the given evidence.
        Parameters:
        evidence - the evidence to verify (must not be null)
        hashCharset - the character set to use when converting the password string to a byte array (must not be null)
        Returns:
        true if the evidence is verified, false otherwise
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object