Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type Aliases

ClaimValidationError: { id: string; reason?: any }

Type declaration

  • id: string
  • Optional reason?: any
ClaimValidationResult: { isValid: true } | { isValid: false; reason?: any }
InputType: WebJSInputType & { accessDeniedScreen?: SessionFeatureBaseConfig; style?: string; onHandleEvent?: any }
RecipeInterface: { addAxiosInterceptors: any; addFetchInterceptorsAndReturnModifiedFetch: any; addXMLHttpRequestInterceptor: any; calculateClockSkewInMillis: any; doesSessionExist: any; getAccessTokenPayloadSecurely: any; getGlobalClaimValidators: any; getInvalidClaimsFromResponse: any; getUserId: any; shouldDoInterceptionBasedOnUrl: any; signOut: any; validateClaims: any }

Type declaration

  • addAxiosInterceptors:function
    • addAxiosInterceptors(input: { axiosInstance: any; userContext: any }): void
    • Parameters

      • input: { axiosInstance: any; userContext: any }
        • axiosInstance: any
        • userContext: any

      Returns void

  • addFetchInterceptorsAndReturnModifiedFetch:function
    • addFetchInterceptorsAndReturnModifiedFetch(input: { originalFetch: any; userContext: any }): ((input: URL | RequestInfo, init?: RequestInit) => Promise<Response>)
    • Parameters

      • input: { originalFetch: any; userContext: any }
        • originalFetch: any
        • userContext: any

      Returns ((input: URL | RequestInfo, init?: RequestInit) => Promise<Response>)

        • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
        • Parameters

          • input: URL | RequestInfo
          • Optional init: RequestInit

          Returns Promise<Response>

  • addXMLHttpRequestInterceptor:function
    • addXMLHttpRequestInterceptor(input: { userContext: any }): void
    • Parameters

      • input: { userContext: any }
        • userContext: any

      Returns void

  • calculateClockSkewInMillis:function
    • calculateClockSkewInMillis(params: { accessTokenPayload: any; responseHeaders: Headers }): number
    • Parameters

      • params: { accessTokenPayload: any; responseHeaders: Headers }
        • accessTokenPayload: any
        • responseHeaders: Headers

      Returns number

  • doesSessionExist:function
    • doesSessionExist(input: { userContext: any }): Promise<boolean>
    • Parameters

      • input: { userContext: any }
        • userContext: any

      Returns Promise<boolean>

  • getAccessTokenPayloadSecurely:function
    • getAccessTokenPayloadSecurely(input: { userContext: any }): Promise<any>
    • Parameters

      • input: { userContext: any }
        • userContext: any

      Returns Promise<any>

  • getGlobalClaimValidators:function
  • getInvalidClaimsFromResponse:function
    • getInvalidClaimsFromResponse(input: { response: { data: any } | Response; userContext: any }): Promise<ClaimValidationError[]>
    • Parameters

      • input: { response: { data: any } | Response; userContext: any }
        • response: { data: any } | Response
        • userContext: any

      Returns Promise<ClaimValidationError[]>

  • getUserId:function
    • getUserId(input: { userContext: any }): Promise<string>
    • Parameters

      • input: { userContext: any }
        • userContext: any

      Returns Promise<string>

  • shouldDoInterceptionBasedOnUrl:function
    • shouldDoInterceptionBasedOnUrl(toCheckUrl: string, apiDomain: string, sessionTokenBackendDomain: undefined | string): boolean
    • Parameters

      • toCheckUrl: string
      • apiDomain: string
      • sessionTokenBackendDomain: undefined | string

      Returns boolean

  • signOut:function
    • signOut(input: { userContext: any }): Promise<void>
    • Parameters

      • input: { userContext: any }
        • userContext: any

      Returns Promise<void>

  • validateClaims:function
SessionClaim<ValueType>: { getLastFetchedTime: any; getValueFromPayload: any; refresh: any }

Type Parameters

  • ValueType

Type declaration

  • getLastFetchedTime:function
    • getLastFetchedTime(payload: any, _userContext?: any): undefined | number
    • Parameters

      • payload: any
      • Optional _userContext: any

      Returns undefined | number

  • getValueFromPayload:function
    • getValueFromPayload(payload: any, _userContext?: any): undefined | ValueType
    • Parameters

      • payload: any
      • Optional _userContext: any

      Returns undefined | ValueType

  • refresh:function
    • refresh(userContext: any): Promise<void>
    • Parameters

      • userContext: any

      Returns Promise<void>

SessionClaimValidator: { id: string; refresh: any; shouldRefresh: any; validate: any }

Type declaration

  • Readonly id: string
  • refresh:function
    • refresh(userContext: any): Promise<void>
    • Makes an API call that will refresh the claim in the token.

      Parameters

      • userContext: any

      Returns Promise<void>

  • shouldRefresh:function
    • shouldRefresh(accessTokenPayload: any, userContext: any): boolean | Promise<boolean>
    • Decides if we need to refresh the claim value before checking the payload with validate. E.g.: if the information in the payload is expired, or is not sufficient for this validator.

      Parameters

      • accessTokenPayload: any
      • userContext: any

      Returns boolean | Promise<boolean>

  • validate:function
    • Decides if the claim is valid based on the accessTokenPayload object (and not checking DB or anything else)

      Parameters

      • accessTokenPayload: any
      • userContext: any

      Returns ClaimValidationResult | Promise<ClaimValidationResult>

SessionContextType: LoadedSessionContext | { loading: true }

Variables

SessionAuth: FC<PropsWithChildren<SessionAuthProps & { userContext?: UserContext }>> = SessionAPIWrapper.SessionAuth
SessionComponentsOverrideProvider: FC<PropsWithChildren<{ components: ComponentOverrideMap }>> = SessionAPIWrapper.ComponentsOverrideProvider
SessionContext: Context<{ accessDeniedValidatorError?: ClaimValidationError; invalidClaims: ClaimValidationError[]; loading: false } & SessionContextUpdate & { isDefault?: boolean } & { loading: true } & { isDefault?: boolean }> = ...

Functions

  • addAxiosInterceptors(axiosInstance: any, userContext?: UserContext): void
  • attemptRefreshingSession(): Promise<boolean>
  • doesSessionExist(input?: { userContext?: UserContext }): Promise<boolean>
  • getAccessToken(input?: { userContext?: UserContext }): Promise<undefined | string>
  • getAccessTokenPayloadSecurely(input?: { userContext?: UserContext }): Promise<any>
  • getClaimValue<T>(input: { claim: SessionClaim<T>; userContext?: UserContext }): Promise<undefined | T>
  • getInvalidClaimsFromResponse(input: { response: Response | { data: any }; userContext: UserContext }): Promise<ClaimValidationError[]>
  • getUserId(input?: { userContext?: UserContext }): Promise<string>
  • init(config?: InputType): RecipeInitResult<unknown, unknown, unknown, any>
  • signOut(input?: { userContext?: UserContext }): Promise<void>
  • useClaimValue<T>(claim: SessionClaim<T>): { loading: true } | { doesSessionExist: boolean; loading: false; value: undefined | T }

Generated using TypeDoc