CredentialResolver class
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
var config = ConfigParams.fromTuples([
'credential.user', 'jdoe',
'credential.pass', 'pass123'
]);
var credentialResolver = new CredentialResolver();
credentialResolver.configure(config);
credentialResolver.setReferences(references);
credentialResolver.lookup('123', (err, credential) => {
// Now use credential...
});
Constructors
- CredentialResolver([ConfigParams? config, IReferences? references])
- Creates a new instance of credentials resolver.
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
add(
CredentialParams credential) → void - Adds a new credential to component credentials
-
configure(
ConfigParams config) → void - Configures component by passing configuration parameters.
-
getAll(
) → List< CredentialParams> - Gets all credentials configured in component configuration.
-
lookup(
String? correlationId) → Future< CredentialParams?> - Looks up component credential parameters. If credentials are configured to be retrieved from Credential store it finds a ICredentialStore and lookups credentials there.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setReferences(
IReferences references) → void - Sets references to dependent components.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited