Package net.shibboleth.idp.session
Class AbstractSPSessionSerializer
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.session.AbstractSPSessionSerializer
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,StorageSerializer<SPSession>
- Direct Known Subclasses:
BasicSPSessionSerializer
,CASSPSessionSerializer
,SAML1SPSessionSerializer
,SAML2SPSessionSerializer
@ThreadSafe
public abstract class AbstractSPSessionSerializer
extends AbstractInitializableComponent
implements StorageSerializer<SPSession>
Base class for
SPSession
serializers that handles data common to all such objects.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
Field name of creation instant.private final Duration
Milliseconds to subtract from record expiration to establish session expiration value.private final org.slf4j.Logger
Class logger.private static final String
Field name of service ID. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractSPSessionSerializer
(Duration offset) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(long version, String context, String key, String value, Long expiration) protected abstract SPSession
doDeserialize
(javax.json.JsonObject obj, String id, Instant creation, Instant expiration) Implement this method to return the appropriate type of object, populated with the basic information supplied.protected void
doSerializeAdditional
(SPSession instance, javax.json.stream.JsonGenerator generator) Override this method to handle serialization of additional data.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
SERVICE_ID_FIELD
Field name of service ID.- See Also:
-
CREATION_INSTANT_FIELD
Field name of creation instant.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
expirationOffset
Milliseconds to subtract from record expiration to establish session expiration value.
-
-
Constructor Details
-
AbstractSPSessionSerializer
Constructor.- Parameters:
offset
- time to subtract from record expiration to establish session expiration value
-
-
Method Details
-
serialize
- Specified by:
serialize
in interfaceStorageSerializer<SPSession>
- Throws:
IOException
-
deserialize
@Nonnull public SPSession deserialize(long version, @Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key, @Nonnull @NotEmpty String value, @Nullable Long expiration) throws IOException - Specified by:
deserialize
in interfaceStorageSerializer<SPSession>
- Throws:
IOException
-
doSerializeAdditional
protected void doSerializeAdditional(@Nonnull SPSession instance, @Nonnull javax.json.stream.JsonGenerator generator) Override this method to handle serialization of additional data.The serialization "context" is the continuation of a JSON struct.
- Parameters:
instance
- object to serializegenerator
- JSON generator to write to
-
doDeserialize
@Nonnull protected abstract SPSession doDeserialize(@Nonnull javax.json.JsonObject obj, @Nonnull @NotEmpty String id, @Nonnull Instant creation, @Nonnull Instant expiration) throws IOException Implement this method to return the appropriate type of object, populated with the basic information supplied.The JSON object supplied is a structure that may contain additional data created by the concrete subclass during serialization.
- Parameters:
obj
- JSON structure to parseid
- the identifier of the service associated with this sessioncreation
- creation time of sessionexpiration
- expiration time of session- Returns:
- the newly constructed object
- Throws:
IOException
- if an error occurs during deserialization
-