本文整理汇总了Java中io.dropwizard.jetty.HttpsConnectorFactory类的典型用法代码示例。如果您正苦于以下问题:Java HttpsConnectorFactory类的具体用法?Java HttpsConnectorFactory怎么用?Java HttpsConnectorFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpsConnectorFactory类属于io.dropwizard.jetty包,在下文中一共展示了HttpsConnectorFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applySsl
import io.dropwizard.jetty.HttpsConnectorFactory; //导入依赖的package包/类
private void applySsl(final HttpsConnectorFactory con) {
if (con.getKeyStoreProvider() != null || con.getTrustStoreProvider() != null) {
logger.warn("Orient auto ssl configuration is impossible because dropwizard "
+ "configured using provider");
return;
}
final OServerSocketFactoryConfiguration ssl = new OServerSocketFactoryConfiguration();
ssl.name = AUTO_SSL_SOCKET;
ssl.implementation = OServerTLSSocketFactory.class.getName();
ssl.parameters = buildParameters(con);
if (conf.network.sockets == null) {
conf.network.sockets = new ArrayList<>();
}
conf.network.sockets.add(ssl);
// apply ssl for both binary and http
conf.network.listeners.forEach(this::updateListener);
// required for remote connections usage (we know for sure that server use ssl only so safe to configure)
OGlobalConfiguration.CLIENT_USE_SSL.setValue(true);
logger.info("SSL configuration applied to orient based on dropwizard main context configuration."
+ "Client SSL (OGlobalConfiguration.CLIENT_USE_SSL) enabled.");
}
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:25,代码来源:AutoSslConfigurator.java
示例2: getPort
import io.dropwizard.jetty.HttpsConnectorFactory; //导入依赖的package包/类
private static int getPort(Configuration config) {
DefaultServerFactory serverFactory = (DefaultServerFactory) config.getServerFactory();
ConnectorFactory connectorFactory = serverFactory.getApplicationConnectors().get(0);
if (connectorFactory instanceof HttpsConnectorFactory) {
return ((HttpsConnectorFactory) connectorFactory).getPort();
} else if (connectorFactory instanceof HttpConnectorFactory) {
return ((HttpConnectorFactory) connectorFactory).getPort();
}
throw new IllegalArgumentException("Could not extract main application port from configuration");
}
开发者ID:brandtg,项目名称:dropwizard-helix,代码行数:13,代码来源:HelixServiceDiscoveryBundle.java
示例3: setupAuthentication
import io.dropwizard.jetty.HttpsConnectorFactory; //导入依赖的package包/类
private void setupAuthentication(ApiServerConfig cfg, Environment env) throws Exception {
final Client client = new RestClientBuilder(env, cfg).build(getName());
// Health check for oauth2 server presence
final OAuth2HealthCheck healthCheck = new OAuth2HealthCheck(cfg.getOauth2Config(), client);
env.healthChecks().register("Oauth2 server", healthCheck);
// Setting up the oauth2 authenticator
CookieEncrypter cookieEncrypter = new CookieEncrypter(cfg.getOauth2Config().getCookieSecretKey());
boolean https = ((DefaultServerFactory)cfg.getServerFactory()).getApplicationConnectors().get(0) instanceof HttpsConnectorFactory;
cookieEncrypter.setSecureFlag(https);
OAuth2Authenticator authenticator = new OAuth2Authenticator(cfg.getOauth2Config(), client);
// Using cache authenticator
CachingAuthenticator<OAuth2Credentials, User> cachingAuthenticator =
new CachingAuthenticator<OAuth2Credentials, User>(env.metrics(), authenticator, cfg.getCacheSpec());
final OAuth2AuthFilter<User> oAuth2AuthFilter =
new OAuth2AuthFilter.Builder<OAuth2Credentials, User, OAuth2AuthFilter<User>, CachingAuthenticator<OAuth2Credentials, User>>()
.setAuthenticator(cachingAuthenticator)
.setCookieEncrypter(cookieEncrypter)
.build();
env.jersey().register(new AuthDynamicFeature(oAuth2AuthFilter));
env.jersey().register(RolesAllowedDynamicFeature.class);
env.jersey().register(new AuthValueFactoryProvider.Binder<User>(User.class));
// Register the oauth2 resource that handles client authentication
final OAuth2Resource or = new OAuth2Resource(client, cfg.getOauth2Config(), cookieEncrypter);
env.jersey().register(or);
}
开发者ID:edeoliveira,项目名称:oauth2-dropwizard,代码行数:32,代码来源:ApiServer.java
示例4: setupSSL
import io.dropwizard.jetty.HttpsConnectorFactory; //导入依赖的package包/类
public RestClientBuilder setupSSL(ApiServerConfig cfg) {
SSLContext sslContext;
ConnectorFactory factory = cfg.getClientConfig();
if (factory == null || !(factory instanceof HttpsConnectorFactory))
return this;
HttpsConnectorFactory hcf = (HttpsConnectorFactory) factory;
if (hcf.getKeyStorePath() != null) {
keyStore = hcf.getKeyStorePath();
keyStorePassword = hcf.getKeyStorePassword();
trustStore = hcf.getTrustStorePath();
trustStorePassword = hcf.getTrustStorePassword();
sslContext = getSSLContext();
} else {
SslConfigurator sslConfig = SslConfigurator.newInstance();
sslContext = sslConfig.createSSLContext();
}
SSLConnectionSocketFactory sslConnectionSocketFactory = hcf.isValidateCerts() ?
new SSLConnectionSocketFactory(sslContext) :
new SSLConnectionSocketFactory(sslContext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
Registry<ConnectionSocketFactory> registry =
RegistryBuilder.<ConnectionSocketFactory>create().register("https", sslConnectionSocketFactory).build();
using(registry);
return this;
}
开发者ID:edeoliveira,项目名称:oauth2-dropwizard,代码行数:32,代码来源:RestClientBuilder.java
示例5: getPort
import io.dropwizard.jetty.HttpsConnectorFactory; //导入依赖的package包/类
public static Integer getPort(ConnectorFactory connectorFactory) {
if(connectorFactory instanceof HttpConnectorFactory) {
return ((HttpConnectorFactory)connectorFactory).getPort();
}
if(connectorFactory instanceof HttpsConnectorFactory) {
return ((HttpsConnectorFactory)connectorFactory).getPort();
}
throw new RuntimeException("Unable to infer Port of " + connectorFactory);
}
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:10,代码来源:DropwizardServerHelpers.java
示例6: checkAndConfigure
import io.dropwizard.jetty.HttpsConnectorFactory; //导入依赖的package包/类
private void checkAndConfigure(final ConnectorFactory connector) {
if (connector instanceof HttpsConnectorFactory) {
final List<OServerSocketFactoryConfiguration> sockets = conf.network.sockets;
// no defined sockets already mean no ssl configured, otherwise look listeners
// (sockets may be defined but not actually used)
if (sockets != null && !sockets.isEmpty() && isSslAlreadyDefined()) {
logger.warn("Orient auto ssl configuration not performed because ssl socket is defined "
+ "manually and used in one of the listeners (see network.listeners section)");
} else {
applySsl((HttpsConnectorFactory) connector);
}
}
}
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:14,代码来源:AutoSslConfigurator.java
示例7: buildParameters
import io.dropwizard.jetty.HttpsConnectorFactory; //导入依赖的package包/类
private OServerParameterConfiguration[] buildParameters(final HttpsConnectorFactory con) {
final List<OServerParameterConfiguration> res = new ArrayList<>();
addIfSet(res, PARAM_NETWORK_SSL_KEYSTORE, con.getKeyStorePath());
addIfSet(res, PARAM_NETWORK_SSL_KEYSTORE_TYPE, con.getKeyStoreType());
addIfSet(res, PARAM_NETWORK_SSL_KEYSTORE_PASSWORD, con.getKeyStorePassword());
addIfSet(res, PARAM_NETWORK_SSL_TRUSTSTORE, con.getTrustStorePath());
addIfSet(res, PARAM_NETWORK_SSL_TRUSTSTORE_TYPE, con.getTrustStoreType());
addIfSet(res, PARAM_NETWORK_SSL_TRUSTSTORE_PASSWORD, con.getTrustStorePassword());
return res.toArray(new OServerParameterConfiguration[res.size()]);
}
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:11,代码来源:AutoSslConfigurator.java
示例8: getProtocol
import io.dropwizard.jetty.HttpsConnectorFactory; //导入依赖的package包/类
private @Nonnull String getProtocol(ExpanderConfiguration config) {
return HttpsConnectorFactory.class.isAssignableFrom(getConnectorFactoy(config.getServerFactory()).getClass())
? "https" : "http";
}
开发者ID:rrauschenbach,项目名称:FeedExpander,代码行数:5,代码来源:ExpanderApplication.java
注:本文中的io.dropwizard.jetty.HttpsConnectorFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论