Class Auth

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

Hierarchy

  • Auth

Constructors

Properties

appConfig: AppConfig
csrfToken: csrfToken
currentUser: User
sessionCookie: string
useCredentials: boolean

Methods

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

    Returns Promise<HeadersInit>

    HeadersInit object with the csrf token.

    Remarks

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

  • 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.

    Remarks

    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.

  • 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.

    Remarks

    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.

    Remarks

    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

    • Optional additionalOptions: RequestInit

      Custom request options from the caller.

    Returns RequestInit

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

    Remarks

    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.

    Remarks

    Basic profile details are provided with the User object.

    Throws

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

  • 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.

    Remarks

    Currently this is identical to checkStatus().

  • 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.

    Remarks

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

Generated using TypeDoc