Record Class BlueMindAccount

java.lang.Object
java.lang.Record
org.exoplatform.bluemind.client.model.BlueMindAccount
Record Components:
apiRoot - any address on the server — only its scheme, host and port are ever used, the client appends /api itself and never a path the caller names
login - the BlueMind login; an alias is fine, BlueMind resolves it (latd)
password - the directory password, or a session id — both mint a session
origin - what eXo names itself as in BlueMind's login audit (exo-caldav, exo-platform, …)

public record BlueMindAccount(URI apiRoot, String login, String password, String origin) extends Record
Where and as whom a BlueMind session is opened: values the consumer resolved from its own credentials, never a type of the consumer's (it replaces the calendar side's CalDavEndpoint + CaldavCredentialsResolver pair and the credentials provider's three strings).

toString() never names the password: a record's generated one would put it in any log line or exception message the account reaches.

  • Constructor Details

    • BlueMindAccount

      public BlueMindAccount(URI apiRoot, String login, String password, String origin)
      Creates an instance of a BlueMindAccount record class.
      Parameters:
      apiRoot - the value for the apiRoot record component
      login - the value for the login record component
      password - the value for the password record component
      origin - the value for the origin record component
  • Method Details

    • fromBasicAuthorization

      public static BlueMindAccount fromBasicAuthorization(URI apiRoot, String authorization, String origin)
      The account a Basic authorization header carries — how the calendar side has always obtained its login and password from the configured credentials provider (BlueMindRestSession.accountOf). Only the first colon separates: a password may hold more.
      Parameters:
      apiRoot - any address on the server
      authorization - the header value, Basic <base64(login:password)>
      origin - what eXo names itself as in BlueMind's login audit
      Returns:
      the account
      Throws:
      UnsupportedOperationException - when the header is not a Basic login and password — no other material is a login this API takes
    • toString

      public String toString()
      Names the account without ever naming its password — safe in logs.
      Specified by:
      toString in class Record
      Returns:
      the account described by its server, login and origin
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • apiRoot

      public URI apiRoot()
      Returns the value of the apiRoot record component.
      Returns:
      the value of the apiRoot record component
    • login

      public String login()
      Returns the value of the login record component.
      Returns:
      the value of the login record component
    • password

      public String password()
      Returns the value of the password record component.
      Returns:
      the value of the password record component
    • origin

      public String origin()
      Returns the value of the origin record component.
      Returns:
      the value of the origin record component