Platform 3.8+. The default class for managing the user session.

Constructors

Properties

appConfig: AppConfig
csrfToken?: csrfToken
currentUser?: User
permissions?: Permissions
sessionCookie?: string
useCredentials: boolean

Methods

  • Verify that the session is still active.

    Returns Promise<boolean>

    true if the session is valid and false if the session is no longer valid.

    This method can be used to verify whether the client must reauthenticate their session.

  • Simple method for generating a redirect URL for the frontend.

    Parameters

    • url: string

      The page that the user should be redirected to after a successful authentication.

    Returns string

    The full URL that the user should be redirected for reauthentication.

    Used with frontend frameworks to redirect the user to the login URL. Once authenticated, they will return to their previous page. This flow is also supported by SSO-enabled environments.

  • A helper method for building the basic request options object.

    Parameters

    • OptionaladditionalOptions: RequestInit

      Custom request options from the caller.

    Returns RequestInit

    A RequestInit object with the required headers and user specified options.

    This method is used to append the required cookie and useCredentials values to the request options.

  • Retrieves the logged in user details.

    Returns Promise<User>

    A User object with the current user's basic profile details and preferences.

    Basic profile details are provided with the User object.

    Error if the user details could not be retrieved. The Error object will include details about the error.

  • This method is used to retrieve the permissions for the current user.

    Returns Promise<Permissions>

    Permission object containing the user's permissions against the application.

  • A simple method to check if the user has permission to perform a specific action. All inputs are case-sensitive.

    Parameters

    • actionGroup: string

      Action group name

    • actionName: string

      Action name

    • dataSourcesPath: string

      Data source path (e.g. "reservations" or "buildings/floors/spaces")

    Returns boolean

    A boolean indicating whether the user has permission to perform the action.

  • Helper method to check the csrf token and return a starter headers object.

    Returns Promise<HeadersInit>

    HeadersInit object with the csrf token.

    This is used by other functions in the library as a starter header for API calls.

  • Simple method to verify that the session is valid.

    Returns Promise<boolean>

    true if the session is valid and false if the session is no longer valid.

    Currently this is identical to checkStatus().

  • Basic non-SSO client authentication.

    Parameters

    • userName: string

      TRIRIGA username

    • password: string

      TRIRIGA password

    Returns Promise<boolean>

    true if the login was successful and false if login failed.

    This method is only supported on non-SSO instances. On succesful login, the application will set up the current user context, cookie and csrf token for future API calls. To use this method with an SSO environment, please utilize a non-SSO proc server.

  • Helper method to check and update the csrf token.

    Returns Promise<boolean>

    true if the csrf token is valid and false if it is not.

    The token must be updated if the session is updated. The token is used for certain API calls.