Options
All
  • Public
  • Public/Protected
  • All
Menu

Default entrypoint for auth-toolbox module.

Load tokens from TokenStorage, support authentication methods like login and logout, and automates the authentication of client provided with ClientAdapter.

Options can be defined with AuthOptions.

Type parameters

Hierarchy

  • Auth

Implements

Index

Constructors

constructor

Properties

usePersistentStorage

usePersistentStorage: boolean = false

Define if tokens should be stored in persistent storage.

Accessors

storageSync

  • get storageSync(): boolean
  • Check if underlying storage is synchronous.

    inheritdoc

    Returns boolean

Methods

addExclude

  • addExclude(...excludes: Exclude[]): void

addListener

decodeAccessToken

  • decodeAccessToken(): any | undefined
  • Decode the access token from Tokens if defined.

    Returns any | undefined

    The decoded access token payload.

getServerConfiguration

getTokens

  • getTokens(): Tokens<C> | undefined

interceptRequest

  • interceptRequest(request: Request): Promise

interceptResponse

isAuthenticated

  • isAuthenticated(): boolean

isExpiredAccessToken

  • isExpiredAccessToken(offset?: number): boolean | undefined

loadTokensFromStorage

  • loadTokensFromStorage(): Tokens<C> | undefined

loadTokensFromStorageAsync

  • loadTokensFromStorageAsync(): Promise<Tokens<C> | undefined>

login

  • login(credentials: C): Promise<R>
  • inheritdoc

    Parameters

    • credentials: C

    Returns Promise<R>

logout

  • logout(): Promise<R | void>
  • Forget the user authentication.

    throws

    Error if fail to renew tokens.

    Returns Promise<R | void>

    Client response if it has occured.

release

  • release(): void

removeListener

renew

  • renew(): Promise<R | void>
  • Renew tokens.

    throws

    Error if fail to renew tokens.

    Returns Promise<R | void>

    Client response if it has occured.

setTokens

  • setTokens(tokens: Tokens<C> | undefined | null): void
  • Manually store tokens synchronously. It may be used to authenticated a user with a token instead of using login with credentials.

    throws

    Error when underlying storage is not synchronous.

    see

    storageSync

    Parameters

    • tokens: Tokens<C> | undefined | null

      Tokens to save.

    Returns void

setTokensAsync

  • setTokensAsync(tokens: Tokens<C> | undefined | null): Promise
  • Manually store tokens asynchronously. It may be used to authenticated a user with a token instead of using login with credentials.

    Parameters

    • tokens: Tokens<C> | undefined | null

      Tokens to save.

    Returns Promise

Legend

  • Class
  • Class with type parameter
  • Property
  • Method
  • Function
  • Function with type parameter
  • Type alias
  • Interface
  • Interface with type parameter

Generated using TypeDoc