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
3ddb0fd2
Commit
3ddb0fd2
authored
Aug 16, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
c8dbe771
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
31 deletions
+5
-31
SAPServiceFactory.java
src/main/java/com/egolm/sso/clients/SAPServiceFactory.java
+5
-31
No files found.
src/main/java/com/egolm/sso/clients/SAPServiceFactory.java
View file @
3ddb0fd2
...
@@ -8,8 +8,6 @@ import java.net.URL;
...
@@ -8,8 +8,6 @@ import java.net.URL;
import
java.security.KeyStore
;
import
java.security.KeyStore
;
import
java.security.cert.CertificateException
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.security.cert.X509Certificate
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.KeyManager
;
import
javax.net.ssl.KeyManager
;
...
@@ -18,9 +16,8 @@ import javax.net.ssl.SSLSession;
...
@@ -18,9 +16,8 @@ import javax.net.ssl.SSLSession;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.TrustManagerFactory
;
import
javax.net.ssl.TrustManagerFactory
;
import
javax.net.ssl.X509TrustManager
;
import
javax.net.ssl.X509TrustManager
;
import
javax.security.auth.callback.Callback
;
import
javax.security.auth.callback.CallbackHandler
;
import
javax.xml.namespace.QName
;
import
javax.xml.namespace.QName
;
import
javax.xml.ws.BindingProvider
;
import
javax.xml.ws.Service
;
import
javax.xml.ws.Service
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
...
@@ -29,10 +26,6 @@ import org.apache.cxf.configuration.jsse.TLSClientParameters;
...
@@ -29,10 +26,6 @@ import org.apache.cxf.configuration.jsse.TLSClientParameters;
import
org.apache.cxf.endpoint.Client
;
import
org.apache.cxf.endpoint.Client
;
import
org.apache.cxf.frontend.ClientProxy
;
import
org.apache.cxf.frontend.ClientProxy
;
import
org.apache.cxf.transport.http.HTTPConduit
;
import
org.apache.cxf.transport.http.HTTPConduit
;
import
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor
;
import
org.apache.ws.security.WSConstants
;
import
org.apache.ws.security.handler.WSHandlerConstants
;
import
org.apache.wss4j.common.ext.WSPasswordCallback
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -76,11 +69,13 @@ public class SAPServiceFactory {
...
@@ -76,11 +69,13 @@ public class SAPServiceFactory {
assert
serviceQName
!=
null
:
"WebService serviceQName cannot be null"
;
assert
serviceQName
!=
null
:
"WebService serviceQName cannot be null"
;
Service
dyService
=
Service
.
create
(
wsdlLocation
,
serviceQName
);
Service
dyService
=
Service
.
create
(
wsdlLocation
,
serviceQName
);
T
service
=
portQName
==
null
?
dyService
.
getPort
(
requiredType
)
:
dyService
.
getPort
(
portQName
,
requiredType
);
T
service
=
portQName
==
null
?
dyService
.
getPort
(
requiredType
)
:
dyService
.
getPort
(
portQName
,
requiredType
);
Client
client
=
ClientProxy
.
getClient
(
service
);
if
(
isOpenUserAuth
)
{
if
(
isOpenUserAuth
)
{
client
.
getOutInterceptors
().
add
(
this
.
getWSS4JOutInterceptor
());
BindingProvider
bp
=
(
BindingProvider
)
service
;
bp
.
getRequestContext
().
put
(
BindingProvider
.
USERNAME_PROPERTY
,
username
);
bp
.
getRequestContext
().
put
(
BindingProvider
.
PASSWORD_PROPERTY
,
password
);
}
}
if
(
isOpenSSLAuth
)
{
if
(
isOpenSSLAuth
)
{
Client
client
=
ClientProxy
.
getClient
(
service
);
HTTPConduit
httpConduit
=
(
HTTPConduit
)
client
.
getConduit
();
HTTPConduit
httpConduit
=
(
HTTPConduit
)
client
.
getConduit
();
TLSClientParameters
tlsParams
=
httpConduit
.
getTlsClientParameters
();
TLSClientParameters
tlsParams
=
httpConduit
.
getTlsClientParameters
();
tlsParams
=
tlsParams
==
null
?
new
TLSClientParameters
()
:
tlsParams
;
tlsParams
=
tlsParams
==
null
?
new
TLSClientParameters
()
:
tlsParams
;
...
@@ -163,25 +158,4 @@ public class SAPServiceFactory {
...
@@ -163,25 +158,4 @@ public class SAPServiceFactory {
return
new
URL
(
"file:////"
+
new
File
(
WSDLPATH
).
getAbsolutePath
());
return
new
URL
(
"file:////"
+
new
File
(
WSDLPATH
).
getAbsolutePath
());
}
}
private
WSS4JOutInterceptor
wss4JOutInterceptor
=
null
;
public
WSS4JOutInterceptor
getWSS4JOutInterceptor
()
{
if
(
wss4JOutInterceptor
==
null
)
{
Map
<
String
,
Object
>
pro
=
new
HashMap
<
String
,
Object
>();
pro
.
put
(
WSHandlerConstants
.
ACTION
,
WSHandlerConstants
.
USERNAME_TOKEN
);
pro
.
put
(
WSHandlerConstants
.
USER
,
username
);
pro
.
put
(
WSHandlerConstants
.
PASSWORD_TYPE
,
WSConstants
.
PW_TEXT
);
pro
.
put
(
WSHandlerConstants
.
PW_CALLBACK_REF
,
new
CallbackHandler
()
{
public
void
handle
(
Callback
[]
callbacks
)
{
for
(
int
i
=
0
;
i
<
callbacks
.
length
;
i
++)
{
WSPasswordCallback
pc
=
(
WSPasswordCallback
)
callbacks
[
i
];
pc
.
setPassword
(
password
);
}
}
});
wss4JOutInterceptor
=
new
WSS4JOutInterceptor
(
pro
);
}
return
wss4JOutInterceptor
;
}
}
}
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