MemoryCredentialStore

Credential store that keeps credentials in memory.

Implements: ICredentialStore, IReconfigurable

Description

The MemoryCredentialStore class is used to create credential stores that keep their contained credentials in memory.

Configuration parameters

  • [credential key 1]:
  • : credential parameters for key 1
  • [credential key 2]:
  • : credential parameters for key N
  • :

References

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

Constructors

Creates a new instance of the credential store.

MemoryCredentialStore(config: ConfigParams = None)

  • config: ConfigParams - (optional) configuration with credential parameters.

Instance methods

configure

Configures component by passing configuration parameters.

configure(config: ConfigParams)

  • config: ConfigParams - configuration parameters to be set.

lookup

Lookups credential parameters by its key.

lookup(context: Optional[IContext], key: str): CredentialParams

  • context: IContext - (optional) a context to trace execution through a call chain.
  • key: str - a key to uniquely identify the credential.
  • returns: CredentialParams - found credential parameters or None if nothing was found

read_credentials

Reads credentials from configuration parameters. Each section represents an individual CredentialParams.

read_credentials(config: ConfigParams)

  • config: ConfigParams - configuration parameters to be read

store

Stores credential parameters into the store.

store(context: Optional[IContext], key: str, credential: CredentialParams)

  • context: IContext - (optional) a context to trace execution through a call chain.
  • key: str - a key to uniquely identify the credential parameters.
  • credential: CredentialParams - a credential parameters to be stored.

Examples

config = ConfigParams.from_tuples("key1.user", "jdoe",
    "key1.pass", "pass123",
    "key2.user", "bsmith",
    "key2.pass", "mypass"
)

credentialStore = MemoryCredentialStore()
credentialStore.read_credentials(config)
credentialStore.lookup("123", "key1")

See also