Class SAML2SPSessionSerializer

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, StorageSerializer<SPSession>

@ThreadSafeAfterInit
public class SAML2SPSessionSerializer
extends AbstractSPSessionSerializer
A serializer for SAML2SPSession objects.
  • Field Details

    • NAMEID_FIELD

      @Nonnull @NotEmpty private static final String NAMEID_FIELD
      Field name of NameID.
      See Also:
      Constant Field Values
    • SESSION_INDEX_FIELD

      @Nonnull @NotEmpty private static final String SESSION_INDEX_FIELD
      Field name of SessionIndex.
      See Also:
      Constant Field Values
    • NO_XML_DECL_PARAMS

      @Nonnull private static final Map<String,​Object> NO_XML_DECL_PARAMS
      DOM configuration parameters used by LSSerializer to exclude XML declaration.
    • parserPool

      @Nonnull private ParserPool parserPool
      Parser for NameID fields.
  • Constructor Details

    • SAML2SPSessionSerializer

      public SAML2SPSessionSerializer​(@Nonnull @ParameterName(name="offset") Duration offset)
      Constructor.
      Parameters:
      offset - time to subtract from record expiration to establish session expiration value
  • Method Details

    • setParserPool

      public void setParserPool​(@Nonnull ParserPool pool)
      Set the ParserPool to use.
      Parameters:
      pool - parser source
    • 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.

      Overrides:
      doSerializeAdditional in class AbstractSPSessionSerializer
      Parameters:
      instance - object to serialize
      generator - JSON generator to write to
    • doDeserialize

      @Nonnull protected 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.

      Specified by:
      doDeserialize in class AbstractSPSessionSerializer
      Parameters:
      obj - JSON structure to parse
      id - the identifier of the service associated with this session
      creation - creation time of session
      expiration - expiration time of session
      Returns:
      the newly constructed object
      Throws:
      IOException - if an error occurs during deserialization