org.apache.hadoop.security.ssl.SSLHostnameVerifier Java Examples

The following examples show how to use org.apache.hadoop.security.ssl.SSLHostnameVerifier. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SSLFactory.java    From tez with Apache License 2.0 6 votes vote down vote up
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 {
    throw new GeneralSecurityException("Invalid hostname verifier: " +
        verifier);
  }
  return hostnameVerifier;
}
 
Example #2
Source File: BaseSecurityTest.java    From atlas with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: BaseSecurityTest.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
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;
}