Class AbstractTicketService
- java.lang.Object
-
- net.shibboleth.idp.cas.ticket.impl.AbstractTicketService
-
- All Implemented Interfaces:
TicketService
- Direct Known Subclasses:
EncodingTicketService,SimpleTicketService
public abstract class AbstractTicketService extends Object implements TicketService
Abstract base class for ticket services that rely onStorageServicefor ticket storage.- Since:
- 3.3.0
-
-
Field Summary
Fields Modifier and Type Field Description private static Map<Class<? extends Ticket>,String>CONTEXT_CLASS_MAPMap of ticket classes to context names.private org.slf4j.LoggerlogClass logger.private static ProxyGrantingTicketSerializerPGT_SERIALIZERProxy granting ticket serializer.private static ProxyTicketSerializerPT_SERIALIZERProxy ticket serialize.private static Map<Class<? extends Ticket>,StorageSerializer<? extends Ticket>>SERIALIZER_MAPMap of ticket classes to serializers.private static ServiceTicketSerializerST_SERIALIZERService ticket serializer.private StorageServicestorageServiceStorage service to which ticket persistence operations are delegated.
-
Constructor Summary
Constructors Constructor Description AbstractTicketService(StorageService service)Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static Stringcontext(Class<? extends Ticket> clazz)Gets the storage service context name for the given ticket type.ProxyGrantingTicketcreateProxyGrantingTicket(String id, Instant expiry, ProxyTicket proxyTicket)ProxyGrantingTicketcreateProxyGrantingTicket(String id, Instant expiry, ServiceTicket serviceTicket)protected <T extends Ticket>
Tdelete(String id, Class<T> clazz)Retrieves a ticket by ID from the storage service and then deletes it.ProxyGrantingTicketfetchProxyGrantingTicket(String id)protected <T extends Ticket>
Tread(String id, Class<T> clazz)Retrieves a ticket by ID from the storage service.ProxyGrantingTicketremoveProxyGrantingTicket(String id)protected static <T extends Ticket>
StorageSerializer<T>serializer(Class<T> clazz)Gets the storage service serializer for the given ticket type.protected <T extends Ticket>
voidstore(T ticket)Stores the given ticket in the storage service.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.idp.cas.ticket.TicketService
createProxyTicket, createServiceTicket, removeProxyTicket, removeServiceTicket
-
-
-
-
Field Detail
-
CONTEXT_CLASS_MAP
private static final Map<Class<? extends Ticket>,String> CONTEXT_CLASS_MAP
Map of ticket classes to context names.
-
SERIALIZER_MAP
private static final Map<Class<? extends Ticket>,StorageSerializer<? extends Ticket>> SERIALIZER_MAP
Map of ticket classes to serializers.
-
ST_SERIALIZER
private static final ServiceTicketSerializer ST_SERIALIZER
Service ticket serializer.
-
PT_SERIALIZER
private static final ProxyTicketSerializer PT_SERIALIZER
Proxy ticket serialize.
-
PGT_SERIALIZER
private static final ProxyGrantingTicketSerializer PGT_SERIALIZER
Proxy granting ticket serializer.
-
log
private final org.slf4j.Logger log
Class logger.
-
storageService
@Nonnull private final StorageService storageService
Storage service to which ticket persistence operations are delegated.
-
-
Constructor Detail
-
AbstractTicketService
public AbstractTicketService(@Nonnull StorageService service)Creates a new instance.- Parameters:
service- Storage service to which tickets are persisted.
-
-
Method Detail
-
createProxyGrantingTicket
@Nonnull public ProxyGrantingTicket createProxyGrantingTicket(@Nonnull String id, @Nonnull Instant expiry, @Nonnull ServiceTicket serviceTicket)
- Specified by:
createProxyGrantingTicketin interfaceTicketService
-
createProxyGrantingTicket
@Nonnull public ProxyGrantingTicket createProxyGrantingTicket(@Nonnull String id, @Nonnull Instant expiry, @Nonnull ProxyTicket proxyTicket)
- Specified by:
createProxyGrantingTicketin interfaceTicketService
-
fetchProxyGrantingTicket
@Nullable public ProxyGrantingTicket fetchProxyGrantingTicket(@Nonnull String id)
- Specified by:
fetchProxyGrantingTicketin interfaceTicketService
-
removeProxyGrantingTicket
@Nullable public ProxyGrantingTicket removeProxyGrantingTicket(@Nonnull String id)
- Specified by:
removeProxyGrantingTicketin interfaceTicketService
-
context
protected static String context(Class<? extends Ticket> clazz)
Gets the storage service context name for the given ticket type.- Parameters:
clazz- Ticket class.- Returns:
- Context name for ticket type.
-
serializer
protected static <T extends Ticket> StorageSerializer<T> serializer(Class<T> clazz)
Gets the storage service serializer for the given ticket type.- Type Parameters:
T- type of object being serialized- Parameters:
clazz- Ticket class.- Returns:
- Storage service serializer.
-
store
protected <T extends Ticket> void store(T ticket)
Stores the given ticket in the storage service.- Type Parameters:
T- Type of ticket.- Parameters:
ticket- Ticket to store
-
read
protected <T extends Ticket> T read(String id, Class<T> clazz)
Retrieves a ticket by ID from the storage service.- Type Parameters:
T- Type of ticket.- Parameters:
id- Ticket identifier.clazz- Ticket type.- Returns:
- Ticket or null if ticket not found.
-
-