當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。