Helper class used to retrieve component credentials.

Inherits: 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 CredentialResolver(ConfigParams config = null, IReferences references = null)

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

Instance methods


Adds a new credential to component credentials

public void Add(CredentialParams connection)


Configures component by passing configuration parameters.

public void Configure(ConfigParams config, bool configAsDefault = true)

  • config: ConfigParams - configuration parameters to be set.
  • configAsDefault: bool - boolean parameter for default configuration. If “true” the default value will be added to the result.


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 List<CredentialParams> GetAll()


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

public Task<CredentialParams> LookupAsync(string correlationId)

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


Sets references to dependent components.

public void SetReferences(IReferences references)

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


var config = ConfigParams.FromTuples(
    "credential.user", "jdoe",
    "credential.pass",  "pass123" 

var credentialResolver = new CredentialResolver();


### See also
- #### [CredentialParams](../credential_params)
- #### [ICredentialStore](../icredentialStore)