Search in sources :

Example 1 with TicketGrantingTicketFactory

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

the class DefaultCentralAuthenticationService method createTicketGrantingTicket.

@Audit(action = "TICKET_GRANTING_TICKET", actionResolverName = "CREATE_TICKET_GRANTING_TICKET_RESOLVER", resourceResolverName = "CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name = "CREATE_TICKET_GRANTING_TICKET_TIMER")
@Metered(name = "CREATE_TICKET_GRANTING_TICKET_METER")
@Counted(name = "CREATE_TICKET_GRANTING_TICKET_COUNTER", monotonic = true)
@Override
public TicketGrantingTicket createTicketGrantingTicket(final AuthenticationResult authenticationResult) throws AuthenticationException, AbstractTicketException {
    final Authentication authentication = authenticationResult.getAuthentication();
    final Service service = authenticationResult.getService();
    AuthenticationCredentialsLocalBinder.bindCurrent(authentication);
    if (service != null) {
        final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
        RegisteredServiceAccessStrategyUtils.ensurePrincipalAccessIsAllowedForService(service, registeredService, authentication);
    }
    final TicketGrantingTicketFactory factory = this.ticketFactory.get(TicketGrantingTicket.class);
    final TicketGrantingTicket ticketGrantingTicket = factory.create(authentication);
    this.ticketRegistry.addTicket(ticketGrantingTicket);
    doPublishEvent(new CasTicketGrantingTicketCreatedEvent(this, ticketGrantingTicket));
    return ticketGrantingTicket;
}
Also used : RegisteredService(org.apereo.cas.services.RegisteredService) CasTicketGrantingTicketCreatedEvent(org.apereo.cas.support.events.ticket.CasTicketGrantingTicketCreatedEvent) Authentication(org.apereo.cas.authentication.Authentication) TicketGrantingTicket(org.apereo.cas.ticket.TicketGrantingTicket) RegisteredService(org.apereo.cas.services.RegisteredService) Service(org.apereo.cas.authentication.principal.Service) TicketGrantingTicketFactory(org.apereo.cas.ticket.TicketGrantingTicketFactory) Audit(org.apereo.inspektr.audit.annotation.Audit) Counted(com.codahale.metrics.annotation.Counted) Metered(com.codahale.metrics.annotation.Metered) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Counted (com.codahale.metrics.annotation.Counted)1 Metered (com.codahale.metrics.annotation.Metered)1 Timed (com.codahale.metrics.annotation.Timed)1 Authentication (org.apereo.cas.authentication.Authentication)1 Service (org.apereo.cas.authentication.principal.Service)1 RegisteredService (org.apereo.cas.services.RegisteredService)1 CasTicketGrantingTicketCreatedEvent (org.apereo.cas.support.events.ticket.CasTicketGrantingTicketCreatedEvent)1 TicketGrantingTicket (org.apereo.cas.ticket.TicketGrantingTicket)1 TicketGrantingTicketFactory (org.apereo.cas.ticket.TicketGrantingTicketFactory)1 Audit (org.apereo.inspektr.audit.annotation.Audit)1