Search in sources :

Example 1 with UniqueTicketIdGenerator

use of org.apereo.cas.ticket.UniqueTicketIdGenerator in project cas by apereo.

the class DefaultProxyTicketFactory method produceTicketIdentifier.

/**
     * Produce ticket identifier.
     *
     * @param service the service
     * @return the ticket id
     */
protected String produceTicketIdentifier(final Service service) {
    final String uniqueTicketIdGenKey = service.getClass().getName();
    LOGGER.debug("Looking up ticket id generator for [{}]", uniqueTicketIdGenKey);
    UniqueTicketIdGenerator generator = this.uniqueTicketIdGeneratorsForService.get(uniqueTicketIdGenKey);
    if (generator == null) {
        generator = this.defaultTicketIdGenerator;
        LOGGER.debug("Ticket id generator not found for [{}]. Using the default generator...", uniqueTicketIdGenKey);
    }
    String ticketId = generator.getNewTicketId(ProxyTicket.PROXY_TICKET_PREFIX);
    if (this.cipherExecutor != null) {
        LOGGER.debug("Attempting to encode proxy ticket [{}]", ticketId);
        ticketId = this.cipherExecutor.encode(ticketId);
        LOGGER.debug("Encoded proxy ticket id [{}]", ticketId);
    }
    return ticketId;
}
Also used : UniqueTicketIdGenerator(org.apereo.cas.ticket.UniqueTicketIdGenerator) DefaultUniqueTicketIdGenerator(org.apereo.cas.util.DefaultUniqueTicketIdGenerator)

Example 2 with UniqueTicketIdGenerator

use of org.apereo.cas.ticket.UniqueTicketIdGenerator in project cas by apereo.

the class DefaultServiceTicketFactory method produceTicketIdentifier.

/**
     * Produce ticket identifier.
     *
     * @param service              the service
     * @param ticketGrantingTicket the ticket granting ticket
     * @param credentialProvided   whether credentials where directly provided
     * @return the tI don't knowet id
     */
protected String produceTicketIdentifier(final Service service, final TicketGrantingTicket ticketGrantingTicket, final boolean credentialProvided) {
    final String uniqueTicketIdGenKey = service.getClass().getName();
    UniqueTicketIdGenerator serviceTicketUniqueTicketIdGenerator = null;
    if (this.uniqueTicketIdGeneratorsForService != null && !this.uniqueTicketIdGeneratorsForService.isEmpty()) {
        LOGGER.debug("Looking up service ticket id generator for [{}]", uniqueTicketIdGenKey);
        serviceTicketUniqueTicketIdGenerator = this.uniqueTicketIdGeneratorsForService.get(uniqueTicketIdGenKey);
    }
    if (serviceTicketUniqueTicketIdGenerator == null) {
        serviceTicketUniqueTicketIdGenerator = this.defaultServiceTicketIdGenerator;
        LOGGER.debug("Service ticket id generator not found for [{}]. Using the default generator...", uniqueTicketIdGenKey);
    }
    return serviceTicketUniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX);
}
Also used : UniqueTicketIdGenerator(org.apereo.cas.ticket.UniqueTicketIdGenerator) DefaultUniqueTicketIdGenerator(org.apereo.cas.util.DefaultUniqueTicketIdGenerator)

Aggregations

UniqueTicketIdGenerator (org.apereo.cas.ticket.UniqueTicketIdGenerator)2 DefaultUniqueTicketIdGenerator (org.apereo.cas.util.DefaultUniqueTicketIdGenerator)2