Example usage for org.apache.hadoop.security.ssl SSLHostnameVerifier DEFAULT_AND_LOCALHOST

List of usage examples for org.apache.hadoop.security.ssl SSLHostnameVerifier DEFAULT_AND_LOCALHOST

Introduction

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

Prototype

SSLHostnameVerifier DEFAULT_AND_LOCALHOST

To view the source code for org.apache.hadoop.security.ssl SSLHostnameVerifier DEFAULT_AND_LOCALHOST.

Click Source Link

Document

The DEFAULT_AND_LOCALHOST HostnameVerifier works like the DEFAULT one with one additional relaxation: a host of "localhost", "localhost.localdomain", "127.0.0.1", "::1" will always pass, no matter what is in the server's certificate.

Usage

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;
}

From source file:org.apache.tez.http.SSLFactory.java

License:Apache License

public static HostnameVerifier getHostnameVerifier(String verifier)
        throws GeneralSecurityException, IOException {
    HostnameVerifier hostnameVerifier;
    if (verifier.equals("DEFAULT")) {
        hostnameVerifier = SSLHostnameVerifier.DEFAULT;
    } else if (verifier.equals("DEFAULT_AND_LOCALHOST")) {
        hostnameVerifier = SSLHostnameVerifier.DEFAULT_AND_LOCALHOST;
    } else if (verifier.equals("STRICT")) {
        hostnameVerifier = SSLHostnameVerifier.STRICT;
    } else if (verifier.equals("STRICT_IE6")) {
        hostnameVerifier = SSLHostnameVerifier.STRICT_IE6;
    } else if (verifier.equals("ALLOW_ALL")) {
        hostnameVerifier = SSLHostnameVerifier.ALLOW_ALL;
    } else {/*from   w  w  w .  j  a  v a  2s  .co m*/
        throw new GeneralSecurityException("Invalid hostname verifier: " + verifier);
    }
    return hostnameVerifier;
}