Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Client

Hierarchy

  • Client

Implemented by

Index

Properties

events

events: Observable<ClientEvent>

Returns hot observable that sends ClientEvents when they happen.

isAuthReady$

isAuthReady$: Observable<void>

Once this observable returns, the authentication procedure is over. This is usefull for any Auth checking (eg. Auth Guards)

options

options: ClientOptions

The client options used at contstruction time.

tokens

tokens: Tokens

A cache of all currently known and defined tokens.

Methods

createLoginUrl

  • createLoginUrl(loginOptions?: undefined | { prompt?: "none" | "login"; redirectUri?: undefined | string }): string
  • Generates a URI to let the user logout. Typically you want to redirect the user to this url.

    Parameters

    • Optional loginOptions: undefined | { prompt?: "none" | "login"; redirectUri?: undefined | string }

    Returns string

createLogoutUrl

  • createLogoutUrl(): string
  • Generates a URI to let the user login. Typically you want to redirect the user to this url. The resulting token will be in the fragment of the redirectUri;

    Returns string

endpoint

  • Construct a regular Endpoint instance. This is an endpoint that does not return a Temporal Page..

    Parameters

    • uri: string

      The uri pointing to a valid - non-Temporal-Page-returning - Obelisk API endpoint.

    • Optional apiVersion: ApiVersion

    Returns Endpoint

getNewRpt

  • getNewRpt(ticket?: undefined | string): Observable<Token>
  • Returns an observable to get a new RPT. Call this after init() if you want to have an RPT available immediatly

    Parameters

    • Optional ticket: undefined | string

      Optional ticket used for authMode 'uma'

    Returns Observable<Token>

graphQLEndpoint

  • Construct a GraphQL Endpoint instance.

    Returns GraphQLEndpoint

init

  • init(): Observable<boolean>
  • Initializes the client with the Authorization server, logging in if logged in previously. Must be called before any authed calls can be made!

    Returns Observable<boolean>

    Observable boolean stating whether init performed a login with the hash url.

isLoggedIn

  • isLoggedIn(): boolean
  • Checks locally if logInfo is present in storage and not expired. Good condition for using in a Guard.

    Returns boolean

keepSessionAlive

  • keepSessionAlive(leeway?: undefined | number): Observable<boolean>
  • Keep logged in session alive by refreshing or re-requesting RPTs (in case of offline token present) Subscribe to start.

    Parameters

    • Optional leeway: undefined | number

      Configurable leeway in milliseconds for when expiration and thus refresh logic is due. (Defaults to 3000)

    Returns Observable<boolean>

    Observable of which the boolean signifies if the last refresh action succeeded.

login

  • login(loginOptions?: undefined | { prompt?: "none" | "login"; redirectUri?: undefined | string }): void
  • Do login, by changing the url with a client side redirect.

    Parameters

    • Optional loginOptions: undefined | { prompt?: "none" | "login"; redirectUri?: undefined | string }

    Returns void

loginAsClient

  • loginAsClient(clientId: string, clientSecret: string): Observable<Token>
  • Login as client. This can be used to login as the client itself. It will immediatly request an RPT token and return that.

    Parameters

    • clientId: string
    • clientSecret: string

    Returns Observable<Token>

logout

  • logout(redirectUri?: undefined | string): void
  • Do logout, by changing the url with a client side redirect.

    Parameters

    • Optional redirectUri: undefined | string

      Optional redirectUri to return to after logout, defaults to current url;

    Returns void

rawEndpoint

  • Construct a regular Endpoint instance. This is a raw endpoint that does no checking on what datastructure is returend.

    Parameters

    • uri: string

      The uri pointing to a valid endpoint.

    • Optional apiVersion: ApiVersion

    Returns Endpoint

rptHasRole

  • rptHasRole(role: string, targetClientId?: undefined | string): boolean
  • Checks the decoded RPT token for the presence of the given role string

    Parameters

    • role: string

      String of a role to check for in the RPT token

    • Optional targetClientId: undefined | string

      String of the targetClientId to check the roles for. Defaults to the Obelisk API id

    Returns boolean

streamEndpoint

  • Constructs a StreamEndpoint instance.

    Parameters

    • uri: string

      The uri pointing to a valid event stream (SSE) andpoint. (ends on /sse)

    • Optional apiVersion: ApiVersion

    Returns StreamEndpoint

temporalPageEndpoint

  • Construct an TPageEndpoint instance that you can query to get data. This should be an endpoint that returns a Temporal Page.

    Parameters

    • uri: string

      The uri pointing to a valid - Temporal-Page-returning - Obelisk API endpoint.

    • Optional apiVersion: ApiVersion

    Returns TPageEndpoint