Record Class SessionContext<U>
java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.session.SessionContext<U>
- Type Parameters:
U- subject type- Record Components:
subject- the authenticated subject; may benullfor navigation events that occur before loginsessionId- stable session identifier; may benullcreatedAt- when the session was first establishedlastActivity- most recent activity within the session;nullwhen no activity has been recorded yetclientAddress- remote client address as observed by the adapter, ornullattributes- free-form non-nullattribute map (defensive copy)
public record SessionContext<U>(U subject, String sessionId, Instant createdAt, Instant lastActivity, String clientAddress, Map<String,Object> attributes)
extends Record
Adapter-neutral session view for the
SessionPolicy.
The Vaadin and REST adapters build this record from their respective
runtime types (VaadinSession, HTTP session) so the policy stays
Vaadin-free and unit-testable.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributesrecord component.Returns the value of theclientAddressrecord component.Returns the value of thecreatedAtrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelastActivityrecord component.Returns the value of thesessionIdrecord component.subject()Returns the value of thesubjectrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SessionContext
public SessionContext(U subject, String sessionId, Instant createdAt, Instant lastActivity, String clientAddress, Map<String, Object> attributes) Creates an instance of aSessionContextrecord class.- Parameters:
subject- the value for thesubjectrecord componentsessionId- the value for thesessionIdrecord componentcreatedAt- the value for thecreatedAtrecord componentlastActivity- the value for thelastActivityrecord componentclientAddress- the value for theclientAddressrecord componentattributes- the value for theattributesrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
subject
-
sessionId
-
createdAt
-
lastActivity
Returns the value of thelastActivityrecord component.- Returns:
- the value of the
lastActivityrecord component
-
clientAddress
Returns the value of theclientAddressrecord component.- Returns:
- the value of the
clientAddressrecord component
-
attributes
Returns the value of theattributesrecord component.- Returns:
- the value of the
attributesrecord component
-