Class Tm1Identity

java.lang.Object
io.skipcheck.tm1.client.session.Tm1Identity

public final class Tm1Identity extends Object
Who a session is: the identity a Tm1SessionPool keys its sessions by. In TM1 the identity is fixed when the session logs in, so one identity is one session.

Two identities are equal when they're the same kind and their names match as TM1 matches user names, ignoring case and spaces, so impersonating("Alice") and impersonating("alice") share a session.

For a user's own credentials, the credentials must be equal too. A name is only what the caller says, and it's TM1 that checks credentials, at login: if the name alone found the session, anyone giving a logged-in user's name would get that user's session without TM1 ever seeing what they offered, and a corrected password or a renewed passport would never be used. So different credentials for the same name get a session of their own, and TM1 accepts or refuses them. See Tm1Authenticator for which authenticators are equal to one another.

  • Method Details

    • serviceAccount

      public static Tm1Identity serviceAccount()
      The pool's own credentials, with no impersonation.
      Returns:
      the identity
    • impersonating

      public static Tm1Identity impersonating(String user)
      The pool's credentials, acting as TM1 user user. The pool's credentials must be an administrator's or a data administrator's, and administrators can't be impersonated; see Tm1Session.Builder.impersonate(String).
      Parameters:
      user - the TM1 user to act as
      Returns:
      the identity
      Throws:
      IllegalArgumentException - if user is blank or has a control character
    • withCredentials

      public static Tm1Identity withCredentials(String name, Tm1Authenticator authenticator)
      A user logging in with their own credentials.
      Parameters:
      name - who the credentials belong to, for the pool's key and for logs, such as the user name
      authenticator - their credentials. Pass one that is equal each time, or the same object: an authenticator the pool hasn't seen for this name gets a new session
      Returns:
      the identity
    • kind

      public Tm1Identity.Kind kind()
      What kind of identity this is.
      Returns:
      the kind
    • name

      public String name()
      The user's name, as given; empty for the service account.
      Returns:
      the name
    • authenticator

      public Optional<Tm1Authenticator> authenticator()
      The user's own credentials, for Tm1Identity.Kind.OWN_CREDENTIALS.
      Returns:
      the authenticator, or empty for the other kinds
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object