@Override
    protected void customizeConnection(final HttpURLConnection connection) throws IOException {
        super.customizeConnection(connection);
        if (connection instanceof HttpsURLConnection httpsURLConnection) {
            if (saml2Configuration.getSslSocketFactory() != null) {
                httpsURLConnection.setSSLSocketFactory(saml2Configuration.getSslSocketFactory());
            }
            if (saml2Configuration.getHostnameVerifier() != null) {
                httpsURLConnection.setHostnameVerifier(saml2Configuration.getHostnameVerifier());
            }
        }
    }
This is {@link SAML2UrlResource}.

@author Misagh Moayyed
@since 6.1.4
pac4j-saml/src/main/java/org/pac4j/saml/util/SAML2UrlResource.java