use of org.jasig.cas.client.ssl.HttpURLConnectionFactory in project cas by apereo.
the class CasCoreTicketsConfiguration method casClientTicketValidator.
@ConditionalOnMissingBean(name = "casClientTicketValidator")
@Bean
public AbstractUrlBasedTicketValidator casClientTicketValidator() {
final String prefix = StringUtils.defaultString(casProperties.getClient().getPrefix(), casProperties.getServer().getPrefix());
final Cas30ServiceTicketValidator validator = new Cas30ServiceTicketValidator(prefix);
final HttpURLConnectionFactory factory = new HttpURLConnectionFactory() {
private static final long serialVersionUID = 3692658214483917813L;
@Override
public HttpURLConnection buildHttpURLConnection(final URLConnection conn) {
if (conn instanceof HttpsURLConnection) {
final HttpsURLConnection httpsConnection = (HttpsURLConnection) conn;
httpsConnection.setSSLSocketFactory(sslContext.getSocketFactory());
httpsConnection.setHostnameVerifier(hostnameVerifier);
}
return (HttpURLConnection) conn;
}
};
validator.setURLConnectionFactory(factory);
return validator;
}
Aggregations