skipcheck

TM1 client · Docs · Sessions and logins

Tm1Authenticator

import io.skipcheck.tm1.client.auth.Tm1Authenticator;

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
Tm1Authenticator basic = Tm1Authenticator.basic("admin", "apple");
// CAM, with a user and password
Tm1Authenticator cam = Tm1Authenticator.camNamespace("alice", "secret", "LDAP");
// CAM, with a passport
Tm1Authenticator passport = Tm1Authenticator.camPassport(passports);
// A passport from Cognos
Tm1Authenticator 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 Authorization header value for one login, such as Basic YWRtaW46YXBwbGU=.
describeWhat these credentials are, for logs, without any secret, such as Basic admin.
basic staticBasic authentication, for TM1's own security (modes 1 and 2).
camNamespace staticCognos Access Manager security with a user name and password in a CAM namespace (TM1 security mode 5).
camPassport staticCognos Access Manager security with one CAM passport the application already holds, such as the one a signed-in user's request carries.
camPassport staticCognos Access Manager security with a CAM passport, such as one obtained by exchanging an OIDC token with Cognos.
cognosLogon staticCAM security with a passport the client gets from Cognos itself, logging on with a user name and password (CognosPassports.password).
cognosIdToken staticCAM security with a passport the client gets from Cognos for an OpenID Connect ID token it already holds (CognosPassports.idToken).

authorization

Mono<String> authorization()

The Authorization header value for one login, such as Basic YWRtaW46YXBwbGU=. An error fails that login and reaches the caller unchanged.

Returns

the header value

describe

String describe()

What these credentials are, for logs, without any secret, such as Basic admin.

Returns

the description

basic

static
static Tm1Authenticator basic(String user, String password)

Basic authentication, for TM1's own security (modes 1 and 2).

Parameters

user
the TM1 user name
password
the password, or null for none

Returns

the authenticator

camNamespace

static
static Tm1Authenticator camNamespace(String user, String password, String namespace)

Cognos Access Manager security with a user name and password in a CAM namespace (TM1 security mode 5): CAMNamespace base64(user:password:namespace).

Parameters

user
the user name in the namespace
password
the password
namespace
the CAM namespace ID, such as LDAP

Returns

the authenticator

camPassport

static
static Tm1Authenticator camPassport(String passport)

Cognos Access Manager security with one CAM passport the application already holds, such as the one a signed-in user's request carries: CAMPassport <passport>. 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.

Parameters

passport
the passport

Returns

the authenticator

camPassport

static
static Tm1Authenticator camPassport(Supplier<Mono<String>> passport)

Cognos Access Manager security with a CAM passport, such as one obtained by exchanging an OIDC token with Cognos: CAMPassport <passport>. Passports expire, so passport is asked for a current one on every login. When TM1 refuses a passport the login fails with Tm1ErrorKind.CREDENTIAL_REJECTED, and the session doesn't keep trying.

Parameters

passport
supplies a current passport; called once per login

Returns

the authenticator

cognosLogon

static
static Tm1Authenticator cognosLogon(String dispatcher, String namespace, String user, String password)

CAM security with a passport the client gets from Cognos itself, logging on with a user name and password (CognosPassports.password): a fresh passport for each login. Unlike camNamespace, TM1 never sees the password, only Cognos does.

Parameters

dispatcher
the Cognos dispatcher's address, such as http://cognos:9300
namespace
the namespace's ID, such as LDAP
user
the user name
password
the password

Returns

the authenticator

cognosIdToken

static
static Tm1Authenticator cognosIdToken(String dispatcher, String namespace, Supplier<Mono<String>> idToken)

CAM security with a passport the client gets from Cognos for an OpenID Connect ID token it already holds (CognosPassports.idToken): a fresh passport for each login.

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 login

Returns

the authenticator

Also in the Javadoc.