use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class CentralAuthenticationServiceImplTests method verifyDestroyTicketGrantingTicketWithInvalidTicket.
@Test
public void verifyDestroyTicketGrantingTicketWithInvalidTicket() throws Exception {
final AuthenticationResult ctx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport());
final TicketGrantingTicket ticketId = getCentralAuthenticationService().createTicketGrantingTicket(ctx);
final ServiceTicket serviceTicketId = getCentralAuthenticationService().grantServiceTicket(ticketId.getId(), getService(), ctx);
this.thrown.expect(ClassCastException.class);
getCentralAuthenticationService().destroyTicketGrantingTicket(serviceTicketId.getId());
}
use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class CentralAuthenticationServiceImplTests method verifyGrantProxyTicketWithValidTicketGrantingTicket.
@Test
public void verifyGrantProxyTicketWithValidTicketGrantingTicket() throws Exception {
final AuthenticationResult ctx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport());
final TicketGrantingTicket ticketId = getCentralAuthenticationService().createTicketGrantingTicket(ctx);
final ServiceTicket serviceTicketId = getCentralAuthenticationService().grantServiceTicket(ticketId.getId(), getService(), ctx);
final AuthenticationResult ctx2 = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(), RegisteredServiceTestUtils.getHttpBasedServiceCredentials());
final TicketGrantingTicket pgt = getCentralAuthenticationService().createProxyGrantingTicket(serviceTicketId.getId(), ctx2);
final ProxyTicket pt = getCentralAuthenticationService().grantProxyTicket(pgt.getId(), getService());
assertTrue(pt.getId().startsWith(ProxyTicket.PROXY_TICKET_PREFIX));
}
use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class CentralAuthenticationServiceImplTests method verifyValidateServiceTicketWithUsernameAttribute.
@Test
public void verifyValidateServiceTicketWithUsernameAttribute() throws Exception {
final Service svc = getService("eduPersonTest");
final AuthenticationResult ctx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(), svc);
final TicketGrantingTicket ticketGrantingTicket = getCentralAuthenticationService().createTicketGrantingTicket(ctx);
final ServiceTicket serviceTicket = getCentralAuthenticationService().grantServiceTicket(ticketGrantingTicket.getId(), svc, ctx);
final Assertion assertion = getCentralAuthenticationService().validateServiceTicket(serviceTicket.getId(), svc);
assertEquals("developer", assertion.getPrimaryAuthentication().getPrincipal().getId());
}
use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class CentralAuthenticationServiceImplTests method verifyDelegateTicketGrantingTicketWithProperParams.
@Test
public void verifyDelegateTicketGrantingTicketWithProperParams() throws Exception {
final AuthenticationResult ctx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(), getService());
final TicketGrantingTicket ticketId = getCentralAuthenticationService().createTicketGrantingTicket(ctx);
final ServiceTicket serviceTicketId = getCentralAuthenticationService().grantServiceTicket(ticketId.getId(), getService(), ctx);
final AuthenticationResult ctx2 = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(), RegisteredServiceTestUtils.getHttpBasedServiceCredentials());
final TicketGrantingTicket pgt = getCentralAuthenticationService().createProxyGrantingTicket(serviceTicketId.getId(), ctx2);
assertTrue(pgt.getId().startsWith(ProxyGrantingTicket.PROXY_GRANTING_TICKET_PREFIX));
}
use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class CentralAuthenticationServiceImplTests method verifyProxyGrantingTicketHasRootAuthenticationAsPrincipal.
@Test
public void verifyProxyGrantingTicketHasRootAuthenticationAsPrincipal() throws Exception {
final AuthenticationResult ctx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(), getService());
final TicketGrantingTicket ticket = getCentralAuthenticationService().createTicketGrantingTicket(ctx);
final ServiceTicket serviceTicketId = getCentralAuthenticationService().grantServiceTicket(ticket.getId(), getService(), ctx);
final Service service = serviceTicketId.getService();
assertSame(((AbstractWebApplicationService) service).getPrincipal(), ticket.getAuthentication().getPrincipal());
}
Aggregations