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
6f15cce6
Commit
6f15cce6
authored
Aug 14, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
7aa1835e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
19 deletions
+13
-19
SAPServiceFactory.java
src/main/java/com/egolm/sso/clients/SAPServiceFactory.java
+13
-19
No files found.
src/main/java/com/egolm/sso/clients/SAPServiceFactory.java
View file @
6f15cce6
...
...
@@ -40,8 +40,18 @@ public class SAPServiceFactory {
private
String
password
;
public
SAPServiceFactory
()
throws
KeyManagementException
,
NoSuchAlgorithmException
{
trustAllHttpsCertificates
();
HttpsURLConnection
.
setDefaultHostnameVerifier
(
hv
);
javax
.
net
.
ssl
.
TrustManager
[]
trustAllCerts
=
new
javax
.
net
.
ssl
.
TrustManager
[
1
];
javax
.
net
.
ssl
.
TrustManager
tm
=
new
MyTrustManager
();
trustAllCerts
[
0
]
=
tm
;
javax
.
net
.
ssl
.
SSLContext
sc
=
javax
.
net
.
ssl
.
SSLContext
.
getInstance
(
"SSL"
);
sc
.
init
(
null
,
trustAllCerts
,
null
);
HttpsURLConnection
.
setDefaultSSLSocketFactory
(
sc
.
getSocketFactory
());
HttpsURLConnection
.
setDefaultHostnameVerifier
(
new
HostnameVerifier
()
{
public
boolean
verify
(
String
urlHostName
,
SSLSession
session
)
{
logger
.
warn
(
"Warning: URL Host: "
+
urlHostName
+
" vs. "
+
session
.
getPeerHost
());
return
true
;
}
});
}
public
<
T
>
T
create
(
Class
<
T
>
requiredType
,
String
WSDLPATH
,
QName
serviceQName
)
{
...
...
@@ -96,23 +106,7 @@ public class SAPServiceFactory {
PasswordText
,
PasswordNone
,
PasswordDigest
}
HostnameVerifier
hv
=
new
HostnameVerifier
()
{
public
boolean
verify
(
String
urlHostName
,
SSLSession
session
)
{
logger
.
warn
(
"Warning: URL Host: "
+
urlHostName
+
" vs. "
+
session
.
getPeerHost
());
return
true
;
}
};
private
void
trustAllHttpsCertificates
()
throws
KeyManagementException
,
NoSuchAlgorithmException
{
javax
.
net
.
ssl
.
TrustManager
[]
trustAllCerts
=
new
javax
.
net
.
ssl
.
TrustManager
[
1
];
javax
.
net
.
ssl
.
TrustManager
tm
=
new
miTM
();
trustAllCerts
[
0
]
=
tm
;
javax
.
net
.
ssl
.
SSLContext
sc
=
javax
.
net
.
ssl
.
SSLContext
.
getInstance
(
"SSL"
);
sc
.
init
(
null
,
trustAllCerts
,
null
);
javax
.
net
.
ssl
.
HttpsURLConnection
.
setDefaultSSLSocketFactory
(
sc
.
getSocketFactory
());
}
static
class
miTM
implements
javax
.
net
.
ssl
.
TrustManager
,
javax
.
net
.
ssl
.
X509TrustManager
{
public
static
class
MyTrustManager
implements
javax
.
net
.
ssl
.
TrustManager
,
javax
.
net
.
ssl
.
X509TrustManager
{
public
java
.
security
.
cert
.
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
...
...
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