Search in sources :

Example 1 with OAuth2ConnectionConfigurator

use of org.apache.hadoop.hdfs.web.oauth2.OAuth2ConnectionConfigurator in project hadoop by apache.

the class URLConnectionFactory method newOAuth2URLConnectionFactory.

/**
   * Construct a new URLConnectionFactory that supports OAut-based connections.
   * It will also try to load the SSL configuration when they are specified.
   */
public static URLConnectionFactory newOAuth2URLConnectionFactory(Configuration conf) throws IOException {
    ConnectionConfigurator conn;
    try {
        ConnectionConfigurator sslConnConfigurator = newSslConnConfigurator(DEFAULT_SOCKET_TIMEOUT, conf);
        conn = new OAuth2ConnectionConfigurator(conf, sslConnConfigurator);
    } catch (Exception e) {
        throw new IOException("Unable to load OAuth2 connection factory.", e);
    }
    return new URLConnectionFactory(conn);
}
Also used : ConnectionConfigurator(org.apache.hadoop.security.authentication.client.ConnectionConfigurator) OAuth2ConnectionConfigurator(org.apache.hadoop.hdfs.web.oauth2.OAuth2ConnectionConfigurator) IOException(java.io.IOException) AuthenticationException(org.apache.hadoop.security.authentication.client.AuthenticationException) IOException(java.io.IOException) GeneralSecurityException(java.security.GeneralSecurityException) OAuth2ConnectionConfigurator(org.apache.hadoop.hdfs.web.oauth2.OAuth2ConnectionConfigurator)

Aggregations

IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1 OAuth2ConnectionConfigurator (org.apache.hadoop.hdfs.web.oauth2.OAuth2ConnectionConfigurator)1 AuthenticationException (org.apache.hadoop.security.authentication.client.AuthenticationException)1 ConnectionConfigurator (org.apache.hadoop.security.authentication.client.ConnectionConfigurator)1