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

- AbstractCredentialManager
  - DefaultCredentialManager
  - InvalidCredentialManager

## Index

### Constructors

- constructor

### Properties

- displayName
- service

### Accessors

- name
- possibleSolutions

### Methods

- delete
- deleteCredentials
- initialize
- load
- loadCredentials
- save
- saveCredentials
- secureErrorDetails

## Constructors

### Protected constructor

- new AbstractCredentialManager(service: string, displayName: string): AbstractCredentialManager

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:63

  This class can not be directly instantiated so the constructor is protected. All extending classes must make a call to `super(...)` with the expected parameters.

  #### Parameters

  - ##### service: string

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

  - ##### displayName: string

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

  #### Returns AbstractCredentialManager

## Properties

### Private displayName

displayName: string

- Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:72

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

### Protected Readonly service

service: string

- Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:72

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

## Accessors

### name

- get name(): string

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:78

  #### Returns string

  - the display name of this manager. Use in logging/messaging.

### Protected possibleSolutions

- get possibleSolutions(): string[] | undefined

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:148

  #### Returns string[] | undefined

  - List of possible solutions for credential manager errors. Override this in your CredentialManager to supply more detailed error messages.

## Methods

### delete

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

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:89

  Delete credentials for an account managed by the credential manager.

  #### Parameters

  - ##### account: string

    The account (or profile identifier) associated with credentials

  #### Returns Promise<void>

### Protected Abstract deleteCredentials

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

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:161

  Called by Imperative to delete the credentials of a profile.

  throws

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

  #### Parameters

  - ##### account: string

    A user account (or profile identifier)

  #### Returns Promise<void>

### Optional initialize

- initialize(): Promise<void>

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:42

  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>

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:101

  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

- loadCredentials(account: string, optional?: boolean): Promise<SecureCredential>

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:173

  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>

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:121

  Save credentials for an account managed by the credential manager.

  throws

    ImperativeError - when the secure field is missing.

  #### Parameters

  - ##### account: string

    The account (or profile identifier) associated with credentials

  - ##### secureValue: string

    Value to be securely stored

  #### Returns Promise<void>

### Protected Abstract saveCredentials

- saveCredentials(account: string, credentials: SecureCredential): Promise<void>

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:185

  Called by Imperative to save the credentials for a profile.

  throws

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

  #### Parameters

  - ##### account: string

    A user account (or profile identifier)

  - ##### credentials: SecureCredential

    A base64 encoded username:password string

  #### Returns Promise<void>

### secureErrorDetails

- secureErrorDetails(): string | undefined

- - Defined in @zowe/imperative/src/security/src/abstract/AbstractCredentialManager.ts:137

  #### Returns string | undefined

  - Additional details for credential manager errors, if the current CredentialManager has provided any.

Generated using TypeDoc