use of org.apereo.cas.util.http.SimpleHttpClientFactoryBean in project cas by apereo.
the class FileTrustStoreSslSocketFactoryTests method getSimpleHttpClient.
private static SimpleHttpClient getSimpleHttpClient(final SSLConnectionSocketFactory sslConnectionSocketFactory) {
val clientFactory = new SimpleHttpClientFactoryBean();
clientFactory.setSslSocketFactory(sslConnectionSocketFactory);
val client = clientFactory.getObject();
assertNotNull(client);
return client;
}
use of org.apereo.cas.util.http.SimpleHttpClientFactoryBean in project cas by apereo.
the class DefaultSingleLogoutServiceMessageHandlerTests method verifyEmpty.
@Test
public void verifyEmpty() {
val servicesManager = mock(ServicesManager.class);
val service = new RegexRegisteredService();
service.setServiceId(UUID.randomUUID().toString());
when(servicesManager.findServiceBy(any(Service.class))).thenReturn(service);
val handler = new DefaultSingleLogoutServiceMessageHandler(new SimpleHttpClientFactoryBean().getObject(), new DefaultSingleLogoutMessageCreator(), servicesManager, new DefaultSingleLogoutServiceLogoutUrlBuilder(servicesManager, mock(UrlValidator.class)), false, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
assertTrue(handler.handle(CoreAuthenticationTestUtils.getWebApplicationService(), UUID.randomUUID().toString(), SingleLogoutExecutionRequest.builder().build()).isEmpty());
}
use of org.apereo.cas.util.http.SimpleHttpClientFactoryBean 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.http.SimpleHttpClientFactoryBean 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");
}
Aggregations