skipcheck

TM1 client · Docs · Sessions and logins

Tm1Authenticator

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

Supplies the credentials for logging in to TM1: the value of the Authorization header of a login request.

It's asked once per login, not once per session: a session logs in again when TM1 reports it expired, and credentials that expire themselves (a CAM passport) can be fresh each time. Only the login carries credentials; every other request carries the session cookie.

// TM1's own security
const basic = Tm1Authenticator.basic("admin", "apple");
// CAM, with a user and password
const cam = Tm1Authenticator.camNamespace("alice", "secret", "LDAP");
// CAM, with a passport
const passport = Tm1Authenticator.camPassport(passports);
// A passport from Cognos
const cognos = Tm1Authenticator.cognosLogon("http://cognos:9300", "LDAP", "alice", "secret");

Implementations must not log or otherwise reveal the credentials; describe is what logs show.

A Tm1SessionPool keeps one session for each set of a user's own credentials, and tells them apart with equals. The authenticators here that hold their credentials (basic, camNamespace, camPassport, cognosLogon) are equal when the credentials are. One that asks a supplier (camPassport, cognosIdToken) is only equal to itself, so keep it and pass the same one each time; so is your own, unless it defines equals.

Members

authorizationThe header to log in with; asked for at each login.
describeWho logs in, without secrets, for logs and errors.
toStringThe description only.
equalsWhether other logs in with the same credentials (Java's equals), which is how a Tm1SessionPool tells one user's sessions apart.
basic staticTM1's own security (modes 1 and 2).
camNamespace staticCAM security (modes 4 and 5), with a user in a namespace.
camPassport staticCAM security with one CAM passport the application already holds, such as the one a signed-in user's request carries.
camPassport staticCAM security with a passport, fetched at each login (a passport expires).
camPassport static
cognosLogon staticCAM security with a passport the client gets from Cognos itself, logging on with a user name and password.
cognosIdToken staticCAM security with a passport the client gets from Cognos for an OpenID Connect ID token it already holds.

authorization

authorization(signal?: AbortSignal): Promise<string>

The header to log in with; asked for at each login. A session waits for it no longer than its login timeout, and aborts signal when it gives up.

describe

describe(): string

Who logs in, without secrets, for logs and errors.

toString

toString(): string

The description only: never the credentials.

equals

equals(other: unknown): boolean

Whether other logs in with the same credentials (Java's equals), which is how a Tm1SessionPool tells one user's sessions apart. Only itself, unless a subclass says otherwise: the ones made here that hold their credentials do.

basic

static
static basic(user: string, password?: string | null): Tm1Authenticator

TM1's own security (modes 1 and 2).

camNamespace

static
static camNamespace(user: string, password: string, namespace: string): Tm1Authenticator

CAM security (modes 4 and 5), with a user in a namespace.

camPassport

static
static camPassport(passport: string): Tm1Authenticator

CAM security with one CAM passport the application already holds, such as the one a signed-in user's request carries: CAMPassport <passport> (Java's camPassport(String)). The passport isn't renewed: once it expires, a login with it is refused. Two of these are equal when their passports are, so a Tm1SessionPool gives a user's renewed passport a session of its own.

camPassport

static
static camPassport(passport: Tm1Supplier): Tm1Authenticator

CAM security with a passport, fetched at each login (a passport expires). Equal only to itself: keep it, and give a Tm1SessionPool the same one each time.

camPassport

static
static camPassport(passport: string | Tm1Supplier): Tm1Authenticator

cognosLogon

static
static cognosLogon(dispatcher: string, namespace: string, user: string, password: string, fetch?: typeof globalThis.fetch): Tm1Authenticator

CAM security with a passport the client gets from Cognos itself, logging on with a user name and password: a fresh passport for each login. Unlike camNamespace, TM1 never sees the password, only Cognos does. Two of these are equal when they were made from the same address, namespace, credentials and fetch.

cognosIdToken

static
static cognosIdToken(dispatcher: string, namespace: string, idToken: Tm1Supplier, fetch?: typeof globalThis.fetch): Tm1Authenticator

CAM security with a passport the client gets from Cognos for an OpenID Connect ID token it already holds: a fresh passport for each login. The token can't be compared, so two of these are equal only when they were made with the same idToken supplier (and address, namespace and fetch): keep the authenticator, or the supplier.