Class CredentialPair<T extends Secret>
- java.lang.Object
 - 
- org.forgerock.secrets.credentials.CredentialPair<T>
 
 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends Secret>
CredentialPair<T>credentialPair(SecretReference<T> secretReference, Function<T,PrincipalAndSecret<T>,NoSuchSecretException> mapper)Factory method to create a new instance ofCredentialPairfrom a reference to a secret containing both the principal and secret.static <T extends Secret>
CredentialPair<T>fixedPrincipalCredentialPair(String principal, SecretReference<T> secretReference)Factory method to create a new instance ofCredentialPairwith a static principal and a dynamic principal secret.PrincipalAndSecret<T>get()Get thePrincipalAndSecret.Promise<PrincipalAndSecret<T>,NoSuchSecretException>getAsync()Gets thePrincipalAndSecretasynchronously. 
 - 
 
- 
- 
Method Detail
- 
fixedPrincipalCredentialPair
public static <T extends Secret> CredentialPair<T> fixedPrincipalCredentialPair(String principal, SecretReference<T> secretReference)
Factory method to create a new instance ofCredentialPairwith 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_idsecretReference- the secret reference- Returns:
 - a credential pair reference for the given credentials
 
 
- 
credentialPair
public static <T extends Secret> CredentialPair<T> credentialPair(SecretReference<T> secretReference, Function<T,PrincipalAndSecret<T>,NoSuchSecretException> mapper)
Factory method to create a new instance of
CredentialPairfrom 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 thePrincipalAndSecretfrom 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 understandmapper- 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
 
 
- 
getAsync
public Promise<PrincipalAndSecret<T>,NoSuchSecretException> getAsync()
Gets thePrincipalAndSecretasynchronously.- Returns:
 - a promise of the principal and secret.
 
 
- 
get
public PrincipalAndSecret<T> get() throws NoSuchSecretException
Get thePrincipalAndSecret.- Returns:
 - the 
PrincipalAndSecretfor this credential pair - Throws:
 NoSuchSecretException- if the secret does not exist
 
 - 
 
 -