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
c6761375
Commit
c6761375
authored
Aug 15, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
81198563
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
54 deletions
+1
-54
SapServiceApplication.java
src/main/java/com/egolm/sso/SapServiceApplication.java
+1
-3
SAPTrustManager.java
src/main/java/com/egolm/sso/config/SAPTrustManager.java
+0
-51
No files found.
src/main/java/com/egolm/sso/SapServiceApplication.java
View file @
c6761375
...
...
@@ -10,8 +10,6 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
com.egolm.sso.config.SAPTrustManager
;
@EnableScheduling
@SpringBootApplication
@EnableTransactionManagement
...
...
@@ -20,9 +18,9 @@ public class SapServiceApplication {
private
static
ApplicationContext
applicationContext
;
public
static
void
main
(
String
[]
args
)
throws
KeyManagementException
,
NoSuchAlgorithmException
{
System
.
setProperty
(
"java.io.tmpdir"
,
"temp"
);
System
.
out
.
println
(
System
.
getProperty
(
"java.home"
));
TimeZone
.
setDefault
(
TimeZone
.
getTimeZone
(
"GMT+8"
));
SAPTrustManager
.
trustAllHttpsCertificates
();
applicationContext
=
SpringApplication
.
run
(
SapServiceApplication
.
class
,
args
);
}
...
...
src/main/java/com/egolm/sso/config/SAPTrustManager.java
deleted
100644 → 0
View file @
81198563
package
com
.
egolm
.
sso
.
config
;
import
java.security.KeyManagementException
;
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
;
public
class
SAPTrustManager
implements
javax
.
net
.
ssl
.
TrustManager
,
javax
.
net
.
ssl
.
X509TrustManager
{
private
final
static
Log
logger
=
LogFactory
.
getLog
(
SAPTrustManager
.
class
);
public
static
void
trustAllHttpsCertificates
()
throws
NoSuchAlgorithmException
,
KeyManagementException
{
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
)
{
logger
.
warn
(
"Warning: URL Host: "
+
urlHostName
+
" vs. "
+
session
.
getPeerHost
());
return
true
;
}
});
}
public
java
.
security
.
cert
.
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
public
boolean
isServerTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
certs
)
{
return
true
;
}
public
boolean
isClientTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
certs
)
{
return
true
;
}
public
void
checkServerTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
certs
,
String
authType
)
throws
java
.
security
.
cert
.
CertificateException
{
return
;
}
public
void
checkClientTrusted
(
java
.
security
.
cert
.
X509Certificate
[]
certs
,
String
authType
)
throws
java
.
security
.
cert
.
CertificateException
{
return
;
}
}
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