Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sap-service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
sap-service
Commits
74930ed8
Commit
74930ed8
authored
Aug 14, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
7700a15d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
SAPTrustManager.java
src/main/java/com/egolm/sso/util/SAPTrustManager.java
+4
-5
No files found.
src/main/java/com/egolm/sso/util/SAPTrustManager.java
View file @
74930ed8
...
...
@@ -5,7 +5,9 @@ import java.security.NoSuchAlgorithmException;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.HttpsURLConnection
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLSession
;
import
javax.net.ssl.TrustManager
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
...
...
@@ -15,11 +17,8 @@ public class SAPTrustManager implements javax.net.ssl.TrustManager, javax.net.ss
private
final
static
Log
logger
=
LogFactory
.
getLog
(
SAPTrustManager
.
class
);
public
static
void
trustAllHttpsCertificates
()
throws
NoSuchAlgorithmException
,
KeyManagementException
{
javax
.
net
.
ssl
.
TrustManager
[]
trustAllCerts
=
new
javax
.
net
.
ssl
.
TrustManager
[
1
];
javax
.
net
.
ssl
.
TrustManager
tm
=
new
SAPTrustManager
();
trustAllCerts
[
0
]
=
tm
;
javax
.
net
.
ssl
.
SSLContext
sc
=
javax
.
net
.
ssl
.
SSLContext
.
getInstance
(
"SSL"
);
sc
.
init
(
null
,
trustAllCerts
,
null
);
SSLContext
sc
=
SSLContext
.
getInstance
(
"SSL"
);
sc
.
init
(
null
,
new
TrustManager
[]
{
new
SAPTrustManager
()},
null
);
HttpsURLConnection
.
setDefaultSSLSocketFactory
(
sc
.
getSocketFactory
());
HttpsURLConnection
.
setDefaultHostnameVerifier
(
new
HostnameVerifier
()
{
public
boolean
verify
(
String
urlHostName
,
SSLSession
session
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment