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
authorization | The header to log in with; asked for at each login. |
describe | Who logs in, without secrets, for logs and errors. |
toString | The description only. |
equals | Whether other logs in with the same credentials (Java's equals), which is how a Tm1SessionPool tells one user's sessions apart. |
basic static | TM1's own security (modes 1 and 2). |
camNamespace static | CAM security (modes 4 and 5), with a user in a namespace. |
camPassport static | CAM security with one CAM passport the application already holds, such as the one a signed-in user's request carries. |
camPassport static | CAM security with a passport, fetched at each login (a passport expires). |
camPassport static | |
cognosLogon static | CAM security with a passport the client gets from Cognos itself, logging on with a user name and password. |
cognosIdToken static | CAM 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(): stringWho logs in, without secrets, for logs and errors.
toString
toString(): stringThe description only: never the credentials.
equals
equals(other: unknown): booleanWhether 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
staticstatic basic(user: string, password?: string | null): Tm1AuthenticatorTM1's own security (modes 1 and 2).
camNamespace
staticstatic camNamespace(user: string, password: string, namespace: string): Tm1AuthenticatorCAM security (modes 4 and 5), with a user in a namespace.
camPassport
staticstatic camPassport(passport: string): Tm1AuthenticatorCAM 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
staticstatic camPassport(passport: Tm1Supplier): Tm1AuthenticatorCAM 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
staticstatic camPassport(passport: string | Tm1Supplier): Tm1AuthenticatorcognosLogon
staticstatic cognosLogon(dispatcher: string, namespace: string, user: string, password: string, fetch?: typeof globalThis.fetch): Tm1AuthenticatorCAM 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
staticstatic cognosIdToken(dispatcher: string, namespace: string, idToken: Tm1Supplier, fetch?: typeof globalThis.fetch): Tm1AuthenticatorCAM 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.