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

- credentialManagerOptions
- displayName
- service

### Accessors

- name
- possibleSolutions

### Methods

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

## Constructors

### Protected constructor

- new AbstractCredentialManager(service: string, displayName: string, options?: ICredentialManagerOptions): AbstractCredentialManager

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

  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.

  - ##### Optional options: ICredentialManagerOptions

    Optional configuration options for the credential manager. The structure depends on the specific credential manager implementation.

  #### Returns AbstractCredentialManager

## Properties

### Protected Optional credentialManagerOptions

credentialManagerOptions: ICredentialManagerOptions

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

Options provided to the credential manager for configuration. Credential managers can use these options to customize their behavior.

### Private displayName

displayName: string

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

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:82

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:89

  #### 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:159

  #### 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:100

  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:172

  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:43

  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:112

  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:184

  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:132

  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:196

  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:148

  #### Returns string | undefined

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

Generated using TypeDoc