Package net.shibboleth.idp.cas.ticket
Class TicketIdentifierGenerationStrategy
java.lang.Object
net.shibboleth.idp.cas.ticket.TicketIdentifierGenerationStrategy
- All Implemented Interfaces:
IdentifierGenerationStrategy
public class TicketIdentifierGenerationStrategy
extends Object
implements IdentifierGenerationStrategy
Generates CAS protocol ticket identifiers of the form:
[PREFIX]-[SEQUENCE_PART]-[RANDOM_PART]-[SUFFIX],where suffix is optional. By default tickets have at least 128 bits of entropy in the random part of the identifier.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTicketIdentifierGenerationStrategy
(String prefix, int randomLength) Creates a new ticket ID generator. -
Method Summary
Modifier and TypeMethodDescriptiongenerateIdentifier
(boolean xmlSafe) private static boolean
Whether the URL is safe.void
Sets the ticket ID suffix.
-
Field Details
-
idGenerator
private final org.cryptacular.generator.IdGenerator idGeneratorGenerator for random part of the ticket. -
ticketPrefix
Ticket prefix. -
ticketSuffix
Ticket suffix. -
ticketLength
Number of characters in random part of generated ticket.
-
-
Constructor Details
-
TicketIdentifierGenerationStrategy
public TicketIdentifierGenerationStrategy(@Nonnull @NotEmpty @ParameterName(name="prefix") String prefix, @Positive @ParameterName(name="randomLength") int randomLength) Creates a new ticket ID generator.- Parameters:
prefix
- Ticket ID prefix (e.g. ST, PT, PGT). MUST be a URL safe string.randomLength
- Length in characters of random part of the ticket.
-
-
Method Details
-
setSuffix
Sets the ticket ID suffix.- Parameters:
suffix
- Ticket suffix.
-
generateIdentifier
- Specified by:
generateIdentifier
in interfaceIdentifierGenerationStrategy
-
generateIdentifier
- Specified by:
generateIdentifier
in interfaceIdentifierGenerationStrategy
-
isUrlSafe
Whether the URL is safe.- Parameters:
s
- URL- Returns:
- whether the URL is safe
-