Package org.apereo.cas
Class AbstractCentralAuthenticationService
- java.lang.Object
-
- org.apereo.cas.AbstractCentralAuthenticationService
-
- All Implemented Interfaces:
java.io.Serializable,org.apereo.cas.CentralAuthenticationService
- Direct Known Subclasses:
DefaultCentralAuthenticationService
public abstract class AbstractCentralAuthenticationService extends java.lang.Object implements org.apereo.cas.CentralAuthenticationService, java.io.SerializableAn abstract implementation of theCentralAuthenticationServicethat provides access to the needed scaffolding and services that are necessary to CAS, such as ticket registry, service registry, etc. The intention here is to allow extensions to easily benefit from these already-configured components without having to to duplicate them again.- Since:
- 4.2.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CentralAuthenticationServiceContextconfigurationContextConfiguration context.
-
Constructor Summary
Constructors Constructor Description AbstractCentralAuthenticationService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apereo.cas.ticket.TicketaddTicket(org.apereo.cas.ticket.Ticket ticket)intdeleteTicket(java.lang.String ticketId)protected voiddoPublishEvent(org.springframework.context.ApplicationEvent e)Publish CAS events.protected voidevaluateProxiedServiceIfNeeded(org.apereo.cas.authentication.principal.Service service, org.apereo.cas.ticket.TicketGrantingTicket ticketGrantingTicket, org.apereo.cas.services.RegisteredService registeredService)Evaluate proxied service if needed.protected org.apereo.cas.authentication.AuthenticationgetAuthenticationSatisfiedByPolicy(org.apereo.cas.authentication.Authentication authentication, org.apereo.cas.services.ServiceContext context)Gets the authentication satisfied by policy.org.apereo.cas.ticket.TicketgetTicket(@NonNull java.lang.String ticketId)<T extends org.apereo.cas.ticket.Ticket>
TgetTicket(@NonNull java.lang.String ticketId, java.lang.Class<T> clazz)org.apereo.cas.ticket.TicketFactorygetTicketFactory()java.util.Collection<org.apereo.cas.ticket.Ticket>getTickets(java.util.function.Predicate<org.apereo.cas.ticket.Ticket> predicate)java.util.stream.Stream<? extends org.apereo.cas.ticket.Ticket>getTickets(java.util.function.Predicate<org.apereo.cas.ticket.Ticket> predicate, long from, long count)protected booleanisTicketAuthenticityVerified(java.lang.String ticketId)Verify the ticket id received is actually legitimate before contacting downstream systems to find and process it.protected org.apereo.cas.authentication.principal.WebApplicationServiceresolveServiceFromAuthenticationRequest(org.apereo.cas.authentication.principal.Service service)Resolve service from authentication request.org.apereo.cas.ticket.TicketupdateTicket(org.apereo.cas.ticket.Ticket ticket)protected voidverifyTicketState(org.apereo.cas.ticket.Ticket ticket, java.lang.String id, java.lang.Class clazz)Validate ticket expiration policy and throws exception if ticket is no longer valid.
-
-
-
Field Detail
-
configurationContext
protected final CentralAuthenticationServiceContext configurationContext
Configuration context.
-
-
Method Detail
-
getTicket
@Transactional(transactionManager="ticketTransactionManager", noRollbackFor=org.apereo.cas.ticket.InvalidTicketException.class) public org.apereo.cas.ticket.Ticket getTicket(@NonNull @NonNull java.lang.String ticketId) throws org.apereo.cas.ticket.InvalidTicketException- Specified by:
getTicketin interfaceorg.apereo.cas.CentralAuthenticationService- Throws:
org.apereo.cas.ticket.InvalidTicketException
-
getTicket
@Transactional(transactionManager="ticketTransactionManager", noRollbackFor=org.apereo.cas.ticket.InvalidTicketException.class) public <T extends org.apereo.cas.ticket.Ticket> T getTicket(@NonNull @NonNull java.lang.String ticketId, java.lang.Class<T> clazz) throws org.apereo.cas.ticket.InvalidTicketExceptionNote: Synchronization on ticket object in case of cache based registry doesn't serialize access to critical section. The reason is that cache pulls serialized data and builds new object, most likely for each pull. Is this synchronization needed here?
- Specified by:
getTicketin interfaceorg.apereo.cas.CentralAuthenticationService- Throws:
org.apereo.cas.ticket.InvalidTicketException
-
getTickets
@Transactional(transactionManager="ticketTransactionManager") public java.util.Collection<org.apereo.cas.ticket.Ticket> getTickets(java.util.function.Predicate<org.apereo.cas.ticket.Ticket> predicate)
- Specified by:
getTicketsin interfaceorg.apereo.cas.CentralAuthenticationService
-
getTickets
@Transactional(transactionManager="ticketTransactionManager") public java.util.stream.Stream<? extends org.apereo.cas.ticket.Ticket> getTickets(java.util.function.Predicate<org.apereo.cas.ticket.Ticket> predicate, long from, long count)- Specified by:
getTicketsin interfaceorg.apereo.cas.CentralAuthenticationService
-
deleteTicket
@Transactional(transactionManager="ticketTransactionManager") public int deleteTicket(java.lang.String ticketId) throws java.lang.Exception- Specified by:
deleteTicketin interfaceorg.apereo.cas.CentralAuthenticationService- Throws:
java.lang.Exception
-
updateTicket
public org.apereo.cas.ticket.Ticket updateTicket(org.apereo.cas.ticket.Ticket ticket) throws java.lang.Exception- Specified by:
updateTicketin interfaceorg.apereo.cas.CentralAuthenticationService- Throws:
java.lang.Exception
-
addTicket
public org.apereo.cas.ticket.Ticket addTicket(org.apereo.cas.ticket.Ticket ticket) throws java.lang.Exception- Specified by:
addTicketin interfaceorg.apereo.cas.CentralAuthenticationService- Throws:
java.lang.Exception
-
doPublishEvent
protected void doPublishEvent(org.springframework.context.ApplicationEvent e)
Publish CAS events.- Parameters:
e- the event
-
getAuthenticationSatisfiedByPolicy
protected org.apereo.cas.authentication.Authentication getAuthenticationSatisfiedByPolicy(org.apereo.cas.authentication.Authentication authentication, org.apereo.cas.services.ServiceContext context) throws org.apereo.cas.ticket.AbstractTicketExceptionGets the authentication satisfied by policy.- Parameters:
authentication- the authenticationcontext- the context- Returns:
- the authentication satisfied by policy
- Throws:
org.apereo.cas.ticket.AbstractTicketException- the ticket exception
-
evaluateProxiedServiceIfNeeded
protected void evaluateProxiedServiceIfNeeded(org.apereo.cas.authentication.principal.Service service, org.apereo.cas.ticket.TicketGrantingTicket ticketGrantingTicket, org.apereo.cas.services.RegisteredService registeredService)Evaluate proxied service if needed.- Parameters:
service- the serviceticketGrantingTicket- the ticket granting ticketregisteredService- the registered service
-
verifyTicketState
protected void verifyTicketState(org.apereo.cas.ticket.Ticket ticket, java.lang.String id, java.lang.Class clazz)Validate ticket expiration policy and throws exception if ticket is no longer valid. Expired tickets are also deleted from the registry immediately on demand.- Parameters:
ticket- the ticketid- the original idclazz- the clazz
-
resolveServiceFromAuthenticationRequest
protected org.apereo.cas.authentication.principal.WebApplicationService resolveServiceFromAuthenticationRequest(org.apereo.cas.authentication.principal.Service service)
Resolve service from authentication request.- Parameters:
service- the service- Returns:
- the service
-
isTicketAuthenticityVerified
protected boolean isTicketAuthenticityVerified(java.lang.String ticketId)
Verify the ticket id received is actually legitimate before contacting downstream systems to find and process it.- Parameters:
ticketId- the ticket id- Returns:
- true/false
-
getTicketFactory
public org.apereo.cas.ticket.TicketFactory getTicketFactory()
- Specified by:
getTicketFactoryin interfaceorg.apereo.cas.CentralAuthenticationService
-
-