private static SSLConnectionSocketFactory getSslConnectionSocketFactory(final HttpExecutionRequest execution) {
        val builder = SSLConnectionSocketFactoryBuilder.create().useSystemProperties();
        Optional.ofNullable(execution.getHttpClient())
            .map(HttpClient::httpClientFactory)
            .ifPresentOrElse(factory -> {
                builder.setHostnameVerifier(factory.getHostnameVerifier());
                builder.setSslContext(factory.getSslContext());
            }, () -> builder.setSslContext(SSLContexts.createDefault()).setHostnameVerifier(new DefaultHostnameVerifier()));
        return builder.build();
    }
Prepare http request. Tries to set the authorization header
in cases where the URL endpoint does not actually produce the header
on its own.

@param request   the request
@param execution the execution request
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/http/HttpUtils.java