Class ValidCredentialPairs<S extends Secret,E extends Exception>

java.lang.Object
org.forgerock.secrets.credentials.ValidCredentialPairs<S,E>
Type Parameters:
S - the type of secret stored in the credential pairs
E - the type of exception thrown by the secrets reference

public final class ValidCredentialPairs<S extends Secret,E extends Exception> extends Object
A set of credential pairs built from a ValidSecretsReference.
  • Method Details

    • fixedPrincipalCredentialPairs

      public static <S extends Secret, E extends Exception> ValidCredentialPairs<S,E> fixedPrincipalCredentialPairs(String principal, ValidSecretsReference<S,E> validSecrets)
      Factory method to create a new instance of ValidCredentialPairs from a reference to a set of secrets. Each credential pair will have the same principal value.
      Type Parameters:
      S - the type of secret stored in the credential pairs
      E - the type of exception thrown by the secrets reference
      Parameters:
      principal - the principal value
      validSecrets - the reference pointing to a set of secrets
      Returns:
      the valid credential pairs reference
    • credentialPairs

      public static <S extends Secret, E extends Exception> ValidCredentialPairs<S,E> credentialPairs(ValidSecretsReference<S,E> validSecrets, Function<S,PrincipalAndSecret<S>> mapper)
      Factory method to create a new instance of ValidCredentialPairs from a reference to a set of secrets that each contain a credential pair.
      Type Parameters:
      S - the type of secret stored in the credential pairs
      E - the type of exception thrown by the secrets reference
      Parameters:
      validSecrets - the reference pointing to a set of secrets containing the credential pairs
      mapper - the mapper used to transform the secret content into a credential pair
      Returns:
      the valid credential pairs reference
    • getAsync

      public Promise<List<PrincipalAndSecret<S>>,E> getAsync()
      Gets the valid credential pairs asynchronously.
      Returns:
      a promise of the valid credential pairs or the exception thrown by the secrets reference
    • get

      public List<PrincipalAndSecret<S>> get() throws E
      Get the valid credential pairs.
      Returns:
      the valid credential pairs
      Throws:
      E - if the secrets reference throws an exception