Class SessionAttributes

java.lang.Object
org.springframework.ai.session.SessionAttributes

public final class SessionAttributes extends Object
The well-known metadata attributes of a Session, and the accessors that read them. A session has no owner field: who it belongs to is the PRINCIPAL_NAME attribute, in the shape of Spring Session's principal-name index, which every store indexes (SessionRepository.findByMetadata(java.lang.String, java.lang.String)) and an authorization layer decides on. AGENT_NAME, AGENT_VERSION and AGENT_MODEL label the agent a session runs, set at creation, for listings and a UI.
Since:
2.1.0
Author:
Christian Tzolov
  • Field Details

    • PRINCIPAL_NAME

      public static final String PRINCIPAL_NAME
      The name of the principal a session belongs to, as Principal.getName() returns it in Spring Security. Indexed by every repository.
      See Also:
    • AGENT_NAME

      public static final String AGENT_NAME
      The name of the agent a session runs; absent unless set at creation.
      See Also:
    • AGENT_VERSION

      public static final String AGENT_VERSION
      The version of the agent definition a session was created with, when known.
      See Also:
    • AGENT_MODEL

      public static final String AGENT_MODEL
      The model the agent a session runs is configured with, when known.
      See Also:
  • Method Details

    • principalName

      public static @Nullable String principalName(Session session)
      The principal name of a session, or null when it has none.
    • agentName

      public static @Nullable String agentName(Session session)
      The agent name of a session, or null when none was set.
    • agentVersion

      public static @Nullable String agentVersion(Session session)
      The agent version of a session, or null when none was set.
    • agentModel

      public static @Nullable String agentModel(Session session)
      The model of the agent a session runs, or null when none was set.