use of org.apereo.cas.ticket.TicketGrantingTicketImpl in project cas by apereo.
the class SessionMonitorTests method addTicketsToRegistry.
private static void addTicketsToRegistry(final TicketRegistry registry, final int tgtCount, final int stCount) {
final TicketGrantingTicketImpl[] ticket = { null };
IntStream.range(0, tgtCount).forEach(i -> {
ticket[0] = new TicketGrantingTicketImpl(GENERATOR.getNewTicketId("TGT"), CoreAuthenticationTestUtils.getAuthentication(), TEST_EXP_POLICY);
registry.addTicket(ticket[0]);
});
if (ticket[0] != null) {
IntStream.range(0, stCount).forEach(i -> registry.addTicket(ticket[0].grantServiceTicket(GENERATOR.getNewTicketId("ST"), new MockService("junit"), TEST_EXP_POLICY, false, true)));
}
}
use of org.apereo.cas.ticket.TicketGrantingTicketImpl in project cas by apereo.
the class RememberMeDelegatingExpirationPolicyTests method verifyTicketExpirationWithRememberMe.
@Test
public void verifyTicketExpirationWithRememberMe() {
final Authentication authentication = CoreAuthenticationTestUtils.getAuthentication(this.principalFactory.createPrincipal("test"), Collections.singletonMap(RememberMeCredential.AUTHENTICATION_ATTRIBUTE_REMEMBER_ME, true));
final TicketGrantingTicketImpl t = new TicketGrantingTicketImpl("111", authentication, this.p);
assertFalse(t.isExpired());
t.grantServiceTicket("55", RegisteredServiceTestUtils.getService(), this.p, false, true);
assertTrue(t.isExpired());
}
use of org.apereo.cas.ticket.TicketGrantingTicketImpl in project cas by apereo.
the class TimeoutExpirationPolicyTests method verifyTicketIsExpired.
@Test
public void verifyTicketIsExpired() throws InterruptedException {
ticket = new TicketGrantingTicketImpl("test", CoreAuthenticationTestUtils.getAuthentication(), new TimeoutExpirationPolicy(-100));
assertTrue(ticket.isExpired());
}
use of org.apereo.cas.ticket.TicketGrantingTicketImpl in project cas by apereo.
the class AbstractTicketRegistryTests method verifyGetExistingTicketWithProperClass.
@Test
public void verifyGetExistingTicketWithProperClass() {
try {
this.ticketRegistry.addTicket(new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
this.ticketRegistry.getTicket(TicketGrantingTicket.PREFIX, TicketGrantingTicket.class);
} catch (final Exception e) {
fail(EXCEPTION_CAUGHT_NONE_EXPECTED);
}
}
use of org.apereo.cas.ticket.TicketGrantingTicketImpl in project cas by apereo.
the class AbstractTicketRegistryTests method verifyDeleteNonExistingTicket.
@Test
public void verifyDeleteNonExistingTicket() {
try {
this.ticketRegistry.addTicket(new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
assertSame(0, this.ticketRegistry.deleteTicket(TicketGrantingTicket.PREFIX + "1"));
} catch (final Exception e) {
fail(EXCEPTION_CAUGHT_NONE_EXPECTED);
}
}
Aggregations