Helper class used to retrieve component credentials.

Implements: IConfigurable, IReferenceable


The CredentialResolver class is used to retrieve component credentials.

Important points

  • If credentials are configured to be retrieved from ICredentialStore, it will automatically locate ICredentialStore in component references and retrieve the credentials from there using the store_key parameter.

Configuration parameters


  • store_key: (optional) a key to retrieve the credentials from ICredentialStore
  • : other credential parameters

credentials: alternative to credential

  • [credential params 1]: first credential parameters
    • : credential parameters for key 1
  • [credential params N]: Nth credential parameters
    • : credential parameters for key N


  • *:credential-store:*:*:1.0 - (optional) Credential stores to resolve credentials


Creates a new instance of credentials resolver.

public constructor(config: ConfigParams = null, references: IReferences = null)

  • config: ConfigParams - (optional) component configuration parameters
  • references: IReferences - (optional) component references

Instance methods


Adds a new credential to component credentials

public add(connection: CredentialParams): void


Configures component by passing configuration parameters.

public configure(config: ConfigParams): void

  • config: ConfigParams - configuration parameters to be set.


Gets all credentials configured in component configuration.

Redirect to CredentialStores is not done at this point. If you need fully fleshed credential use lookup method instead.

public getAll(): CredentialParams[]


Looks up component credential parameters. If credentials are configured to be retrieved from Credential store it finds a ICredentialStore` and lookups credentials there.

public lookup(correlationId: string): Promise<CredentialParams>

  • correlationId: string - (optional) transaction id to trace execution through call chain.
  • returns: Promise<CredentialParams> - resolved credential parameters or null if nothing was found.


Sets references to dependent components.

public setReferences(references: IReferences): void

  • references: IReferences - references to locate the component dependencies.


let config = ConfigParams.fromTuples(
    "credential.user", "jdoe",
    "credential.pass",  "pass123"
let credentialResolver = new CredentialResolver();
let credential = credentialResolver.lookup("123");
// Now use the credential...

See also