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

Java JksOptions类代码示例

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

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



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

示例1: prepare

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
@Before
public void prepare(TestContext context) {
  vertx = Vertx.vertx();

  JsonObject dbConf = new JsonObject()
    .put(WikiDatabaseVerticle.CONFIG_WIKIDB_JDBC_URL, "jdbc:hsqldb:mem:testdb;shutdown=true")
    .put(WikiDatabaseVerticle.CONFIG_WIKIDB_JDBC_MAX_POOL_SIZE, 4);
  vertx.deployVerticle(new WikiDatabaseVerticle(),
    new DeploymentOptions().setConfig(dbConf), context.asyncAssertSuccess());

  vertx.deployVerticle(new HttpServerVerticle(), context.asyncAssertSuccess());

  webClient = WebClient.create(vertx, new WebClientOptions()
    .setDefaultHost("localhost")
    .setDefaultPort(8080)
    .setSsl(true)
    .setTrustOptions(new JksOptions().setPath("server-keystore.jks").setPassword("secret")));
}
 
开发者ID:vert-x3,项目名称:vertx-guide-for-java-devs,代码行数:19,代码来源:ApiTest.java


示例2: prepare

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
@Before
public void prepare(TestContext context) {
  vertx = Vertx.vertx();

  JsonObject dbConf = new JsonObject()
    .put(WikiDatabaseVerticle.CONFIG_WIKIDB_JDBC_URL, "jdbc:hsqldb:mem:testdb;shutdown=true")
    .put(WikiDatabaseVerticle.CONFIG_WIKIDB_JDBC_MAX_POOL_SIZE, 4);
  vertx.deployVerticle(new WikiDatabaseVerticle(),
    new DeploymentOptions().setConfig(dbConf), context.asyncAssertSuccess());

  vertx.deployVerticle(new HttpServerVerticle(), context.asyncAssertSuccess());

  // tag::test-https[]
  webClient = WebClient.create(vertx, new WebClientOptions()
    .setDefaultHost("localhost")
    .setDefaultPort(8080)
    .setSsl(true) // <1>
    .setTrustOptions(new JksOptions().setPath("server-keystore.jks").setPassword("secret"))); // <2>
  // end::test-https[]
}
 
开发者ID:vert-x3,项目名称:vertx-guide-for-java-devs,代码行数:21,代码来源:ApiTest.java


示例3: testDifferentCharset

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
@Test
public void testDifferentCharset(TestContext context) throws Exception {
  termHandler = term -> {
    term.write("\u20AC");
    term.close();
  };
  startShell(new SSHTermOptions().setDefaultCharset("ISO_8859_1").setPort(5000).setHost("localhost").setKeyPairOptions(
      new JksOptions().setPath("src/test/resources/server-keystore.jks").setPassword("wibble")).
      setAuthOptions(new ShiroAuthOptions().setType(ShiroAuthRealmType.PROPERTIES).setConfig(
          new JsonObject().put("properties_path", "classpath:test-auth.properties"))));
  Session session = createSession("paulo", "secret", false);
  session.connect();
  Channel channel = session.openChannel("shell");
  channel.connect();
  InputStream in = channel.getInputStream();
  int b = in.read();
  context.assertEquals(63, b);
}
 
开发者ID:vert-x3,项目名称:vertx-shell,代码行数:19,代码来源:SSHServerTest.java


示例4: configSSL

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
private HttpServerOptions configSSL(JsonObject conf) {
	String ssl_keystore= conf.getString("ssl.keystore");
	String keystore_pass = conf.getString("ssl.keystore.pass");

	String ssl_client_keystore= conf.getString("ssl.client.keystore");
	String client_keystore_pass = conf.getString("ssl.client.keystore.pass");		
	
	HttpServerOptions options = new HttpServerOptions();
	options.setCompressionSupported(true);
	
	if(S.isNotBlank(ssl_keystore) && S.isNotBlank(keystore_pass)){
		options.setSsl(true).setKeyStoreOptions(
				new JksOptions().setPath(ssl_keystore).setPassword(keystore_pass));
		
		if(S.isNotBlank(ssl_client_keystore) && S.isNotBlank(client_keystore_pass))
			options.setClientAuth(ClientAuth.REQUIRED).setTrustStoreOptions(
			    new JksOptions().setPath(ssl_client_keystore).setPassword(client_keystore_pass));
	}
	return options;
}
 
开发者ID:troopson,项目名称:etagate,代码行数:21,代码来源:OutServerVerticle.java


示例5: clientSslClientTruststoreTest

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
@Test
public void clientSslClientTruststoreTest(TestContext context) {

  this.context = context;
  URL trustStore = this.getClass().getResource("/tls/client-truststore.jks");
  JksOptions jksOptions = new JksOptions().setPath(trustStore.getPath());

  MqttClientOptions clientOptions = new MqttClientOptions()
    .setSsl(true)
    .setTrustStoreOptions(jksOptions);

  MqttClient client = MqttClient.create(vertx, clientOptions);
  client.exceptionHandler(t -> context.assertTrue(false));

  Async async = context.async();
  client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown()));
  async.await();
}
 
开发者ID:vert-x3,项目名称:vertx-mqtt,代码行数:19,代码来源:MqttClientSslTest.java


示例6: testLoginByCert_usingPemConfig

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
/**
 * Tests authentication with the cert auth backend using PEM file
 */
@Test
public void testLoginByCert_usingPemConfig(TestContext tc) throws VaultException {
  JsonObject config = new JsonObject();
  config.put("host", process.getHost());
  config.put("port", process.getPort());
  config.put("ssl", true);
  PemKeyCertOptions options = new PemKeyCertOptions()
    .addCertPath("target/vault/config/ssl/client-cert.pem")
    .addKeyPath("target/vault/config/ssl/client-privatekey.pem");
  config.put("pemKeyCertOptions", options.toJson());

  PemTrustOptions trust = new PemTrustOptions()
    .addCertPath("target/vault/config/ssl/cert.pem");
  config.put("pemTrustStoreOptions", trust.toJson());

  JksOptions jks = new JksOptions()
    .setPath("target/vault/config/ssl/truststore.jks");
  config.put("trustStoreOptions", jks.toJson());

  client = new SlimVaultClient(vertx, config);

  checkWeCanLoginAndAccessRestrictedSecrets(tc);
}
 
开发者ID:vert-x3,项目名称:vertx-config,代码行数:27,代码来源:VaultClientWithCertTest.java


示例7: testLoginByCert_usingJKSConfig

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
/**
 * Tests authentication with the cert auth backend using PEM file
 */
@Test
public void testLoginByCert_usingJKSConfig(TestContext tc) throws VaultException {
  JsonObject config = new JsonObject();
  config.put("host", process.getHost());
  config.put("port", process.getPort());
  config.put("ssl", true);
  JksOptions options = new JksOptions();
  options.setPassword("password").setPath("target/vault/config/ssl/keystore.jks");
  config.put("keyStoreOptions", options.toJson());

  JksOptions jks = new JksOptions()
    .setPassword("password")
    .setPath("target/vault/config/ssl/truststore.jks");
  config.put("trustStoreOptions", jks.toJson());

  client = new SlimVaultClient(vertx, config);

  checkWeCanLoginAndAccessRestrictedSecrets(tc);
}
 
开发者ID:vert-x3,项目名称:vertx-config,代码行数:23,代码来源:VaultClientWithCertTest.java


示例8: getRetrieverConfiguration

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
@Override
protected JsonObject getRetrieverConfiguration() {

  JsonObject config = new JsonObject();
  config.put("host", process.getHost());
  config.put("port", process.getPort());
  config.put("ssl", true);
  PemKeyCertOptions options = new PemKeyCertOptions()
    .addCertPath("target/vault/config/ssl/client-cert.pem")
    .addKeyPath("target/vault/config/ssl/client-privatekey.pem");
  config.put("pemKeyCertOptions", options.toJson());

  PemTrustOptions trust = new PemTrustOptions()
    .addCertPath("target/vault/config/ssl/cert.pem");
  config.put("pemTrustStoreOptions", trust.toJson());

  JksOptions jks = new JksOptions()
    .setPath("target/vault/config/ssl/truststore.jks");
  config.put("trustStoreOptions", jks.toJson());

  config.put("auth-backend", "cert");

  return config;
}
 
开发者ID:vert-x3,项目名称:vertx-config,代码行数:25,代码来源:VaultConfigStoreWithCertsTest.java


示例9: VertxHttpServer

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
public VertxHttpServer(MapWrap config) {
    port = config.asInt("port", DEFAULT_PORT);
    observableListenersByTag = new HashMap<>();

    // Setup vertx
    vertx = Vertx.vertx();
    vertx.deployVerticle(this);
    if (config.exists("keyStorePath") ) {
        httpServer = vertx.createHttpServer(new HttpServerOptions().setSsl(true)
                .setKeyStoreOptions(
                        new JksOptions().
                                setPath(config.asString("keyStorePath")).
                                setPassword(config.asString("keyStorePassword"))
                ));
    } else {
        httpServer = vertx.createHttpServer();
    }

    router = Router.router(vertx);
}
 
开发者ID:sonyxperiadev,项目名称:lumber-mill,代码行数:21,代码来源:VertxHttpServer.java


示例10: SMTPConnectionPool

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
SMTPConnectionPool(Vertx vertx, MailConfig config) {
  this.config = config;
  this.vertx = vertx;
  maxSockets = config.getMaxPoolSize();
  keepAlive = config.isKeepAlive();
  NetClientOptions netClientOptions = new NetClientOptions().setSsl(config.isSsl()).setTrustAll(config.isTrustAll());
  if ((config.isSsl() || config.getStarttls() != StartTLSOptions.DISABLED) && !config.isTrustAll()) {
    // we can use HTTPS verification, which matches the requirements for SMTPS
    netClientOptions.setHostnameVerificationAlgorithm("HTTPS");
  }
  if (config.getKeyStore() != null) {
    // assume that password could be null if the keystore doesn't use one
    netClientOptions.setTrustStoreOptions(new JksOptions().setPath(config.getKeyStore())
        .setPassword(config.getKeyStorePassword()));
  }
  netClient = vertx.createNetClient(netClientOptions);
}
 
开发者ID:vert-x3,项目名称:vertx-mail-client,代码行数:18,代码来源:SMTPConnectionPool.java


示例11: runSSHServiceWithShiro

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
public void runSSHServiceWithShiro(Vertx vertx) throws Exception {
  ShellService service = ShellService.create(vertx,
      new ShellServiceOptions().setSSHOptions(
          new SSHTermOptions().
              setHost("localhost").
              setPort(5000).
              setKeyPairOptions(new JksOptions().
                      setPath("server-keystore.jks").
                      setPassword("wibble")
              ).
              setAuthOptions(new ShiroAuthOptions().
                      setType(ShiroAuthRealmType.PROPERTIES).
                      setConfig(new JsonObject().
                          put("properties_path", "file:/path/to/my/auth.properties"))
              )
      )
  );
  service.start();
}
 
开发者ID:vert-x3,项目名称:vertx-shell,代码行数:20,代码来源:Examples.java


示例12: runSSHServiceWithMongo

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
public void runSSHServiceWithMongo(Vertx vertx) throws Exception {
  ShellService service = ShellService.create(vertx,
      new ShellServiceOptions().setSSHOptions(
          new SSHTermOptions().
              setHost("localhost").
              setPort(5000).
              setKeyPairOptions(new JksOptions().
                      setPath("server-keystore.jks").
                      setPassword("wibble")
              ).
              setAuthOptions(new MongoAuthOptions().setConfig(new JsonObject().
                      put("connection_string", "mongodb://localhost:27018"))
              )
      )
  );
  service.start();
}
 
开发者ID:vert-x3,项目名称:vertx-shell,代码行数:18,代码来源:Examples.java


示例13: runSSHServiceWithJDBC

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
public void runSSHServiceWithJDBC(Vertx vertx) throws Exception {
  ShellService service = ShellService.create(vertx,
      new ShellServiceOptions().setSSHOptions(
          new SSHTermOptions().
              setHost("localhost").
              setPort(5000).
              setKeyPairOptions(new JksOptions().
                      setPath("server-keystore.jks").
                      setPassword("wibble")
              ).
              setAuthOptions(new JDBCAuthOptions().setConfig(new JsonObject()
                      .put("url", "jdbc:hsqldb:mem:test?shutdown=true")
                      .put("driver_class", "org.hsqldb.jdbcDriver"))
              )
      )
  );
  service.start();
}
 
开发者ID:vert-x3,项目名称:vertx-shell,代码行数:19,代码来源:Examples.java


示例14: testExternalAuthProviderFails

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
@Test
public void testExternalAuthProviderFails(TestContext context) throws Exception {
  AtomicInteger count = new AtomicInteger();
  authProvider = (authInfo, resultHandler) -> {
    count.incrementAndGet();
    resultHandler.handle(Future.failedFuture("not authenticated"));
  };
  termHandler = term -> {
    context.fail();
  };
  startShell(new SSHTermOptions().setPort(5000).setHost("localhost").setKeyPairOptions(
      new JksOptions().setPath("src/test/resources/server-keystore.jks").setPassword("wibble")));
  Session session = createSession("paulo", "anothersecret", false);
  try {
    session.connect();
    context.fail("Was not expected to login");
  } catch (JSchException e) {
    assertEquals("Auth cancel", e.getMessage());
  }
  context.assertEquals(1, count.get());
}
 
开发者ID:vert-x3,项目名称:vertx-shell,代码行数:22,代码来源:SSHServerTest.java


示例15: testKeymapFromFilesystem

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
@Test
public void testKeymapFromFilesystem() throws Exception {
  URL url = TermServer.class.getResource(SSHTermOptions.DEFAULT_INPUTRC);
  File f = new File(url.toURI());
  termHandler = Term::close;
  startShell(new SSHTermOptions().setIntputrc(f.getAbsolutePath()).setPort(5000).setHost("localhost").setKeyPairOptions(
      new JksOptions().setPath("src/test/resources/server-keystore.jks").setPassword("wibble")).
      setAuthOptions(new ShiroAuthOptions().setType(ShiroAuthRealmType.PROPERTIES).setConfig(
          new JsonObject().put("properties_path", "classpath:test-auth.properties"))));
  Session session = createSession("paulo", "secret", false);
  session.connect();
  Channel channel = session.openChannel("shell");
  channel.connect();
}
 
开发者ID:vert-x3,项目名称:vertx-shell,代码行数:15,代码来源:SSHServerTest.java


示例16: getTrustStoreOption

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
public static JksOptions getTrustStoreOption(final  ServiceAccessor accessor) {
    final File root = accessor.getConfiguration().getBaseDir();
    final String ca = accessor.getConfiguration().get("https.trustStore");

    if (ca == null) {
        LOGGER.info("Using default trust store for client side CA verification");
        return null;
    } else if ("noCA".equalsIgnoreCase(ca)) {
        //TODO
        LOGGER.info("Using default trust store for client side CA verification - noCA");
        return null;
    } else {
        File file = new File(ca);
        if (!file.isFile()) {
            // Second chance.
            file = new File(root, ca);
        }
        LOGGER.info("\t trust store: " + file.getAbsolutePath());
        final char[] password = accessor.getConfiguration()
                .getWithDefault("https.trustStorePassword", "").toCharArray();
        LOGGER.info("\t trust store password length: " + password.length);
        return new JksOptions().setPath(file.getAbsolutePath()).setPassword(new String(password));
    }
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:25,代码来源:SSLServerContext.java


示例17: enableSsl

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
private void enableSsl(ServerConfiguration configuration, HttpServerOptions options) {
    options.setSsl(TRUE);
    options.setHost("localhost");
    options.setKeyStoreOptions(new JksOptions()
            .setPath(getPath(configuration))
            .setPassword(getSecret(configuration)))
            .setPort(getPort(configuration));
}
 
开发者ID:GwtDomino,项目名称:domino,代码行数:9,代码来源:JksServerConfigurator.java


示例18: configureServer

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
@Test
public void givenSslEnabledInConfigurationWithJksPathAndPassword_whenConfiguringServer_thenHttpOptionSslShouldBeEnabledAndConfiguredWithThePathAndPassword()
        throws Exception {
    configuration.put(SSL_CONFIGURATION_KEY, TRUE);
    configureServer();
    assertThat(options.isSsl()).isTrue();
    assertThat(options.getKeyStoreOptions() instanceof JksOptions).isTrue();
    assertThat(options.getKeyStoreOptions().getPath()).isEqualTo(TEST_JKS_PATH);
    assertThat(options.getKeyStoreOptions().getPassword()).isEqualTo(TEST_JKS_SECRET);
}
 
开发者ID:GwtDomino,项目名称:domino,代码行数:11,代码来源:JksServerConfiguratorTest.java


示例19: BotMainTest

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
private BotMainTest(String[] args) throws Exception {
    UpdateProvider provider;

    if (args[1].equalsIgnoreCase("webhooks")) {
        provider = WebhookUpdateProvider.builder()
                .serverOptions(new HttpServerOptions().setSsl(true)
                        .setKeyStoreOptions(new JksOptions().setPath("bot.jks").setPassword("aaaaaa"))
                        .setPort(443)
                        .setHost(args[2]))
                .selfSignedCertificate(new File("bot-certificate.pem"))
                .build();
    } else {
        provider = new PollingUpdateProvider();
    }

    this.registry = TelegramBotRegistry.builder()
            .updateProvider(provider)
            .build();

    registry.registerBot(args[0], (bot, error) -> {
        if (error != null) {
            System.out.println("Could not log in!");
            error.printStackTrace();
            System.exit(-1);
            return;
        }

        this.bot = bot;

        System.out.printf("Logged in as @%s\n", bot.getBotInfo().getUsername());

        registerModules();
        bot.getCommandRegistry().registerCommand(new TextFilter("test", false, this::handleTestCommand));
    });
}
 
开发者ID:jTelegram,项目名称:jTelegramBotAPI,代码行数:36,代码来源:BotMainTest.java


示例20: loadKeystore

import io.vertx.core.net.JksOptions; //导入依赖的package包/类
private void loadKeystore(CoreContext core, KeyStore store) {
    try {
        loadedKeyStores.put(store.getShortName(),
                TrustAndKeyProvider.of(new JksOptions()
                        .setValue(Buffer.buffer(Files.readAllBytes(Paths.get(store.getPath()))))
                        .setPassword(store.getPassword())));
    } catch (Throwable e) {
        // failed to load keystore due to wrong password or missing file etc.
        // cannot recover from this in a safe manner: shut down.
        core.logger(getClass()).onError(e);
        System.exit(0);
    }
}
 
开发者ID:codingchili,项目名称:chili-core,代码行数:14,代码来源:SecuritySettings.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ColorAdjust类代码示例发布时间:2022-05-21
下一篇:
Java JsonbBuilder类代码示例发布时间: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