Search in sources :

Example 6 with SSLFactory

use of org.apache.hadoop.security.ssl.SSLFactory in project incubator-atlas by apache.

the class SecureClientUtils method newSslConnConfigurator.

private static ConnectionConfigurator newSslConnConfigurator(final int timeout, Configuration conf) throws IOException, GeneralSecurityException {
    final SSLFactory factory;
    final SSLSocketFactory sf;
    final HostnameVerifier hv;
    factory = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
    factory.init();
    sf = factory.createSSLSocketFactory();
    hv = factory.getHostnameVerifier();
    return new ConnectionConfigurator() {

        @Override
        public HttpURLConnection configure(HttpURLConnection conn) throws IOException {
            if (conn instanceof HttpsURLConnection) {
                HttpsURLConnection c = (HttpsURLConnection) conn;
                c.setSSLSocketFactory(sf);
                c.setHostnameVerifier(hv);
            }
            setTimeouts(conn, timeout);
            return conn;
        }
    };
}
Also used : ConnectionConfigurator(org.apache.hadoop.security.authentication.client.ConnectionConfigurator) SSLFactory(org.apache.hadoop.security.ssl.SSLFactory) HttpURLConnection(java.net.HttpURLConnection) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) HttpsURLConnection(javax.net.ssl.HttpsURLConnection) HostnameVerifier(javax.net.ssl.HostnameVerifier)

Example 7 with SSLFactory

use of org.apache.hadoop.security.ssl.SSLFactory in project hadoop by apache.

the class TimelineConnector method getSSLFactory.

protected SSLFactory getSSLFactory(Configuration conf) throws GeneralSecurityException, IOException {
    SSLFactory newSSLFactory = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
    newSSLFactory.init();
    return newSSLFactory;
}
Also used : SSLFactory(org.apache.hadoop.security.ssl.SSLFactory)

Aggregations

SSLFactory (org.apache.hadoop.security.ssl.SSLFactory)7 File (java.io.File)3 URI (java.net.URI)3 HttpsURLConnection (javax.net.ssl.HttpsURLConnection)3 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)3 Configuration (org.apache.hadoop.conf.Configuration)3 BeforeClass (org.junit.BeforeClass)3 HttpURLConnection (java.net.HttpURLConnection)2 URL (java.net.URL)2 HostnameVerifier (javax.net.ssl.HostnameVerifier)2 ConnectionConfigurator (org.apache.hadoop.security.authentication.client.ConnectionConfigurator)2 URLConnection (java.net.URLConnection)1 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)1 OAuth2ConnectionConfigurator (org.apache.hadoop.hdfs.web.oauth2.OAuth2ConnectionConfigurator)1 AuthenticatedURL (org.apache.hadoop.security.authentication.client.AuthenticatedURL)1 KerberosAuthenticator (org.apache.hadoop.security.authentication.client.KerberosAuthenticator)1