use of org.apereo.cas.ticket.proxy.ProxyGrantingTicket in project cas by apereo.
the class LogoutManagerImpl method performLogoutForTicket.
private void performLogoutForTicket(final TicketGrantingTicket ticket, final List<LogoutRequest> logoutRequests) {
ticket.getServices().entrySet().stream().filter(entry -> entry.getValue() instanceof WebApplicationService).forEach(entry -> {
final Service service = entry.getValue();
LOGGER.debug("Handling single logout callback for [{}]", service);
final LogoutRequest logoutRequest = this.singleLogoutServiceMessageHandler.handle((WebApplicationService) service, entry.getKey());
if (logoutRequest != null) {
LOGGER.debug("Captured logout request [{}]", logoutRequest);
logoutRequests.add(logoutRequest);
}
});
final Collection<ProxyGrantingTicket> proxyGrantingTickets = ticket.getProxyGrantingTickets();
if (proxyGrantingTickets.isEmpty()) {
LOGGER.debug("There are no proxy-granting tickets associated with [{}] to process for single logout", ticket.getId());
} else {
proxyGrantingTickets.forEach(proxyGrantingTicket -> performLogoutForTicket(proxyGrantingTicket, logoutRequests));
}
}
use of org.apereo.cas.ticket.proxy.ProxyGrantingTicket in project cas by apereo.
the class JpaTicketRegistryTests method grantProxyGrantingTicketInTransaction.
private ProxyGrantingTicket grantProxyGrantingTicketInTransaction(final ServiceTicket parent) {
return new TransactionTemplate(txManager).execute(status -> {
final ProxyGrantingTicket pgt = newPGT(parent);
ticketRegistry.addTicket(pgt);
return pgt;
});
}
use of org.apereo.cas.ticket.proxy.ProxyGrantingTicket in project cas by apereo.
the class HazelcastTicketRegistryReplicationTests method verifyDeleteTicketWithPGT.
@Test
public void verifyDeleteTicketWithPGT() {
final Authentication a = CoreAuthenticationTestUtils.getAuthentication();
this.hzTicketRegistry1.addTicket(new TicketGrantingTicketImpl(TGT_ID, a, new NeverExpiresExpirationPolicy()));
final TicketGrantingTicket tgt = this.hzTicketRegistry1.getTicket(TGT_ID, TicketGrantingTicket.class);
final Service service = RegisteredServiceTestUtils.getService("TGT_DELETE_TEST");
final ServiceTicket st1 = tgt.grantServiceTicket(ST_ID_1, service, new NeverExpiresExpirationPolicy(), false, true);
this.hzTicketRegistry1.addTicket(st1);
assertNotNull(this.hzTicketRegistry1.getTicket(TGT_ID, TicketGrantingTicket.class));
assertNotNull(this.hzTicketRegistry1.getTicket(ST_ID_1, ServiceTicket.class));
final ProxyGrantingTicket pgt = st1.grantProxyGrantingTicket(PGT_ID_1, a, new NeverExpiresExpirationPolicy());
assertEquals(a, pgt.getAuthentication());
this.hzTicketRegistry1.addTicket(pgt);
this.hzTicketRegistry1.updateTicket(tgt);
assertSame(3, this.hzTicketRegistry1.deleteTicket(tgt.getId()));
assertNull(this.hzTicketRegistry1.getTicket(TGT_ID, TicketGrantingTicket.class));
assertNull(this.hzTicketRegistry1.getTicket(ST_ID_1, ServiceTicket.class));
assertNull(this.hzTicketRegistry1.getTicket(PGT_ID_1, ProxyGrantingTicket.class));
}
use of org.apereo.cas.ticket.proxy.ProxyGrantingTicket in project cas by apereo.
the class AbstractTicketRegistry method deleteProxyGrantingTicketFromParent.
private void deleteProxyGrantingTicketFromParent(final ProxyGrantingTicket ticket) {
final ProxyGrantingTicket thePgt = ticket;
thePgt.getTicketGrantingTicket().getProxyGrantingTickets().remove(thePgt.getId());
updateTicket(thePgt.getTicketGrantingTicket());
}
use of org.apereo.cas.ticket.proxy.ProxyGrantingTicket in project cas by apereo.
the class AbstractTicketRegistry method deleteTicket.
@Override
public int deleteTicket(final Ticket ticket) throws Exception {
val count = new AtomicInteger(0);
if (ticket instanceof TicketGrantingTicket) {
LOGGER.debug("Removing children of ticket [{}] from the registry.", ticket.getId());
val tgt = (TicketGrantingTicket) ticket;
count.addAndGet(deleteChildren(tgt));
if (ticket instanceof ProxyGrantingTicket) {
deleteProxyGrantingTicketFromParent((ProxyGrantingTicket) ticket);
} else {
deleteLinkedProxyGrantingTickets(count, tgt);
}
}
LOGGER.debug("Removing ticket [{}] from the registry.", ticket);
if (deleteSingleTicket(ticket.getId())) {
count.incrementAndGet();
}
return count.intValue();
}
Aggregations