Search in sources :

Example 6 with SimpleHttpClientFactoryBean

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;
}
Also used : lombok.val(lombok.val) SimpleHttpClientFactoryBean(org.apereo.cas.util.http.SimpleHttpClientFactoryBean)

Example 7 with SimpleHttpClientFactoryBean

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());
}
Also used : lombok.val(lombok.val) SimpleHttpClientFactoryBean(org.apereo.cas.util.http.SimpleHttpClientFactoryBean) DefaultAuthenticationServiceSelectionStrategy(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy) DefaultSingleLogoutServiceMessageHandler(org.apereo.cas.logout.slo.DefaultSingleLogoutServiceMessageHandler) DefaultSingleLogoutServiceLogoutUrlBuilder(org.apereo.cas.logout.slo.DefaultSingleLogoutServiceLogoutUrlBuilder) RegexRegisteredService(org.apereo.cas.services.RegexRegisteredService) Service(org.apereo.cas.authentication.principal.Service) RegexRegisteredService(org.apereo.cas.services.RegexRegisteredService) DefaultAuthenticationServiceSelectionPlan(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan) Test(org.junit.jupiter.api.Test)

Example 8 with SimpleHttpClientFactoryBean

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));
}
Also used : lombok.val(lombok.val) SimpleHttpClientFactoryBean(org.apereo.cas.util.http.SimpleHttpClientFactoryBean) HttpBasedServiceCredential(org.apereo.cas.authentication.credential.HttpBasedServiceCredential) URL(java.net.URL) DefaultUniqueTicketIdGenerator(org.apereo.cas.util.DefaultUniqueTicketIdGenerator) Test(org.junit.jupiter.api.Test)

Example 9 with SimpleHttpClientFactoryBean

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");
}
Also used : lombok.val(lombok.val) SimpleHttpClientFactoryBean(org.apereo.cas.util.http.SimpleHttpClientFactoryBean) DefaultUniqueTicketIdGenerator(org.apereo.cas.util.DefaultUniqueTicketIdGenerator) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

SimpleHttpClientFactoryBean (org.apereo.cas.util.http.SimpleHttpClientFactoryBean)9 lombok.val (lombok.val)5 DefaultUniqueTicketIdGenerator (org.apereo.cas.util.DefaultUniqueTicketIdGenerator)3 Before (org.junit.Before)3 Test (org.junit.jupiter.api.Test)3 DefaultAuthenticationServiceSelectionPlan (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan)2 DefaultAuthenticationServiceSelectionStrategy (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy)2 URL (java.net.URL)1 SSLConnectionSocketFactory (org.apache.http.conn.ssl.SSLConnectionSocketFactory)1 DefaultCasSslContext (org.apereo.cas.authentication.DefaultCasSslContext)1 HttpBasedServiceCredential (org.apereo.cas.authentication.credential.HttpBasedServiceCredential)1 Service (org.apereo.cas.authentication.principal.Service)1 DefaultLogoutManager (org.apereo.cas.logout.DefaultLogoutManager)1 DefaultSingleLogoutServiceLogoutUrlBuilder (org.apereo.cas.logout.DefaultSingleLogoutServiceLogoutUrlBuilder)1 DefaultSingleLogoutServiceMessageHandler (org.apereo.cas.logout.DefaultSingleLogoutServiceMessageHandler)1 LogoutExecutionPlan (org.apereo.cas.logout.LogoutExecutionPlan)1 SamlCompliantLogoutMessageCreator (org.apereo.cas.logout.SamlCompliantLogoutMessageCreator)1 DefaultSingleLogoutServiceLogoutUrlBuilder (org.apereo.cas.logout.slo.DefaultSingleLogoutServiceLogoutUrlBuilder)1 DefaultSingleLogoutServiceMessageHandler (org.apereo.cas.logout.slo.DefaultSingleLogoutServiceMessageHandler)1 RegexRegisteredService (org.apereo.cas.services.RegexRegisteredService)1