skipcheck

TM1 client · Docs · Sessions and logins

Tm1Identity

import { Tm1Identity } from "@skipcheck/tm1-client";

Who a session is: the identity a Tm1SessionPool keys its sessions by. In TM1 the identity is fixed when the session logs in, so one identity is one session.

  • serviceAccount: the pool's own credentials, as they are.
  • impersonating: the pool's credentials, acting as a TM1 user through TM1-Impersonate.
  • withCredentials: a user's own credentials, such as their CAM passport.

Two identities are equal when they're the same kind and their names match as TM1 matches user names, ignoring case and spaces, so impersonating("Alice") and impersonating("alice") share a session.

For a user's own credentials, the credentials must be equal too. A name is only what the caller says, and it's TM1 that checks credentials, at login: if the name alone found the session, anyone giving a logged-in user's name would get that user's session without TM1 ever seeing what they offered, and a corrected password or a renewed passport would never be used. So different credentials for the same name get a session of their own, and TM1 accepts or refuses them. See Tm1Authenticator for which authenticators are equal to one another.

Members

serviceAccount staticThe pool's own credentials, with no impersonation.
impersonating staticThe pool's credentials, acting as TM1 user user.
withCredentials staticA user logging in with their own credentials.
kindWhat kind of identity this is.
nameThe user's name, as given; empty for the service account.
authenticatorThe user's own credentials, for OwnCredentials; undefined for the other kinds.
key@internal What the pool finds its sessions by.
applyTo@internal Applies this identity to session settings copied from the pool's.
equalsWhether other is the same identity.
toStringThe identity, for logs.

serviceAccount

static
static serviceAccount(): Tm1Identity

The pool's own credentials, with no impersonation.

impersonating

static
static impersonating(user: string): Tm1Identity

The pool's credentials, acting as TM1 user user. The pool's credentials must be an administrator's or a data administrator's, and administrators can't be impersonated; see Tm1SessionBuilder.impersonate.

Throws

RangeError if user is blank or has a control character

withCredentials

static
static withCredentials(name: string, authenticator: Tm1Authenticator): Tm1Identity

A user logging in with their own credentials.

Parameters

name
who the credentials belong to, for the pool's key and for logs, such as the user name
authenticator
their credentials. Pass one that is equal each time, or the same object: an authenticator the pool hasn't seen for this name gets a new session

kind

kind(): Tm1Identity.Kind

What kind of identity this is.

name

name(): string

The user's name, as given; empty for the service account.

authenticator

authenticator(): Tm1Authenticator | undefined

The user's own credentials, for OwnCredentials; undefined for the other kinds.

key

key(): string

@internal What the pool finds its sessions by: the kind and the comparable name. Identities with the same key are the same one only if they're equals: a name may come with different credentials.

applyTo

applyTo(settings: Tm1SessionBuilder): Tm1SessionBuilder

@internal Applies this identity to session settings copied from the pool's.

equals

equals(other: unknown): boolean

Whether other is the same identity: the same kind and name and, for a user's own credentials, equal credentials (Tm1Authenticator.equals).

toString

toString(): string

The identity, for logs: its kind and name, never credentials.