Package net.shibboleth.idp.cas.ticket.serialization.impl

# Class AbstractTicketSerializer<T extends Ticket>

java.lang.Object
net.shibboleth.idp.cas.ticket.serialization.impl.AbstractTicketSerializer<T>

Type Parameters:
  `T` - type of ticket

All Implemented Interfaces:
  `Component`, `InitializableComponent`, `StorageSerializer<T>`

Direct Known Subclasses:
  `ProxyGrantingTicketSerializer`, `ProxyTicketSerializer`, `ServiceTicketSerializer`

public abstract class AbstractTicketSerializer<T extends Ticket> extends Object implements StorageSerializer<T>
Base class for ticket serializers that use a simple field-delimited serialization strategy. Tickets are expected to be stored using the ticket ID as a key, so the ticket ID is not contained as part of the serialized form.

## Field Summary

Fields
Modifier and Type
Field
Description
`private static final String`
`AUTHN_INSTANT_FIELD`
Authentication instant field name.
`private static final String`
`AUTHN_METHOD_FIELD`
Authentication method field name.
`private static final String`
`CONSENTED_ATTRS_FIELD`
Consented attribute IDs field name.
`private static final String`
`EXPIRATION_FIELD`
Expiration instant field name.
`private final JsonGeneratorFactory`
`generatorFactory`
JSON generator factory.
`private final org.slf4j.Logger`
`logger`
Logger instance.
`private static final String`
`PRINCIPAL_FIELD`
Authenticated canonical principal name field.
`private final JsonReaderFactory`
`readerFactory`
JSON reader factory.
`private static final String`
`SERVICE_FIELD`
Service field name.
`private static final String`
`SESSION_FIELD`
Session ID field name.
`private static final String`
`STATE_FIELD`
Supplemental ticket state field name.

## Constructor Summary

Constructors
Constructor
Description
`AbstractTicketSerializer()`

## Method Summary

Modifier and Type
Method
Description
`protected abstract T`
`createTicket(JsonObject o, String id, String service, Instant expiry)`
Create a ticket.
`T`
`deserialize(long version, String context, String key, String value, Long expiration)`
`void`
`initialize()`
`boolean`
`isInitialized()`
`String`
`serialize(T ticket)`
`protected abstract void`
`serializeInternal(JsonGenerator generator, T ticket)`
Serialize a ticket.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### SERVICE_FIELD

@Nonnull @NotEmpty private static final String SERVICE_FIELD
Service field name.

See Also:
  - Constant Field Values

### EXPIRATION_FIELD

@Nonnull @NotEmpty private static final String EXPIRATION_FIELD
Expiration instant field name.

See Also:
  - Constant Field Values

### STATE_FIELD

@Nonnull @NotEmpty private static final String STATE_FIELD
Supplemental ticket state field name.

See Also:
  - Constant Field Values

### SESSION_FIELD

@Nonnull @NotEmpty private static final String SESSION_FIELD
Session ID field name.

See Also:
  - Constant Field Values

### PRINCIPAL_FIELD

@Nonnull @NotEmpty private static final String PRINCIPAL_FIELD
Authenticated canonical principal name field.

See Also:
  - Constant Field Values

### AUTHN_INSTANT_FIELD

@Nonnull @NotEmpty private static final String AUTHN_INSTANT_FIELD
Authentication instant field name.

See Also:
  - Constant Field Values

### AUTHN_METHOD_FIELD

@Nonnull @NotEmpty private static final String AUTHN_METHOD_FIELD
Authentication method field name.

See Also:
  - Constant Field Values

### CONSENTED_ATTRS_FIELD

@Nonnull @NotEmpty private static final String CONSENTED_ATTRS_FIELD
Consented attribute IDs field name.

See Also:
  - Constant Field Values

### logger

@Nonnull private final org.slf4j.Logger logger
Logger instance.

### generatorFactory

@Nonnull private final JsonGeneratorFactory generatorFactory
JSON generator factory.

### readerFactory

@Nonnull private final JsonReaderFactory readerFactory
JSON reader factory.

## Constructor Details

### AbstractTicketSerializer

public AbstractTicketSerializer()

## Method Details

### initialize

public void initialize() throws ComponentInitializationException

Specified by:
  `initialize` in interface `InitializableComponent`
Throws:
  `ComponentInitializationException`

### isInitialized

public boolean isInitialized()

Specified by:
  `isInitialized` in interface `InitializableComponent`

### serialize

@Nonnull public String serialize(@Nonnull T ticket) throws IOException

Specified by:
  `serialize` in interface `StorageSerializer<T extends Ticket>`
Throws:
  `IOException`

### deserialize

@Nonnull public T deserialize(long version, @Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key, @Nonnull @NotEmpty String value, @Nullable Long expiration) throws IOException

Specified by:
  `deserialize` in interface `StorageSerializer<T extends Ticket>`
Throws:
  `IOException`

### createTicket

@Nonnull protected abstract T createTicket(@Nonnull JsonObject o, @Nonnull String id, @Nonnull String service, @Nonnull Instant expiry)
Create a ticket.

Parameters:
  `o` - JSON object
  `id` - ticket ID
  `service` - service that requested the ticket
  `expiry` - expiration instant
Returns:
  the newly created ticket

### serializeInternal

protected abstract void serializeInternal(@Nonnull JsonGenerator generator, @Nonnull T ticket)
Serialize a ticket.

Parameters:
  `generator` - JSON generator
  `ticket` - ticket