Class CredentialPair<T extends Secret>

  • Type Parameters:
    T - the type of secret for the credential pair

    public final class CredentialPair<T extends Secret>
    extends Object
    Credential pair implementation.
    • Method Detail

      • fixedPrincipalCredentialPair

        public static <T extends SecretCredentialPair<T> fixedPrincipalCredentialPair​(String principal,
                                                                                        SecretReference<T> secretReference)
        Factory method to create a new instance of CredentialPair with a static principal and a dynamic principal secret.
        Type Parameters:
        T - the type of secret for the credential pair
        Parameters:
        principal - a principal credential, e.g. username or client_id
        secretReference - the secret reference
        Returns:
        a credential pair reference for the given credentials
      • credentialPair

        public static <T extends SecretCredentialPair<T> credentialPair​(SecretReference<T> secretReference,
                                                                          Function<T,​PrincipalAndSecret<T>,​NoSuchSecretException> mapper)

        Factory method to create a new instance of CredentialPair from a reference to a secret containing both the principal and secret.

        An example of use would be to have the secret reference pointing to a JSON string such as {"principal": "...", "secret": "..."} and the mapper capable of reconstructing the PrincipalAndSecret from this JSON input.

        Type Parameters:
        T - the type of secret for the credential pair
        Parameters:
        secretReference - the secret reference pointing to a secret containing both the principal and its secret in a format the mapper will understand
        mapper - the mapper used to transform the secretReference content into a credential pair
        Returns:
        credentials using custom mappings for principal and principal secret credentials inside the secret