Example usage for org.apache.hadoop.security.ssl SSLFactory SSL_HOSTNAME_VERIFIER_KEY

List of usage examples for org.apache.hadoop.security.ssl SSLFactory SSL_HOSTNAME_VERIFIER_KEY

Introduction

In this page you can find the example usage for org.apache.hadoop.security.ssl SSLFactory SSL_HOSTNAME_VERIFIER_KEY.

Prototype

String SSL_HOSTNAME_VERIFIER_KEY

To view the source code for org.apache.hadoop.security.ssl SSLFactory SSL_HOSTNAME_VERIFIER_KEY.

Click Source Link

Usage

From source file:org.apache.atlas.security.SecureClientUtils.java

License:Apache License

public static void persistSSLClientConfiguration(org.apache.commons.configuration.Configuration clientConfig)
        throws AtlasException, IOException {
    //trust settings
    Configuration configuration = new Configuration(false);
    File sslClientFile = getSSLClientFile();
    if (!sslClientFile.exists()) {
        configuration.set("ssl.client.truststore.type", "jks");
        configuration.set("ssl.client.truststore.location", clientConfig.getString(TRUSTSTORE_FILE_KEY));
        if (clientConfig.getBoolean(CLIENT_AUTH_KEY, false)) {
            // need to get client key properties
            configuration.set("ssl.client.keystore.location", clientConfig.getString(KEYSTORE_FILE_KEY));
            configuration.set("ssl.client.keystore.type", "jks");
        }//from   ww w . j av  a2 s  . c  om
        // add the configured credential provider
        configuration.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH,
                clientConfig.getString(CERT_STORES_CREDENTIAL_PROVIDER_PATH));
        String hostnameVerifier = clientConfig.getString(SSLFactory.SSL_HOSTNAME_VERIFIER_KEY);
        if (hostnameVerifier != null) {
            configuration.set(SSLFactory.SSL_HOSTNAME_VERIFIER_KEY, hostnameVerifier);
        }

        configuration.writeXml(new FileWriter(sslClientFile));
    }
}

From source file:org.apache.atlas.web.security.BaseSecurityTest.java

License:Apache License

protected PropertiesConfiguration getSSLConfiguration(String providerUrl) {
    String projectBaseDirectory = System.getProperty("projectBaseDir");
    final PropertiesConfiguration configuration = new PropertiesConfiguration();
    configuration.setProperty("atlas.services.enabled", false);
    configuration.setProperty(TLS_ENABLED, true);
    configuration.setProperty(TRUSTSTORE_FILE_KEY, projectBaseDirectory + "/webapp/target/atlas.keystore");
    configuration.setProperty(KEYSTORE_FILE_KEY, projectBaseDirectory + "/webapp/target/atlas.keystore");
    configuration.setProperty(CERT_STORES_CREDENTIAL_PROVIDER_PATH, providerUrl);
    configuration.setProperty(SSLFactory.SSL_HOSTNAME_VERIFIER_KEY,
            SSLHostnameVerifier.DEFAULT_AND_LOCALHOST.toString());
    return configuration;
}