This class is used by the auth command handlers as the base class for their implementation.

### Hierarchy

- AbstractAuthHandler
  - BaseAuthHandler

### Implements

- ICommandHandler

## Index

### Properties

- mDefaultTokenType
- mProfileType
- mServiceDescription
- mSession

### Methods

- createSessCfgFromArgs
- doLogin
- doLogout
- getAuthHandlerApi
- getBaseProfileName
- process
- processLogin
- processLogout
- promptForBaseProfile
- showToken

## Properties

### Protected Abstract mDefaultTokenType

mDefaultTokenType: SessConstants.TOKEN_TYPE_CHOICES

Inherited from AbstractAuthHandler.mDefaultTokenType

- Defined in @zowe/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts:30

The default token type to use if not specified as a command line option

### Protected Abstract mProfileType

mProfileType: string

Inherited from AbstractAuthHandler.mProfileType

- Defined in @zowe/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts:25

The profile type where token type and value should be stored

### Protected Optional mServiceDescription

mServiceDescription: string

Inherited from AbstractAuthHandler.mServiceDescription

- Defined in @zowe/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts:35

The description of your service to be used in CLI prompt messages

### Protected mSession

mSession: AbstractSession

- Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:33

The session being created from the command line arguments / profile

## Methods

### Protected Abstract createSessCfgFromArgs

- createSessCfgFromArgs(args: ICommandArguments): ISession

- Inherited from AbstractAuthHandler.createSessCfgFromArgs

  - Defined in @zowe/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts:77

  This is called by the {@link AbstractAuthHandler#process} when it needs a session. Should be used to create a session to connect to the auth service.

  abstract

  #### Parameters

  - ##### args: ICommandArguments

    The command line arguments to use for building the session

  #### Returns ISession

  The session object built from the command line arguments.

### Protected Abstract doLogin

- doLogin(session: AbstractSession): Promise<string>

- - Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:42

  This is called by the "auth login" command after it creates a session, to obtain a token that can be stored in a profile.

  abstract

  #### Parameters

  - ##### session: AbstractSession

    The session object to use to connect to the auth service

  #### Returns Promise<string>

  The response from the auth service containing a token

### Protected Abstract doLogout

- doLogout(session: AbstractSession): Promise<void>

- - Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:50

  This is called by the "auth logout" command after it creates a session, to revoke a token before removing it from a profile.

  abstract

  #### Parameters

  - ##### session: AbstractSession

    The session object to use to connect to the auth service

  #### Returns Promise<void>

### getAuthHandlerApi

- getAuthHandlerApi(): IAuthHandlerApi

- Overrides AbstractAuthHandler.getAuthHandlerApi

  - Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:56

  Returns auth handler API that provides convenient functions to create a session from args, and use it to login or logout of an auth service.

  #### Returns IAuthHandlerApi

### Private getBaseProfileName

- getBaseProfileName(params: IHandlerParameters): string

- - Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:152

  #### Parameters

  - ##### params: IHandlerParameters

  #### Returns string

### process

- process(commandParameters: IHandlerParameters): Promise<void>

- Implementation of ICommandHandler.process

  Inherited from AbstractAuthHandler.process

  - Defined in @zowe/imperative/src/imperative/src/auth/handlers/AbstractAuthHandler.ts:46

  This handler is used for both "auth login" and "auth logout" commands. It determines the correct action to take and calls either `processLogin` or `processLogout` accordingly.

  #### Parameters

  - ##### commandParameters: IHandlerParameters

    Command parameters sent by imperative.

  #### Returns Promise<void>

### Protected processLogin

- processLogin(params: IHandlerParameters): Promise<void>

- Overrides AbstractAuthHandler.processLogin

  - Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:74

  Performs the login operation. Builds a session to connect to the auth service, sends a login request to it to obtain a token, and stores the resulting token in the profile of type `mProfileType`.

  #### Parameters

  - ##### params: IHandlerParameters

    Command parameters sent by imperative.

  #### Returns Promise<void>

### Protected processLogout

- processLogout(params: IHandlerParameters): Promise<void>

- Overrides AbstractAuthHandler.processLogout

  - Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:179

  Performs the logout operation. Deletes the token and token type from the profile, and rebuilds the session.

  #### Parameters

  - ##### params: IHandlerParameters

    Command parameters sent by imperative.

  #### Returns Promise<void>

### Private promptForBaseProfile

- promptForBaseProfile(params: IHandlerParameters, profileName: string): Promise<boolean>

- - Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:156

  #### Parameters

  - ##### params: IHandlerParameters

  - ##### profileName: string

  #### Returns Promise<boolean>

### Private showToken

- showToken(response: IHandlerResponseApi, tokenValue: string): void

- - Defined in @zowe/imperative/src/imperative/src/auth/handlers/BaseAuthHandler.ts:164

  #### Parameters

  - ##### response: IHandlerResponseApi

  - ##### tokenValue: string

  #### Returns void

Generated using TypeDoc