HttpClientAccessTokenServiceByDB 구현체 내에 tls 연결에 대한 인증서 검증 옵션 적용
This commit is contained in:
+6
-1
@@ -173,7 +173,12 @@ public class HttpClientAccessTokenServiceWithBase64Header implements HttpClientA
|
|||||||
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
||||||
} else {
|
} else {
|
||||||
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
||||||
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
|
SSLConnectionSocketFactory csf = null;
|
||||||
|
if (testMode) {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
|
||||||
|
} else {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext);
|
||||||
|
}
|
||||||
cmBuilder.setSSLSocketFactory(csf);
|
cmBuilder.setSSLSocketFactory(csf);
|
||||||
}
|
}
|
||||||
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
||||||
|
|||||||
+6
-1
@@ -181,7 +181,12 @@ public class HttpClientAccessTokenServiceWithBase64NiceOn implements HttpClientA
|
|||||||
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
||||||
} else {
|
} else {
|
||||||
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
||||||
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
|
SSLConnectionSocketFactory csf = null;
|
||||||
|
if (testMode) {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
|
||||||
|
} else {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext);
|
||||||
|
}
|
||||||
cmBuilder.setSSLSocketFactory(csf);
|
cmBuilder.setSSLSocketFactory(csf);
|
||||||
}
|
}
|
||||||
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
||||||
|
|||||||
+6
-1
@@ -180,7 +180,12 @@ public class HttpClientAccessTokenServiceWithDefault implements HttpClientAccess
|
|||||||
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
||||||
} else {
|
} else {
|
||||||
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
||||||
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
|
SSLConnectionSocketFactory csf = null;
|
||||||
|
if (testMode) {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
|
||||||
|
} else {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext);
|
||||||
|
}
|
||||||
cmBuilder.setSSLSocketFactory(csf);
|
cmBuilder.setSSLSocketFactory(csf);
|
||||||
}
|
}
|
||||||
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
||||||
|
|||||||
+6
-1
@@ -179,7 +179,12 @@ public class HttpClientAccessTokenServiceWithParam implements HttpClientAccessTo
|
|||||||
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
||||||
} else {
|
} else {
|
||||||
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
||||||
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
|
SSLConnectionSocketFactory csf = null;
|
||||||
|
if (testMode) {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
|
||||||
|
} else {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext);
|
||||||
|
}
|
||||||
cmBuilder.setSSLSocketFactory(csf);
|
cmBuilder.setSSLSocketFactory(csf);
|
||||||
}
|
}
|
||||||
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
||||||
|
|||||||
+6
-1
@@ -196,7 +196,12 @@ public class HttpClientAccessTokenServiceWithParamAddBody implements HttpClientA
|
|||||||
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
cmBuilder.setSSLSocketFactory(sslSocketFactory);
|
||||||
} else {
|
} else {
|
||||||
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
|
||||||
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
|
SSLConnectionSocketFactory csf = null;
|
||||||
|
if (testMode) {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
|
||||||
|
} else {
|
||||||
|
csf = new SSLConnectionSocketFactory(sslContext);
|
||||||
|
}
|
||||||
cmBuilder.setSSLSocketFactory(csf);
|
cmBuilder.setSSLSocketFactory(csf);
|
||||||
}
|
}
|
||||||
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
} catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
|
||||||
|
|||||||
Reference in New Issue
Block a user