Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CredentialParams

Contains credentials to authenticate against external services. They are used together with connection parameters, but usually stored in a separate store, protected from unauthorized access.

Configuration parameters

  • store_key: key to retrieve parameters from credential store
  • username: user name
  • user: alternative to username
  • password: user password
  • pass: alternative to password
  • access_id: application access id
  • client_id: alternative to access_id
  • access_key: application secret key
  • client_key: alternative to access_key
  • secret_key: alternative to access_key

In addition to standard parameters CredentialParams may contain any number of custom parameters

see

ConfigParams

see

ConnectionParams

see

CredentialResolver

see

ICredentialStore

Example

let credential = CredentialParams.fromTuples(
    "user", "jdoe",
    "pass", "pass123",
    "pin", "321"
);

let username = credential.getUsername();             // Result: "jdoe"
let password = credential.getPassword();             // Result: "pass123"
let pin = credential.getAsNullableString("pin");     // Result: 321

Hierarchy

Index

Constructors

constructor

  • Creates a new credential parameters and fills it with values.

    Parameters

    • Default value values: any = null

      (optional) an object to be converted into key-value pairs to initialize these credentials.

    Returns CredentialParams

Methods

getAccessId

  • getAccessId(): string
  • Gets the application access id. The value can be stored in parameters "access_id" pr "client_id"

    Returns string

    the application access id.

getAccessKey

  • getAccessKey(): string
  • Gets the application secret key. The value can be stored in parameters "access_key", "client_key" or "secret_key".

    Returns string

    the application secret key.

getPassword

  • getPassword(): string
  • Get the user password. The value can be stored in parameters "password" or "pass".

    Returns string

    the user password.

getStoreKey

  • getStoreKey(): string
  • Gets the key to retrieve these credentials from [[CredentialStore]]. If this key is null, than all parameters are already present.

    see

    useCredentialStore

    Returns string

    the store key to retrieve credentials.

getUsername

  • getUsername(): string
  • Gets the user name. The value can be stored in parameters "username" or "user".

    Returns string

    the user name.

setAccessId

  • setAccessId(value: string): void
  • Sets the application access id.

    Parameters

    • value: string

      a new application access id.

    Returns void

setAccessKey

  • setAccessKey(value: string): void
  • Sets the application secret key.

    Parameters

    • value: string

      a new application secret key.

    Returns void

setPassword

  • setPassword(value: string): void
  • Sets the user password.

    Parameters

    • value: string

      a new user password.

    Returns void

setStoreKey

  • setStoreKey(value: string): void
  • Sets the key to retrieve these parameters from [[CredentialStore]].

    Parameters

    • value: string

      a new key to retrieve credentials.

    Returns void

setUsername

  • setUsername(value: string): void
  • Sets the user name.

    Parameters

    • value: string

      a new user name.

    Returns void

useCredentialStore

  • useCredentialStore(): boolean
  • Checks if these credential parameters shall be retrieved from [[CredentialStore]]. The credential parameters are redirected to [[CredentialStore]] when store_key parameter is set.

    see

    getStoreKey

    Returns boolean

    true if credentials shall be retrieved from [[CredentialStore]]

Static fromConfig

  • Retrieves a single CredentialParams from configuration parameters from "credential" section. If "credentials" section is present instead, then is returns only the first credential element.

    see

    manyFromConfig

    Parameters

    • config: ConfigParams

      ConfigParams, containing a section named "credential(s)".

    Returns CredentialParams

    the generated CredentialParams object.

Static fromString

  • Creates a new CredentialParams object filled with key-value pairs serialized as a string.

    Parameters

    • line: string

      a string with serialized key-value pairs as "key1=value1;key2=value2;..." Example: "Key1=123;Key2=ABC;Key3=2016-09-16T00:00:00.00Z"

    Returns CredentialParams

    a new CredentialParams object.

Static fromTuples

  • Creates a new CredentialParams object filled with provided key-value pairs called tuples. Tuples parameters contain a sequence of key1, value1, key2, value2, ... pairs.

    Parameters

    • Rest ...tuples: any[]

      the tuples to fill a new CredentialParams object.

    Returns CredentialParams

    a new CredentialParams object.

Static manyFromConfig

  • Retrieves all CredentialParams from configuration parameters from "credentials" section. If "credential" section is present instead, than it returns a list with only one CredentialParams.

    Parameters

    • config: ConfigParams

      a configuration parameters to retrieve credentials

    Returns CredentialParams[]

    a list of retrieved CredentialParams

Generated using TypeDoc