use of org.apereo.cas.util.DefaultUniqueTicketIdGenerator in project cas by apereo.
the class Cas20ProxyHandlerTests method setUp.
@Before
public void setUp() throws Exception {
final SimpleHttpClientFactoryBean factory = new SimpleHttpClientFactoryBean();
factory.setConnectionTimeout(10000);
factory.setReadTimeout(10000);
this.handler = new Cas20ProxyHandler(factory.getObject(), new DefaultUniqueTicketIdGenerator());
when(this.proxyGrantingTicket.getId()).thenReturn("proxyGrantingTicket");
}
use of org.apereo.cas.util.DefaultUniqueTicketIdGenerator in project cas by apereo.
the class JpaTicketRegistryTests method verifySecurityTokenTicket.
@RepeatedTest(2)
public void verifySecurityTokenTicket() throws Exception {
val securityTokenTicketFactory = new DefaultSecurityTokenTicketFactory(new DefaultUniqueTicketIdGenerator(), neverExpiresExpirationPolicyBuilder());
val originalAuthn = CoreAuthenticationTestUtils.getAuthentication();
val tgt = new TicketGrantingTicketImpl(ticketGrantingTicketId, originalAuthn, NeverExpiresExpirationPolicy.INSTANCE);
this.newTicketRegistry.addTicket(tgt);
val token = securityTokenTicketFactory.create(tgt, "dummy-token".getBytes(StandardCharsets.UTF_8));
this.newTicketRegistry.addTicket(token);
assertNotNull(this.newTicketRegistry.getTicket(token.getId()));
this.newTicketRegistry.deleteTicket(token);
assertNull(this.newTicketRegistry.getTicket(token.getId()));
}
use of org.apereo.cas.util.DefaultUniqueTicketIdGenerator in project cas by apereo.
the class Cas20ProxyHandlerTests method verifyNonValidProxyTicket.
@Test
public void verifyNonValidProxyTicket() throws Exception {
val clientFactory = new SimpleHttpClientFactoryBean();
clientFactory.setAcceptableCodes(CollectionUtils.wrapList(900));
this.handler = new Cas20ProxyHandler(clientFactory.getObject(), new DefaultUniqueTicketIdGenerator());
assertNull(this.handler.handle(new HttpBasedServiceCredential(new URL("http://www.rutgers.edu"), CoreAuthenticationTestUtils.getRegisteredService("https://some.app.edu")), proxyGrantingTicket));
}
use of org.apereo.cas.util.DefaultUniqueTicketIdGenerator in project cas by apereo.
the class Cas20ProxyHandlerTests method initialize.
@BeforeEach
public void initialize() {
val factory = new SimpleHttpClientFactoryBean();
factory.setConnectionTimeout(10000);
factory.setReadTimeout(10000);
this.handler = new Cas20ProxyHandler(factory.getObject(), new DefaultUniqueTicketIdGenerator());
when(this.proxyGrantingTicket.getId()).thenReturn("proxyGrantingTicket");
}
use of org.apereo.cas.util.DefaultUniqueTicketIdGenerator in project cas by apereo.
the class SamlRestServiceTicketResourceEntityResponseFactoryTests method verifyOperation.
@Test
public void verifyOperation() {
val factory = new SamlRestServiceTicketResourceEntityResponseFactory(new DefaultUniqueTicketIdGenerator());
assertEquals(0, factory.getOrder());
val service = new SamlService();
service.setId("https://saml.example.org");
assertTrue(factory.supports(service, CoreAuthenticationTestUtils.getAuthenticationResult()));
assertNotNull(factory.build(new MockTicketGrantingTicket("casuser").getId(), service, CoreAuthenticationTestUtils.getAuthenticationResult()));
}
Aggregations