skipcheck

TM1 client · Docs · Sessions and logins

CognosPassports

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

CAM passports from Cognos, for Tm1Authenticator.camPassport: the client logs on to Cognos itself, rather than being handed a passport. Each supplier logs on again every time it's asked, so every TM1 login (including the one after TM1 drops a session) gets a fresh passport, and an expired one is never reused.

Both log on with Cognos's REST API: PUT <dispatcher>/api/v1/session with the logon parameters, answered with the passport in a cam_passport cookie. The dispatcher is the address TM1 itself is pointed at (ServerCAMURI, such as http://cognos:9300), reachable from the client; TM1 names it when it refuses a login (WWW-Authenticate: CAMPassport http://cognos:9300/bi/v1/disp).

A logon Cognos refuses fails with a Tm1AuthenticationException (Tm1ErrorKind.CredentialRejected), which the session doesn't retry.

Log on with a user name and password, for a passport each login:

// The client logs on to Cognos for a passport at every TM1 login, so TM1 never sees the
// password and an expired passport is never reused
return Tm1Client.builder()
  .address("https://tm1.example.com:8010")
  .authenticator(Tm1Authenticator.cognosLogon("https://cognos.example.com:9300", "LDAP", "alice", password))
  .build();

Exchange the ID token of a user the application signed in with OpenID Connect:

// An application that signed its user in with OpenID Connect hands over their ID token;
// Cognos's OIDC namespace turns it into a passport
return Tm1Client.builder()
  .address("https://tm1.example.com:8010")
  .authenticator(Tm1Authenticator.cognosIdToken("https://cognos.example.com:9300", "OIDC", currentIdToken))
  .build();

Members

password staticPassports for a user name and password in a namespace, such as an LDAP one (CAMNamespace, CAMUsername, CAMPassword).
idToken staticPassports for an OpenID Connect ID token the application already holds, through Cognos's OIDC namespace (CAMNamespace, CAMOIDCIdToken).

password

static
static password(dispatcher: string, namespace: string, user: string, password: string, fetch?: typeof globalThis.fetch): (signal?: AbortSignal) => Promise<string>

Passports for a user name and password in a namespace, such as an LDAP one (CAMNamespace, CAMUsername, CAMPassword): a supplier that logs on each time it's asked.

Parameters

dispatcher
the Cognos dispatcher's address, such as http://cognos:9300
namespace
the namespace's ID, such as LDAP
fetch
the fetch to send with; the global one by default

idToken

static
static idToken(dispatcher: string, namespace: string, idToken: Tm1Supplier, fetch?: typeof globalThis.fetch): (signal?: AbortSignal) => Promise<string>

Passports for an OpenID Connect ID token the application already holds, through Cognos's OIDC namespace (CAMNamespace, CAMOIDCIdToken): no password ever reaches the client.

Parameters

dispatcher
the Cognos dispatcher's address, such as http://cognos:9300
namespace
the OIDC namespace's ID, such as OIDC
idToken
supplies a current ID token; asked at each logon
fetch
the fetch to send with; the global one by default