• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SSLFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.security.ssl.SSLFactory的典型用法代码示例。如果您正苦于以下问题:Java SSLFactory类的具体用法?Java SSLFactory怎么用?Java SSLFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SSLFactory类属于org.apache.hadoop.security.ssl包,在下文中一共展示了SSLFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ReEncryptionClientProvider

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
public ReEncryptionClientProvider(URI uri, Configuration conf) throws IOException {
  setConf(conf);
  renUrl = createServiceURL(ProviderUtils.unnestUri(uri));
  if ("https".equalsIgnoreCase(new URL(renUrl).getProtocol())) {
    sslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
    try {
      sslFactory.init();
    } catch (GeneralSecurityException ex) {
      throw new IOException(ex);
    }
  }
  int timeout = conf.getInt(TIMEOUT_ATTR, DEFAULT_TIMEOUT);
  authRetry = conf.getInt(AUTH_RETRY, DEFAULT_AUTH_RETRY);
  configurator = new TimeoutConnConfigurator(timeout, sslFactory);

  authToken = new DelegationTokenAuthenticatedURL.Token();
  UserGroupInformation.AuthenticationMethod authMethod =
      UserGroupInformation.getCurrentUser().getAuthenticationMethod();
  if (authMethod == UserGroupInformation.AuthenticationMethod.PROXY) {
    actualUgi = UserGroupInformation.getCurrentUser().getRealUser();
  } else if (authMethod == UserGroupInformation.AuthenticationMethod.TOKEN) {
    actualUgi = UserGroupInformation.getLoginUser();
  } else {
    actualUgi =UserGroupInformation.getCurrentUser();
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:27,代码来源:ReEncryptionClientProvider.java


示例2: KerberosWebHDFSConnection2

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
public KerberosWebHDFSConnection2(String httpfsUrl, String principal, String password)  {
        this.httpfsUrl = httpfsUrl;
        this.principal = principal;
        this.password = password;

        Configuration conf = new Configuration();
        conf.addResource("conf/hdfs-site.xml");
        conf.addResource("conf/core-site.xml");
        newToken = new AuthenticatedURL.Token();

        KerberosAuthenticator ka = new KerberosAuthenticator();
        ConnectionConfigurator connectionConfigurator = new SSLFactory(SSLFactory.Mode.CLIENT,conf);
        ka.setConnectionConfigurator(connectionConfigurator);

        try{
            URL url = new URL(httpfsUrl);
            ka.authenticate(url,newToken);
        }catch(Exception e){
            e.printStackTrace();
        }


         this.authenticatedURL = new AuthenticatedURL(ka,connectionConfigurator);
//        this.authenticatedURL = new AuthenticatedURL(
//                new KerberosAuthenticator2(principal, password));
    }
 
开发者ID:Transwarp-DE,项目名称:Transwarp-Sample-Code,代码行数:27,代码来源:KerberosWebHDFSConnection2.java


示例3: addSslListener

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
/**
 * Configure an ssl listener on the server for shuffle.
 *
 * @param addr address to listen on.
 * @param sslFactory SSLFactory to use.
 */
public void addSslListener(InetSocketAddress addr, final SSLFactory sslFactory)
  throws IOException {
  if (webServer.isStarted()) {
    throw new IOException("Failed to add ssl listener");
  }

  SslSocketConnector sslListener = new SslSocketConnector() {
    @Override
    protected SSLServerSocketFactory createFactory() throws Exception {
      return sslFactory.createSSLServerSocketFactory();
    }
  };

  sslListener.setHost(addr.getHostName());
  sslListener.setPort(addr.getPort());
  webServer.addConnector(sslListener);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:TaskTracker.java


示例4: readOut

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
private static String readOut(URL url) throws Exception {
  StringBuilder out = new StringBuilder();
  HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
  Configuration conf = new Configuration();
  conf.addResource(CONFIG_SITE_XML);
  SSLFactory sslf = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
  sslf.init();
  conn.setSSLSocketFactory(sslf.createSSLSocketFactory());
  InputStream in = conn.getInputStream();
  byte[] buffer = new byte[64 * 1024];
  int len = in.read(buffer);
  while (len > 0) {
    out.append(new String(buffer, 0, len));
    len = in.read(buffer);
  }
  return out.toString();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:18,代码来源:TestSSLHttpServer.java


示例5: initSslConnConfigurator

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
private ConnectionConfigurator initSslConnConfigurator(final int timeout,
    Configuration conf) throws IOException, GeneralSecurityException {
  final SSLSocketFactory sf;
  final HostnameVerifier hv;

  sslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, conf);
  sslFactory.init();
  sf = sslFactory.createSSLSocketFactory();
  hv = sslFactory.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;
    }
  };
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:25,代码来源:TimelineClientImpl.java


示例6: serviceInit

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
protected void serviceInit(Configuration conf) throws Exception {
  this.remoteRootLogDir =
      new Path(conf.get(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
          YarnConfiguration.DEFAULT_NM_REMOTE_APP_LOG_DIR));
  this.remoteRootLogDirSuffix =
      conf.get(YarnConfiguration.NM_REMOTE_APP_LOG_DIR_SUFFIX,
          YarnConfiguration.DEFAULT_NM_REMOTE_APP_LOG_DIR_SUFFIX);
  
  if (conf.getBoolean(CommonConfigurationKeys.IPC_SERVER_SSL_ENABLED,
      CommonConfigurationKeys.IPC_SERVER_SSL_ENABLED_DEFAULT)) {
    sslConf.addResource(conf.get(SSLFactory.SSL_SERVER_CONF_KEY,
        "ssl-server.xml"));
  } else {
    sslConf = null;
  }
  
  super.serviceInit(conf);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:19,代码来源:LogAggregationService.java


示例7: createServerSSLConfig

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
private void createServerSSLConfig(String keyStorePassword,
    String trustStorePassword, Configuration conf) throws IOException {
    
    Configuration sslConf = new Configuration(false);
    
    File sslConfFile = new File(Paths.get(BASEDIR, "ssl-server.xml")
        .toString());
    conf.set(SSLFactory.SSL_SERVER_CONF_KEY, sslConfFile.getAbsolutePath());
    filesToPurge.add(sslConfFile.toString());
    sslConf.set(
        FileBasedKeyStoresFactory.resolvePropertyName(
            SSLFactory.Mode.SERVER,
            FileBasedKeyStoresFactory.SSL_KEYSTORE_PASSWORD_TPL_KEY),
        keyStorePassword);
    sslConf.set(
        FileBasedKeyStoresFactory.resolvePropertyName(
            SSLFactory.Mode.SERVER,
            FileBasedKeyStoresFactory.SSL_TRUSTSTORE_PASSWORD_TPL_KEY),
        trustStorePassword);
    
    try (FileWriter fw = new FileWriter(sslConfFile, false)) {
        sslConf.writeXml(fw);
    }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:25,代码来源:TestHopsSSLConfiguration.java


示例8: setup

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
  conf = new Configuration();
  conf.setInt(HttpServer2.HTTP_MAX_THREADS, 10);

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false, true,
      excludeCiphers);

  Configuration sslConf = KeyStoreTestUtil.getSslConfig();

  clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, sslConf);
  clientSslFactory.init();

  server = new HttpServer2.Builder()
      .setName("test")
      .addEndpoint(new URI("https://localhost"))
      .setConf(conf)
      .keyPassword(sslConf.get("ssl.server.keystore.keypassword"))
      .keyStore(sslConf.get("ssl.server.keystore.location"),
          sslConf.get("ssl.server.keystore.password"),
          sslConf.get("ssl.server.keystore.type", "jks"))
      .trustStore(sslConf.get("ssl.server.truststore.location"),
          sslConf.get("ssl.server.truststore.password"),
          sslConf.get("ssl.server.truststore.type", "jks"))
      .excludeCiphers(
          sslConf.get("ssl.server.exclude.cipher.list")).build();
  server.addServlet("echo", "/echo", TestHttpServer.EchoServlet.class);
  server.addServlet("longheader", "/longheader", LongHeaderServlet.class);
  server.start();
  baseUrl = new URL("https://"
      + NetUtils.getHostPortString(server.getConnectorAddress(0)));
  LOG.info("HTTP server started: " + baseUrl);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:40,代码来源:TestSSLHttpServer.java


示例9: setUp

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
  Configuration conf = new Configuration();
  conf.set(HttpServer2.FILTER_INITIALIZER_PROPERTY,
          DummyFilterInitializer.class.getName());

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
  Configuration sslConf = KeyStoreTestUtil.getSslConfig();

  clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, sslConf);
  clientSslFactory.init();

  server = new HttpServer2.Builder()
          .setName("test")
          .addEndpoint(new URI("http://localhost"))
          .addEndpoint(new URI("https://localhost"))
          .setConf(conf)
          .keyPassword(sslConf.get("ssl.server.keystore.keypassword"))
          .keyStore(sslConf.get("ssl.server.keystore.location"),
                  sslConf.get("ssl.server.keystore.password"),
                  sslConf.get("ssl.server.keystore.type", "jks"))
          .trustStore(sslConf.get("ssl.server.truststore.location"),
                  sslConf.get("ssl.server.truststore.password"),
                  sslConf.get("ssl.server.truststore.type", "jks"))
          .excludeCiphers(
                  sslConf.get("ssl.server.exclude.cipher.list"))
          .build();
  server.addServlet("echo", "/echo", TestHttpServer.EchoServlet.class);
  server.start();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:37,代码来源:TestHttpCookieFlag.java


示例10: HttpPipelineFactory

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
public HttpPipelineFactory(Configuration conf) throws Exception {
  SHUFFLE = getShuffle(conf);
  if (conf.getBoolean(MRConfig.SHUFFLE_SSL_ENABLED_KEY,
                      MRConfig.SHUFFLE_SSL_ENABLED_DEFAULT)) {
    LOG.info("Encrypted shuffle is enabled.");
    sslFactory = new SSLFactory(SSLFactory.Mode.SERVER, conf);
    sslFactory.init();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:ShuffleHandler.java


示例11: setup

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
  conf = new Configuration();
  conf.setInt(HttpServer2.HTTP_MAX_THREADS, 10);

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
  Configuration sslConf = new Configuration(false);
  sslConf.addResource("ssl-server.xml");
  sslConf.addResource("ssl-client.xml");

  clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, sslConf);
  clientSslFactory.init();

  server = new HttpServer2.Builder()
      .setName("test")
      .addEndpoint(new URI("https://localhost"))
      .setConf(conf)
      .keyPassword(sslConf.get("ssl.server.keystore.keypassword"))
      .keyStore(sslConf.get("ssl.server.keystore.location"),
          sslConf.get("ssl.server.keystore.password"),
          sslConf.get("ssl.server.keystore.type", "jks"))
      .trustStore(sslConf.get("ssl.server.truststore.location"),
          sslConf.get("ssl.server.truststore.password"),
          sslConf.get("ssl.server.truststore.type", "jks")).build();
  server.addServlet("echo", "/echo", TestHttpServer.EchoServlet.class);
  server.addServlet("longheader", "/longheader", LongHeaderServlet.class);
  server.start();
  baseUrl = new URL("https://"
      + NetUtils.getHostPortString(server.getConnectorAddress(0)));
  LOG.info("HTTP server started: " + baseUrl);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:TestSSLHttpServer.java


示例12: setUp

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
  Configuration conf = new Configuration();
  conf.set(HttpServer2.FILTER_INITIALIZER_PROPERTY,
          DummyFilterInitializer.class.getName());

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
  Configuration sslConf = new Configuration(false);
  sslConf.addResource("ssl-server.xml");
  sslConf.addResource("ssl-client.xml");

  clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, sslConf);
  clientSslFactory.init();

  server = new HttpServer2.Builder()
          .setName("test")
          .addEndpoint(new URI("http://localhost"))
          .addEndpoint(new URI("https://localhost"))
          .setConf(conf)
          .keyPassword(sslConf.get("ssl.server.keystore.keypassword"))
          .keyStore(sslConf.get("ssl.server.keystore.location"),
                  sslConf.get("ssl.server.keystore.password"),
                  sslConf.get("ssl.server.keystore.type", "jks"))
          .trustStore(sslConf.get("ssl.server.truststore.location"),
                  sslConf.get("ssl.server.truststore.password"),
                  sslConf.get("ssl.server.truststore.type", "jks")).build();
  server.addServlet("echo", "/echo", TestHttpServer.EchoServlet.class);
  server.start();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:TestHttpCookieFlag.java


示例13: setup

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
  conf = new Configuration();
  conf.setInt(HttpServer.HTTP_MAX_THREADS, 10);

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
  Configuration sslConf = new Configuration(false);
  sslConf.addResource("ssl-server.xml");
  sslConf.addResource("ssl-client.xml");

  clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, sslConf);
  clientSslFactory.init();

  server = new HttpServer.Builder()
      .setName("test")
      .addEndpoint(new URI("https://localhost"))
      .setConf(conf)
      .keyPassword(HBaseConfiguration.getPassword(sslConf, "ssl.server.keystore.keypassword",
          null))
      .keyStore(sslConf.get("ssl.server.keystore.location"),
          HBaseConfiguration.getPassword(sslConf, "ssl.server.keystore.password", null),
          sslConf.get("ssl.server.keystore.type", "jks"))
      .trustStore(sslConf.get("ssl.server.truststore.location"),
          HBaseConfiguration.getPassword(sslConf, "ssl.server.truststore.password", null),
          sslConf.get("ssl.server.truststore.type", "jks")).build();
  server.addServlet("echo", "/echo", TestHttpServer.EchoServlet.class);
  server.start();
  baseUrl = new URL("https://"
      + NetUtils.getHostPortString(server.getConnectorAddress(0)));
  LOG.info("HTTP server started: " + baseUrl);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:38,代码来源:TestSSLHttpServer.java


示例14: createSSLConfig

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
/**
 * Creates SSL configuration.
 * 
 * @param mode SSLFactory.Mode mode to configure
 * @param keystore String keystore file
 * @param password String store password, or null to avoid setting store
 *   password
 * @param keyPassword String key password, or null to avoid setting key
 *   password
 * @param trustKS String truststore file
 * @return Configuration for SSL
 */
private static Configuration createSSLConfig(SSLFactory.Mode mode,
    String keystore, String password, String keyPassword, String trustKS) {
  String trustPassword = "trustP";

  Configuration sslConf = new Configuration(false);
  if (keystore != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_LOCATION_TPL_KEY), keystore);
  }
  if (password != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_PASSWORD_TPL_KEY), password);
  }
  if (keyPassword != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_KEYSTORE_KEYPASSWORD_TPL_KEY),
      keyPassword);
  }
  if (trustKS != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_TRUSTSTORE_LOCATION_TPL_KEY), trustKS);
  }
  if (trustPassword != null) {
    sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
      FileBasedKeyStoresFactory.SSL_TRUSTSTORE_PASSWORD_TPL_KEY),
      trustPassword);
  }
  sslConf.set(FileBasedKeyStoresFactory.resolvePropertyName(mode,
    FileBasedKeyStoresFactory.SSL_TRUSTSTORE_RELOAD_INTERVAL_TPL_KEY), "1000");

  return sslConf;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:45,代码来源:KeyStoreTestUtil.java


示例15: clusterSetupAtBeginning

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@BeforeClass
public static void clusterSetupAtBeginning()
    throws IOException, LoginException, URISyntaxException {

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  try {
    sslConfDir = KeyStoreTestUtil
        .getClasspathDir(TestSWebHdfsFileContextMainOperations.class);
    KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, CONF, false);
    CONF.set(DFSConfigKeys.DFS_CLIENT_HTTPS_KEYSTORE_RESOURCE_KEY,
        KeyStoreTestUtil.getClientSSLConfigFileName());
    CONF.set(DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY,
        KeyStoreTestUtil.getServerSSLConfigFileName());
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  }

  CONF.set(DFSConfigKeys.DFS_HTTP_POLICY_KEY, "HTTPS_ONLY");
  CONF.set(DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY, "localhost:0");
  CONF.set(DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_KEY, "localhost:0");
  CONF.set(SSLFactory.SSL_HOSTNAME_VERIFIER_KEY, "DEFAULT_AND_LOCALHOST");
  cluster = new MiniDFSCluster.Builder(CONF).numDataNodes(2).build();

  cluster.waitClusterUp();
  webhdfsUrl = new URI(SWebHdfs.SCHEME + "://" + cluster.getConfiguration(0)
      .get(DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY));

  fc = FileContext.getFileContext(webhdfsUrl, CONF);
  defaultWorkingDirectory = fc.makeQualified(new Path(
      "/user/" + UserGroupInformation.getCurrentUser().getShortUserName()));
  fc.mkdir(defaultWorkingDirectory, FileContext.DEFAULT_PERM, true);

}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:37,代码来源:TestSWebHdfsFileContextMainOperations.java


示例16: setup

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
  conf = new Configuration();
  conf.setInt(HttpServer2.HTTP_MAX_THREADS, 10);

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
  Configuration sslConf = KeyStoreTestUtil.getSslConfig();

  clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, sslConf);
  clientSslFactory.init();

  server = new HttpServer2.Builder()
      .setName("test")
      .addEndpoint(new URI("https://localhost"))
      .setConf(conf)
      .keyPassword(sslConf.get("ssl.server.keystore.keypassword"))
      .keyStore(sslConf.get("ssl.server.keystore.location"),
          sslConf.get("ssl.server.keystore.password"),
          sslConf.get("ssl.server.keystore.type", "jks"))
      .trustStore(sslConf.get("ssl.server.truststore.location"),
          sslConf.get("ssl.server.truststore.password"),
          sslConf.get("ssl.server.truststore.type", "jks")).build();
  server.addServlet("echo", "/echo", TestHttpServer.EchoServlet.class);
  server.addServlet("longheader", "/longheader", LongHeaderServlet.class);
  server.start();
  baseUrl = new URL("https://"
      + NetUtils.getHostPortString(server.getConnectorAddress(0)));
  LOG.info("HTTP server started: " + baseUrl);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:36,代码来源:TestSSLHttpServer.java


示例17: setUp

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
  Configuration conf = new Configuration();
  conf.set(HttpServer2.FILTER_INITIALIZER_PROPERTY,
          DummyFilterInitializer.class.getName());

  File base = new File(BASEDIR);
  FileUtil.fullyDelete(base);
  base.mkdirs();
  keystoresDir = new File(BASEDIR).getAbsolutePath();
  sslConfDir = KeyStoreTestUtil.getClasspathDir(TestSSLHttpServer.class);

  KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
  Configuration sslConf = KeyStoreTestUtil.getSslConfig();

  clientSslFactory = new SSLFactory(SSLFactory.Mode.CLIENT, sslConf);
  clientSslFactory.init();

  server = new HttpServer2.Builder()
          .setName("test")
          .addEndpoint(new URI("http://localhost"))
          .addEndpoint(new URI("https://localhost"))
          .setConf(conf)
          .keyPassword(sslConf.get("ssl.server.keystore.keypassword"))
          .keyStore(sslConf.get("ssl.server.keystore.location"),
                  sslConf.get("ssl.server.keystore.password"),
                  sslConf.get("ssl.server.keystore.type", "jks"))
          .trustStore(sslConf.get("ssl.server.truststore.location"),
                  sslConf.get("ssl.server.truststore.password"),
                  sslConf.get("ssl.server.truststore.type", "jks")).build();
  server.addServlet("echo", "/echo", TestHttpServer.EchoServlet.class);
  server.start();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:34,代码来源:TestHttpCookieFlag.java


示例18: getJobConf

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
protected JobConf getJobConf(Configuration sslConf) throws IOException {
  JobConf conf = new JobConf(mrCluster.createJobConf());
  //doing this because Hadoop1 minicluster does not use all mr cluster confs for the created jobconf
  conf.set(JobTracker.SHUFFLE_SSL_ENABLED_KEY,
           sslConf.get(JobTracker.SHUFFLE_SSL_ENABLED_KEY));
  conf.set(SSLFactory.SSL_HOSTNAME_VERIFIER_KEY, sslConf.get(SSLFactory.SSL_HOSTNAME_VERIFIER_KEY));
  conf.set(SSLFactory.SSL_CLIENT_CONF_KEY, sslConf.get(SSLFactory.SSL_CLIENT_CONF_KEY));
  conf.set(SSLFactory.SSL_SERVER_CONF_KEY, sslConf.get(SSLFactory.SSL_SERVER_CONF_KEY));
  conf.set(SSLFactory.SSL_REQUIRE_CLIENT_CERT_KEY,
           sslConf.get(SSLFactory.SSL_REQUIRE_CLIENT_CERT_KEY));
  return conf;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:13,代码来源:TestEncryptedShuffle.java


示例19: HttpPipelineFactory

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
public HttpPipelineFactory(Configuration conf) throws Exception {
  SHUFFLE = getShuffle(conf);
  if (conf.getBoolean(MRConfig.SHUFFLE_SSL_ENABLED_KEY,
                      MRConfig.SHUFFLE_SSL_ENABLED_DEFAULT)) {
    sslFactory = new SSLFactory(SSLFactory.Mode.SERVER, conf);
    sslFactory.init();
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:9,代码来源:ShuffleHandler.java


示例20: init

import org.apache.hadoop.security.ssl.SSLFactory; //导入依赖的package包/类
@Override
public void init(DaemonContext context) throws Exception {
  System.err.println("Initializing secure datanode resources");
  Configuration conf = new Configuration();
  
  // Stash command-line arguments for regular datanode
  args = context.getArguments();
  
  sslFactory = new SSLFactory(SSLFactory.Mode.SERVER, conf);
  resources = getSecureResources(sslFactory, conf);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:12,代码来源:SecureDataNodeStarter.java



注:本文中的org.apache.hadoop.security.ssl.SSLFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SolrSynonymParser类代码示例发布时间:2022-05-21
下一篇:
Java BooleanFilter类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap