Class CognosPassports

java.lang.Object
io.skipcheck.tm1.client.auth.CognosPassports

public final class CognosPassports extends Object
CAM passports from Cognos, for Tm1Authenticator.camPassport(String): 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.CREDENTIAL_REJECTED), 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();
  • Method Details

    • password

      public static Supplier<reactor.core.publisher.Mono<String>> password(String dispatcher, String namespace, String user, String password)
      Passports for a user name and password in a namespace, such as an LDAP one (CAMNamespace, CAMUsername, CAMPassword).
      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:
      a supplier that logs on each time it's asked
    • idToken

      public static Supplier<reactor.core.publisher.Mono<String>> idToken(String dispatcher, String namespace, Supplier<reactor.core.publisher.Mono<String>> idToken)
      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
      Returns:
      a supplier that logs on each time it's asked