@Override public JerseyClientBuilder trustStore(KeyStore trustStore) { if (trustStore == null) { throw new NullPointerException(LocalizationMessages.NULL_TRUSTSTORE()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.trustStore(trustStore); sslContext = null; return this; }
@Override public JerseyClientBuilder trustStore(KeyStore trustStore) { if (trustStore == null) { throw new NullPointerException(LocalizationMessages.NULL_TRUSTSTORE()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.trustStore(trustStore); sslContext = null; return this; }
@Override public JerseyClientBuilder trustStore(KeyStore trustStore) { if (trustStore == null) { throw new NullPointerException(LocalizationMessages.NULL_TRUSTSTORE()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.trustStore(trustStore); sslContext = null; return this; }
public HttpsClient(String host, String project) { SslConfigurator sslConfig = SslConfigurator.newInstance(); SSLContext ssl = sslConfig.createSSLContext(); this.target = ClientBuilder.newBuilder().sslContext(ssl).build().target(UriBuilder.fromUri("https://" + host).build()); if (project != null) { this.target = this.target.path(project); } }
@Override public JerseyClientBuilder keyStore(KeyStore keyStore, char[] password) { if (keyStore == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE()); } if (password == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE_PASWORD()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.keyStore(keyStore); sslConfigurator.keyPassword(password); sslContext = null; return this; }
@Override public JerseyClientBuilder keyStore(KeyStore keyStore, char[] password) { if (keyStore == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE()); } if (password == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE_PASWORD()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.keyStore(keyStore); sslConfigurator.keyPassword(password); sslContext = null; return this; }
@Override public JerseyClientBuilder keyStore(KeyStore keyStore, char[] password) { if (keyStore == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE()); } if (password == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE_PASWORD()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.keyStore(keyStore); sslConfigurator.keyPassword(password); sslContext = null; return this; }
@Override public void run() { SslConfigurator sslConfig = SslConfigurator.newInstance() .trustStoreFile("./truststore_client") .trustStorePassword("asdfgh")
private static Client initializeClient(DirectoryServerConfiguration directoryServerConfiguration) throws CertificateException { KeyStore trustStore = initializeKeyStore(directoryServerConfiguration.getReplicationCaCertificate()); SSLContext sslContext = SslConfigurator.newInstance() .securityProtocol("TLSv1.2") .trustStore(trustStore) .createSSLContext(); return ClientBuilder.newBuilder() .register(HttpAuthenticationFeature.basic("signal", directoryServerConfiguration.getReplicationPassword().getBytes())) .sslContext(sslContext) .build(); }
@Override public JerseyClientBuilder trustStore(KeyStore trustStore) { if (trustStore == null) { throw new NullPointerException(LocalizationMessages.NULL_TRUSTSTORE()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.trustStore(trustStore); sslContext = null; return this; }
@Override public JerseyClientBuilder trustStore(KeyStore trustStore) { if (trustStore == null) { throw new NullPointerException(LocalizationMessages.NULL_TRUSTSTORE()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.trustStore(trustStore); sslContext = null; return this; }
@Override public JerseyClientBuilder trustStore(KeyStore trustStore) { if (trustStore == null) { throw new NullPointerException(LocalizationMessages.NULL_TRUSTSTORE()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.trustStore(trustStore); sslContext = null; return this; }
@Override public JerseyClientBuilder trustStore(KeyStore trustStore) { if (trustStore == null) { throw new NullPointerException(LocalizationMessages.NULL_TRUSTSTORE()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.trustStore(trustStore); sslContext = null; return this; }
@Override public JerseyClientBuilder keyStore(KeyStore keyStore, char[] password) { if (keyStore == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE()); } if (password == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE_PASWORD()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.keyStore(keyStore); sslConfigurator.keyPassword(password); sslContext = null; return this; }
@Override public JerseyClientBuilder keyStore(KeyStore keyStore, char[] password) { if (keyStore == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE()); } if (password == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE_PASWORD()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.keyStore(keyStore); sslConfigurator.keyPassword(password); sslContext = null; return this; }
@Override public JerseyClientBuilder keyStore(KeyStore keyStore, char[] password) { if (keyStore == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE()); } if (password == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE_PASWORD()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.keyStore(keyStore); sslConfigurator.keyPassword(password); sslContext = null; return this; }
@Override public JerseyClientBuilder keyStore(KeyStore keyStore, char[] password) { if (keyStore == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE()); } if (password == null) { throw new NullPointerException(LocalizationMessages.NULL_KEYSTORE_PASWORD()); } if (sslConfigurator == null) { sslConfigurator = SslConfigurator.newInstance(); } sslConfigurator.keyStore(keyStore); sslConfigurator.keyPassword(password); sslContext = null; return this; }
/** * Default constructor. * @param accessKey app access key * @param secretKey app secret key */ public ParaClient(String accessKey, String secretKey) { this.accessKey = accessKey; this.secretKey = secretKey; if (StringUtils.length(secretKey) < 6) { logger.warn("Secret key appears to be invalid. Make sure you call 'signIn()' first."); } this.throwExceptionOnHTTPError = false; ObjectMapper mapper = ParaObjectUtils.getJsonMapper(); mapper.setSerializationInclusion(JsonInclude.Include.USE_DEFAULTS); ClientConfig clientConfig = new ClientConfig(); clientConfig.register(GenericExceptionMapper.class); clientConfig.register(new JacksonJsonProvider(mapper)); clientConfig.connectorProvider(new HttpUrlConnectorProvider().useSetMethodWorkaround()); SSLContext sslContext = SslConfigurator.newInstance().createSSLContext(); apiClient = ClientBuilder.newBuilder(). sslContext(sslContext). withConfig(clientConfig).build(); }
public static Client buildClient(RestClientConfig clientConfig) { Client client; if (clientConfig.isDisabledSecureConnection()) { client = ClientBuilder.newBuilder().build(); } else { SslConfigurator sslConfig = SslConfigurator.newInstance() .trustStore(getTrustStore()) .trustStorePassword(getTrustStorePassword()) .securityProtocol(TLSV1_2); SSLContext sslContext = sslConfig.createSSLContext(); client = ClientBuilder.newBuilder().sslContext(sslContext).build(); } client.register(RestClientLoggingFilter.class); return client; }
@Override protected Client createJerseyClient() throws Exception { SslConfigurator sslConfig = SslConfigurator.newInstance() .trustStoreFile(getResourcePath("bookie.truststore.jks")); SSLContext sslContext = sslConfig.createSSLContext(); return ClientBuilder.newBuilder().sslContext(sslContext) .hostnameVerifier((s1, s2) -> true) .build(); }