Record Class UiApiCredentials

java.lang.Object
java.lang.Record
com.kingsrook.qqq.middleware.javalin.specs.invoke.UiApiCredentials
Record Components:
sessionUUID - the sessionUUID cookie
sessionId - the sessionId cookie
authorization - the Authorization header
apiKey - the x-api-key header
inProcessSessionToken - JVM-local session token, never captured from a client

public record UiApiCredentials(String sessionUUID, String sessionId, String authorization, String apiKey, String inProcessSessionToken) extends Record
The credentials a caller's request carried, to forward on in-process UI API calls so they authenticate exactly as the caller did: whatever the authentication module (session cookies for OAuth2/OIDC, Auth0, table-based, mock; Authorization or x-api-key headers for API keys and bearer tokens). Capture them with fromContext() while handling the user's request (e.g. at the start of an assistant turn); they hold secrets - never log them.
  • Constructor Details

    • UiApiCredentials

      public UiApiCredentials(String sessionUUID, String sessionId, String authorization, String apiKey)
      Backwards-compatible credentials without an in-process session.
    • UiApiCredentials

      public UiApiCredentials(String sessionUUID, String sessionId, String authorization, String apiKey, String inProcessSessionToken)
      Creates an instance of a UiApiCredentials record class.
      Parameters:
      sessionUUID - the value for the sessionUUID record component
      sessionId - the value for the sessionId record component
      authorization - the value for the authorization record component
      apiKey - the value for the apiKey record component
      inProcessSessionToken - the value for the inProcessSessionToken record component
  • Method Details

    • ofInProcessSession

      public static UiApiCredentials ofInProcessSession(String token)
      Credentials minted by a component in this JVM after authenticating a user.
    • fromContext

      public static UiApiCredentials fromContext(io.javalin.http.Context context)
      The credentials of a request being handled.
    • ofSessionUUID

      public static UiApiCredentials ofSessionUUID(String sessionUUID)
      Credentials of just a session UUID (the sessionUUID cookie).
    • isPresent

      public boolean isPresent()
      Whether any credential is present.
    • toString

      public String toString()
      Never print the secrets.
      Specified by:
      toString in class Record
    • 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.
    • sessionUUID

      public String sessionUUID()
      Returns the value of the sessionUUID record component.
      Returns:
      the value of the sessionUUID record component
    • sessionId

      public String sessionId()
      Returns the value of the sessionId record component.
      Returns:
      the value of the sessionId record component
    • authorization

      public String authorization()
      Returns the value of the authorization record component.
      Returns:
      the value of the authorization record component
    • apiKey

      public String apiKey()
      Returns the value of the apiKey record component.
      Returns:
      the value of the apiKey record component
    • inProcessSessionToken

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