Options
All
  • Public
  • Public/Protected
  • All
Menu

The JwtAuthentication service is a supporting feature for the other services. Typically used via the SearchClient.constructor and by providing AuthenticationSettings settings in the Settings.authentication property.

The authentication system is based on JWT and needs an end-point to be configured from where it will get its authentication-token. This service will be monitoring the token-value to see if it is either missing or expired. When that happens a new token will be fetched from the end-point. The [[AuthenticationSettings.expiryOverlap]] object controls how long before expiration the new token is to be fetched.

Hierarchy

Implements

Index

Constructors

constructor

  • Creates an JwtAuthentication object that knows where to get the auth-token and when to refresh it.

    Parameters

    • settings: string | IAuthenticationSettings

      The settings for the authentication object.

    • Optional auth: AuthToken

      An object that controls the authentication for the lookups.

    • Optional fetchMethod: (input: RequestInfo, init?: RequestInit) => Promise<Response>
        • (input: RequestInfo, init?: RequestInit): Promise<Response>
        • Parameters

          • input: RequestInfo
          • Optional init: RequestInit

          Returns Promise<Response>

    Returns JwtAuthentication

Properties

settings

Accessors

deferUpdateState

  • get deferUpdateState(): boolean
  • Can be used to check the state of deferUpdates.

    Returns boolean

numAborted

  • get numAborted(): number
  • The number of times this service-instance has aborted a request (typically as a result to starting a new request while the previous is still running and needs to be aborted).

    Returns number

numCancelled

  • get numCancelled(): number
  • The number of times this service-instance has cancelled a request (as directed from a user cbRequest rejection).

    Returns number

numCompleted

  • get numCompleted(): number
  • The number of times this service-instance has completed a request (not counting aborted or cancelled requests).

    Returns number

numFailed

  • get numFailed(): number
  • The number of times this service-instance has failed during a request (not counting aborted or cancelled requests).

    Returns number

numRequested

  • get numRequested(): number
  • The number of times this service-instance has started a request.

    Returns number

Methods

categorizationTypeChanged

clientIdChanged

  • clientIdChanged(oldValue: string, query: IQuery): void

dateFromChanged

dateToChanged

deferUpdates

  • deferUpdates(state: boolean, skipPending?: boolean): void
  • Decides whether an update should be executed or not. Typically used to temporarily turn off update-execution. When turned back on the second param can be used to indicate whether pending updates should be executed or not.

    Parameters

    • state: boolean

      Turns on or off deferring of updates.

    • skipPending: boolean = false

      Used to indicate if a pending update is to be executed or skipped when deferring is turned off. The param is ignored for state=true.

    Returns void

fetch

  • fetch(query?: IQuery, suppressCallbacks?: boolean): Promise<any>
  • Fetches the results from the server.

    Parameters

    • Optional query: IQuery

      The query-object that controls which results that are to be returned.

    • Optional suppressCallbacks: boolean

      Set to true if you have defined callbacks, but somehow don't want them to be called.

    Returns Promise<any>

    a promise that when resolved returns the data.

filtersChanged

matchGenerateContentChanged

  • matchGenerateContentChanged(oldValue: boolean, query: IQuery): void

matchGenerateContentHighlightsChanged

  • matchGenerateContentHighlightsChanged(oldValue: boolean, query: IQuery): void

matchGroupingChanged

  • matchGroupingChanged(oldValue: boolean, query: IQuery): void

matchOrderByChanged

matchPageChanged

  • matchPageChanged(oldValue: number, query: IQuery): void

matchPageSizeChanged

  • matchPageSizeChanged(oldValue: number, query: IQuery): void

maxSuggestionsChanged

  • maxSuggestionsChanged(oldValue: number, query: IQuery): void

queryTextChanged

  • queryTextChanged(oldValue: string, query: IQuery): void

requestObject

  • requestObject(includeAuthorizationHeader?: boolean): RequestInit
  • Sets up the Request that is to be executed, with headers and auth as needed.

    Parameters

    • includeAuthorizationHeader: boolean = true

      Set to false to not include the auth jwt token in the request headers. Default=true

    Returns RequestInit

searchTypeChanged

shouldUpdate

  • shouldUpdate(fieldName?: string, query?: IQuery): boolean
  • Parameters

    • Optional fieldName: string
    • Optional query: IQuery

    Returns boolean

uiLanguageCodeChanged

  • uiLanguageCodeChanged(oldValue: string, query: IQuery): void

update

  • update(query: Query, delay?: number): void
  • Call the service, but take into account deferredUpdates.

    Parameters

    • query: Query

      The query object to create the fetch for.

    • Optional delay: number

      A delay for when to execute the update, in milliseconds. Defaults to undefined.

    Returns void

Generated using TypeDoc