use of org.apereo.cas.util.http.SimpleHttpClientFactoryBean 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.http.SimpleHttpClientFactoryBean in project cas by apereo.
the class FileTrustStoreSslSocketFactoryTests method verifyTrustStoreLoadingSuccessfullyWithCertAvailable2.
@Test
public void verifyTrustStoreLoadingSuccessfullyWithCertAvailable2() {
final SimpleHttpClientFactoryBean clientFactory = new SimpleHttpClientFactoryBean();
clientFactory.setSslSocketFactory(sslFactory());
final HttpClient client = clientFactory.getObject();
assertTrue(client.isValidEndPoint("https://untrusted-root.badssl.com"));
}
use of org.apereo.cas.util.http.SimpleHttpClientFactoryBean in project cas by apereo.
the class TrustedProxyAuthenticationTrustStoreSslSocketFactoryTests method prepareHttpClient.
@Before
public void prepareHttpClient() throws Exception {
final SimpleHttpClientFactoryBean clientFactory = new SimpleHttpClientFactoryBean();
clientFactory.setSslSocketFactory(new SSLConnectionSocketFactory(new DefaultCasSslContext(TRUST_STORE, TRUST_STORE_PSW, KeyStore.getDefaultType()).getSslContext()));
this.client = clientFactory.getObject();
}
use of org.apereo.cas.util.http.SimpleHttpClientFactoryBean in project cas by apereo.
the class FrontChannelLogoutActionTests method onSetUp.
@Before
public void onSetUp() throws Exception {
final UrlValidator validator = new SimpleUrlValidatorFactoryBean(false).getObject();
final DefaultSingleLogoutServiceMessageHandler handler = new DefaultSingleLogoutServiceMessageHandler(new SimpleHttpClientFactoryBean().getObject(), new SamlCompliantLogoutMessageCreator(), servicesManager, new DefaultSingleLogoutServiceLogoutUrlBuilder(validator), false, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()));
final DefaultLogoutManager logoutManager = new DefaultLogoutManager(new SamlCompliantLogoutMessageCreator(), handler, false, mock(LogoutExecutionPlan.class));
this.frontChannelLogoutAction = new FrontChannelLogoutAction(logoutManager);
final MockHttpServletRequest request = new MockHttpServletRequest();
final MockHttpServletResponse response = new MockHttpServletResponse();
this.requestContext = mock(RequestContext.class);
final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
when(this.requestContext.getExternalContext()).thenReturn(servletExternalContext);
when(servletExternalContext.getNativeRequest()).thenReturn(request);
when(servletExternalContext.getNativeResponse()).thenReturn(response);
final LocalAttributeMap flowScope = new LocalAttributeMap();
when(this.requestContext.getFlowScope()).thenReturn(flowScope);
final MockFlowExecutionKey mockFlowExecutionKey = new MockFlowExecutionKey(FLOW_EXECUTION_KEY);
final MockFlowExecutionContext mockFlowExecutionContext = new MockFlowExecutionContext();
mockFlowExecutionContext.setKey(mockFlowExecutionKey);
when(this.requestContext.getFlowExecutionContext()).thenReturn(mockFlowExecutionContext);
}
use of org.apereo.cas.util.http.SimpleHttpClientFactoryBean in project cas by apereo.
the class HttpBasedServiceCredentialsAuthenticationHandlerTests method verifyNoAcceptableStatusCodeButOneSet.
@Test
public void verifyNoAcceptableStatusCodeButOneSet() {
val clientFactory = new SimpleHttpClientFactoryBean();
clientFactory.setAcceptableCodes(CollectionUtils.wrapList(900));
val httpClient = clientFactory.getObject();
this.authenticationHandler = new HttpBasedServiceCredentialsAuthenticationHandler(StringUtils.EMPTY, null, null, null, httpClient);
assertThrows(FailedLoginException.class, () -> this.authenticationHandler.authenticate(RegisteredServiceTestUtils.getHttpBasedServiceCredentials("https://www.ja-sig.org")));
}
Aggregations