Search in sources :

Example 1 with HttpClientProperties

use of org.apereo.cas.configuration.model.core.authentication.HttpClientProperties in project cas by apereo.

the class CasCoreWebConfiguration method urlValidator.

@Bean
public FactoryBean<UrlValidator> urlValidator() {
    final HttpClientProperties httpClient = this.casProperties.getHttpClient();
    final boolean allowLocalLogoutUrls = httpClient.isAllowLocalLogoutUrls();
    final String authorityValidationRegEx = httpClient.getAuthorityValidationRegEx();
    final boolean authorityValidationRegExCaseSensitive = httpClient.isAuthorityValidationRegExCaseSensitive();
    return new SimpleUrlValidatorFactoryBean(allowLocalLogoutUrls, authorityValidationRegEx, authorityValidationRegExCaseSensitive);
}
Also used : SimpleUrlValidatorFactoryBean(org.apereo.cas.web.SimpleUrlValidatorFactoryBean) HttpClientProperties(org.apereo.cas.configuration.model.core.authentication.HttpClientProperties) PropertiesFactoryBean(org.springframework.beans.factory.config.PropertiesFactoryBean) FactoryBean(org.springframework.beans.factory.FactoryBean) SimpleUrlValidatorFactoryBean(org.apereo.cas.web.SimpleUrlValidatorFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with HttpClientProperties

use of org.apereo.cas.configuration.model.core.authentication.HttpClientProperties in project cas by apereo.

the class CasCoreHttpConfiguration method httpClient.

@ConditionalOnMissingBean(name = "httpClient")
@Bean
public FactoryBean<SimpleHttpClient> httpClient() {
    final SimpleHttpClientFactoryBean.DefaultHttpClient c = new SimpleHttpClientFactoryBean.DefaultHttpClient();
    final HttpClientProperties httpClient = casProperties.getHttpClient();
    c.setConnectionTimeout(Beans.newDuration(httpClient.getConnectionTimeout()).toMillis());
    c.setReadTimeout((int) Beans.newDuration(httpClient.getReadTimeout()).toMillis());
    return c;
}
Also used : SimpleHttpClientFactoryBean(org.apereo.cas.util.http.SimpleHttpClientFactoryBean) HttpClientProperties(org.apereo.cas.configuration.model.core.authentication.HttpClientProperties) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) FactoryBean(org.springframework.beans.factory.FactoryBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) SimpleHttpClientFactoryBean(org.apereo.cas.util.http.SimpleHttpClientFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with HttpClientProperties

use of org.apereo.cas.configuration.model.core.authentication.HttpClientProperties in project cas by apereo.

the class CasCoreHttpConfiguration method getHttpClient.

private HttpClient getHttpClient(final boolean redirectEnabled) throws Exception {
    final SimpleHttpClientFactoryBean.DefaultHttpClient c = new SimpleHttpClientFactoryBean.DefaultHttpClient();
    final HttpClientProperties httpClient = casProperties.getHttpClient();
    c.setConnectionTimeout(Beans.newDuration(httpClient.getConnectionTimeout()).toMillis());
    c.setReadTimeout((int) Beans.newDuration(httpClient.getReadTimeout()).toMillis());
    c.setRedirectsEnabled(redirectEnabled);
    c.setCircularRedirectsAllowed(redirectEnabled);
    c.setSslSocketFactory(trustStoreSslSocketFactory());
    c.setHostnameVerifier(hostnameVerifier());
    return c.getObject();
}
Also used : SimpleHttpClientFactoryBean(org.apereo.cas.util.http.SimpleHttpClientFactoryBean) HttpClientProperties(org.apereo.cas.configuration.model.core.authentication.HttpClientProperties)

Aggregations

HttpClientProperties (org.apereo.cas.configuration.model.core.authentication.HttpClientProperties)3 SimpleHttpClientFactoryBean (org.apereo.cas.util.http.SimpleHttpClientFactoryBean)2 FactoryBean (org.springframework.beans.factory.FactoryBean)2 Bean (org.springframework.context.annotation.Bean)2 SimpleUrlValidatorFactoryBean (org.apereo.cas.web.SimpleUrlValidatorFactoryBean)1 PropertiesFactoryBean (org.springframework.beans.factory.config.PropertiesFactoryBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1