Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CredentialResolver

Helper class to retrieve component credentials.

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

Configuration parameters

credential:

  • 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

References

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

CredentialParams

see

ICredentialStore

Example

let config = ConfigParams.fromTuples(
    "credential.user", "jdoe",
    "credential.pass",  "pass123"
);

let credentialResolver = new CredentialResolver();
credentialResolver.configure(config);
credentialResolver.setReferences(references);

credentialResolver.lookup("123", (err, credential) => {
    // Now use credential...
});

Hierarchy

  • CredentialResolver

Index

Constructors

constructor

  • new CredentialResolver(config?: ConfigParams, references?: IReferences): CredentialResolver
  • Creates a new instance of credentials resolver.

    Parameters

    • Default value config: ConfigParams = null

      (optional) component configuration parameters

    • Default value references: IReferences = null

      (optional) component references

    Returns CredentialResolver

Methods

add

configure

  • configure(config: ConfigParams): void
  • Configures component by passing configuration parameters.

    Parameters

    • config: ConfigParams

      configuration parameters to be set.

    Returns void

getAll

  • 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.

    Returns CredentialParams[]

    a list with credential parameters

lookup

  • lookup(correlationId: string, callback: function): void
  • Looks up component credential parameters. If credentials are configured to be retrieved from Credential store it finds a ICredentialStore and lookups credentials there.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • callback: function

      callback function that receives resolved credential or error.

    Returns void

setReferences

  • setReferences(references: IReferences): void
  • Sets references to dependent components.

    Parameters

    • references: IReferences

      references to locate the component dependencies.

    Returns void

Generated using TypeDoc