Skip to main content
Version: 2.7

Auth

A static class that gathers all the required methods to handle the authentication and sessions with Olympe.

Index

Constructors

constructor

Methods

staticgenerateSRPData

  • generateSRPData(username: string, password: string): SRPData
  • Based on the username and password, it generates a salt and verifier to configure a SRP user


    Parameters

    • username: string
    • password: string

    Returns SRPData

staticgetCurrentUser

  • getCurrentUser(): string
  • Return the tag of the current authenticated user.


    Returns string

    The tag of the current user

staticgetIDPNames

  • getIDPNames(): string[]
  • Retrieve the IDP names that can be used for SSO login


    Returns string[]

staticgetIDPToken

  • getIDPToken(): string
  • Return the IDP token (zipped & base64 encoded XML) for the current user.

    @deprecated

    use Auth.getUserToken instead


    Returns string

    The current IDP token

staticgetState

staticgetToken

  • getToken(): string
  • Return the token currently used to identify the current session.

    @deprecated

    Returns string

    The current token

staticgetUserFromToken

  • getUserFromToken(token: string): Promise<string>
  • Retrieve the user tag associated to the specified token


    Parameters

    • token: string

    Returns Promise<string>

staticgetUserToken

  • Returns the full token of the current user. It contains:

    • the username, the unique ID of the user for the IDP used
    • the tag of the user in the datacloud
    • the protocol and IDP used
    • the raw payload sent by the IDP (eg: JWT for OAuth2 or SAML response).

    Returns UserToken

staticisAuthenticated

  • isAuthenticated(context: Context): Observable<boolean>
  • Returns an Observable that is updated each time the authentication status changes. If the user is authenticated, gets true, otherwise (e.g. Guest) get false.


    Parameters

    Returns Observable<boolean>

    An Observable

staticloginOpenID

  • loginOpenID(): Promise<void>
  • Try to login using the configured OpenID Provider. Returns a promise resolved when logged in or that catches an error if the login is not valid.

    @deprecated

    use Auth.loginSSO instead

    @throws

    If the provider’s configuration is incorrect.


    Returns Promise<void>

staticloginSAML

  • loginSAML(): Promise<void>
  • Try to login using SAML protocol with the specified username and password. Returns a promise resolved when logged in or that catches an error if refused.

    @deprecated

    use Auth.loginSSO instead

    @throws

    If the provider’s configuration is incorrect.


    Returns Promise<void>

staticloginSRP

  • loginSRP(username: string, password: string): Promise<void>
  • Try to login using SRP protocol with the specified username and password. Returns a promise resolved when logged in or that catches an error if refused.

    @throws

    If the provider’s configuration is incorrect.


    Parameters

    • username: string

      the username

    • password: string

      the password

    Returns Promise<void>

staticloginSSO

  • loginSSO(idpName?: string): Promise<void>
  • Try to login using SSO. Returns a promise resolved when logged in or an error if the login is not valid.

    @throws

    If the IDP name is incorrect.


    Parameters

    • optionalidpName: string

      the IDP name which should be used. If not specified, take the first available SSO.

    Returns Promise<void>

staticloginToken

  • loginToken(username: string, token: string): Promise<void>
  • Try to login using the specified token for the user. Returns a promise resolved when logged in or that catches an error if the token is not valid.


    Parameters

    • username: string

      the username

    • token: string

      the token

    Returns Promise<void>

staticlogout

  • logout(): Promise<void>
  • Log out the current user and invalidate its session token. It returns a promise resolved when the operation is done.


    Returns Promise<void>

staticobserveUser

  • observeUser(context: Context): Observable<string>
  • Returns an Observable that is updated each time the user tag changes.


    Parameters

    Returns Observable<string>

    An Observable

staticrefreshToken

  • refreshToken(): Promise<void>
  • Refresh the expiration time for the current authentication token. In case of OAuth2 authentication, it uses the refresh token associated to generate a new access token.


    Returns Promise<void>

    Promise success when the refresh is done

staticsendKeepAlive

  • sendKeepAlive(): void
  • Refresh the session token to keep it alive.

    @deprecated

    use Auth.refreshToken instead


    Returns void