当前位置: 首页>>代码示例>>Java>>正文


Java SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER属性代码示例

本文整理汇总了Java中org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER属性的典型用法代码示例。如果您正苦于以下问题:Java SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER属性的具体用法?Java SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER怎么用?Java SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.http.conn.ssl.SSLSocketFactory的用法示例。


在下文中一共展示了SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createThreadSafeClient

private static void createThreadSafeClient(boolean forceSecure) {
    httpClient = new DefaultHttpClient();
    ClientConnectionManager mgr = httpClient.getConnectionManager();
    HttpParams params = httpClient.getParams();
    SchemeRegistry schemeRegistry = mgr.getSchemeRegistry();

    if (forceSecure) {
        schemeRegistry.register(new Scheme("https",
                getSecureConnectionSetting(), 443));
    } else {
        HostnameVerifier hostnameVerifier = SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER;
        SSLSocketFactory socketFactory = SSLSocketFactory
                .getSocketFactory();
        socketFactory
                .setHostnameVerifier((X509HostnameVerifier) hostnameVerifier);
        schemeRegistry.register(new Scheme("https", socketFactory, 443));
    }

    httpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(params,
            schemeRegistry), params);
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-follow-up,代码行数:21,代码来源:OdooSafeClient.java

示例2: switchOffSSLVerification

private HttpClient switchOffSSLVerification(HttpClient httpClient) throws GeneralSecurityException {
    TrustStrategy acceptingTrustStrategy = new TrustStrategy() {
        @Override
        public boolean isTrusted(X509Certificate[] certificate, String authType) {
            return true;
        }
    };

    SSLSocketFactory socketFactory = new SSLSocketFactory(acceptingTrustStrategy, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
    httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("https", SSL_PORT, socketFactory));

    return httpClient;
}
 
开发者ID:enableiot,项目名称:iotanalytics-gearpump-rule-engine,代码行数:13,代码来源:CustomRestTemplate.java

示例3: test4

public void test4() throws NoSuchAlgorithmException, ClientProtocolException, IOException, KeyManagementException{
	Executor.unregisterScheme("https");
	SSLContext sslContext = SSLContext.getInstance("SSL");
	sslContext.init(null, null, null);
	// ## SHOULD FIRE OVER-PERMISSIVE HOSTNAME VERIFIER
	SSLSocketFactory sslSocketFactory = new SSLSocketFactory(sslContext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
	Executor.registerScheme(new Scheme("https", 443, sslSocketFactory));

	String responseAsString = Request.Get("https://www.google.com")
			.execute().returnContent().asString();
	System.out.println(responseAsString);
}
 
开发者ID:GDSSecurity,项目名称:JSSE_Fortify_SCA_Rules,代码行数:12,代码来源:ApacheHTTPClientFluentExample.java

示例4: AzureSSLSocketFactory

public AzureSSLSocketFactory(AzureX509 creds, boolean disableSSLValidation) throws InternalException, NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {
    super("TLS", creds.getKeystore(), AzureX509.PASSWORD, null, null, disableSSLValidation ? trustStrategy : null, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
}
 
开发者ID:dasein-cloud,项目名称:dasein-cloud-azurepack,代码行数:3,代码来源:AzureSSLSocketFactory.java

示例5: HC4TrustAllSSLSocketFactory

/**
 * Create an SSL factory which trusts all certificates and hosts.
 * {@link SSLSocketFactory#SSLSocketFactory(TrustStrategy, org.apache.http.conn.ssl.X509HostnameVerifier)} 
 * @param factory javax.net.ssl.SSLSocketFactory 
 * @throws GeneralSecurityException if there's a problem setting up the security
 */
protected HC4TrustAllSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory) throws GeneralSecurityException {
    super(TRUSTALL, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
    this.factory = factory;
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:10,代码来源:HC4TrustAllSSLSocketFactory.java


注:本文中的org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。