Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AbstractCredentialManager

The abstract credential manager defines basic methods that must be implemented by any credential manager provided to Imperative. The abstract class is used by various methods for proper typing information.

All credential managers will be instantiated by CredentialManagerFactory.initialize and are expected to extend the AbstractCredentialManager. This is enforced by requiring your class constructor to follow the implementation rules specified by the ICredentialManagerConstructor.

The constructor signature that the ICredentialManagerConstructor specifies will always be identical to the constructor signature of the AbstractCredentialManager superclass.

Imperative will provide your CLI with a default manager, DefaultCredentialManager. If the default provided is not to your liking, you can provide your own manager as a parameter on Imperative.init at startup. This is done by providing it as part of the IImperativeConfig.overrides object.

see

{@link IImperativeOverrides.CredentialManager}

Hierarchy

Index

Constructors

Protected constructor

Properties

Private displayName

displayName: string

The display name of this manager. Used in messaging/logging.

Protected Readonly service

service: string

The service that the Credential Manager is running under. Imperative will set this to the cliName

Accessors

name

  • get name(): string

Protected possibleSolutions

  • get possibleSolutions(): string[] | undefined

Methods

delete

  • delete(account: string): Promise<void>

Protected Abstract deleteCredentials

  • deleteCredentials(account: string): Promise<void>

Optional initialize

  • This is an optional method that your Credential Manager may choose to implement. If present, it will be called by the CredentialManagerFactory.initialize function to allow your manager to do more initialization after the class has become instantiated.

    Also, since asynchronous operations are not well handled in the constructor, this allows your Credential Manager to perform any asynchronous operations needed. Your initialize method just has to return the promise and we'll handle the rest.

    Returns Promise<void>

    A promise of the completion of your initialize function.

load

  • load(account: string, optional?: boolean): Promise<string>
  • Load credentials for an account managed by the credential manager.

    Parameters

    • account: string

      The account (or profile identifier) associated with credentials

    • Optional optional: boolean

      Set to true if failure to find credentials should be ignored

    Returns Promise<string>

    The username and password associated with the account.

Protected Abstract loadCredentials

  • Called by Imperative to load the credentials of a profile.

    throws

    {ImperativeError} - when the get operation failed. The error object should have details about what failed.

    Parameters

    • account: string

      A user account (or profile identifier)

    • Optional optional: boolean

      Set to true if failure to find credentials should be ignored

    Returns Promise<SecureCredential>

    • A base64 encoded username:password string

save

  • save(account: string, secureValue: string): Promise<void>

Protected Abstract saveCredentials

secureErrorDetails

  • secureErrorDetails(): string | undefined

Generated using TypeDoc