1
1
/*
2
- * Copyright 2005-2010 the original author or authors.
2
+ * Copyright 2005-2012 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
6
6
* You may obtain a copy of the License at
7
7
*
8
- * http://www.apache.org/licenses/LICENSE-2.0
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
9
*
10
10
* Unless required by applicable law or agreed to in writing, software
11
11
* distributed under the License is distributed on an "AS IS" BASIS,
16
16
17
17
package org .springframework .ws .soap .security .wss4j ;
18
18
19
- import java .io .IOException ;
20
- import java .security .cert .X509Certificate ;
19
+ import java .util .List ;
21
20
import java .util .Properties ;
22
- import java .util .Vector ;
23
- import javax .security .auth .callback .Callback ;
24
- import javax .security .auth .callback .CallbackHandler ;
25
- import javax .security .auth .callback .UnsupportedCallbackException ;
26
21
27
- import org .apache .ws .security .WSConstants ;
28
- import org .apache .ws .security .WSPasswordCallback ;
22
+ import org .springframework .ws .context .MessageContext ;
23
+
24
+ import org .apache .ws .security .WSSecurityEngineResult ;
29
25
import org .apache .ws .security .WSSecurityException ;
30
26
import org .apache .ws .security .components .crypto .Crypto ;
31
27
import org .apache .ws .security .handler .RequestData ;
32
28
import org .apache .ws .security .handler .WSHandler ;
33
29
import org .apache .ws .security .handler .WSHandlerConstants ;
34
- import org .apache .ws .security .message .token .Timestamp ;
35
30
import org .w3c .dom .Document ;
36
31
37
- import org .springframework .ws .context .MessageContext ;
38
-
39
32
/**
40
33
* @author Tareq Abed Rabbo
41
34
* @author Arjen Poutsma
@@ -46,8 +39,6 @@ class Wss4jHandler extends WSHandler {
46
39
/** Keys are constants from {@link WSHandlerConstants}; values are strings. */
47
40
private Properties options = new Properties ();
48
41
49
- private CallbackHandler securementCallbackHandler ;
50
-
51
42
private String securementPassword ;
52
43
53
44
private Crypto securementEncryptionCrypto ;
@@ -61,12 +52,7 @@ class Wss4jHandler extends WSHandler {
61
52
}
62
53
63
54
@ Override
64
- protected boolean checkReceiverResults (Vector wsResult , Vector actions ) {
65
- return super .checkReceiverResults (wsResult , actions );
66
- }
67
-
68
- @ Override
69
- protected boolean checkReceiverResultsAnyOrder (Vector wsResult , Vector actions ) {
55
+ protected boolean checkReceiverResultsAnyOrder (List <WSSecurityEngineResult > wsResult , List <Integer > actions ) {
70
56
return super .checkReceiverResultsAnyOrder (wsResult , actions );
71
57
}
72
58
@@ -83,10 +69,6 @@ public Object getOption(String key) {
83
69
return options .getProperty (key );
84
70
}
85
71
86
- void setSecurementCallbackHandler (CallbackHandler securementCallbackHandler ) {
87
- this .securementCallbackHandler = securementCallbackHandler ;
88
- }
89
-
90
72
void setSecurementPassword (String securementPassword ) {
91
73
this .securementPassword = securementPassword ;
92
74
}
@@ -99,48 +81,6 @@ void setSecurementSignatureCrypto(Crypto securementSignatureCrypto) {
99
81
this .securementSignatureCrypto = securementSignatureCrypto ;
100
82
}
101
83
102
- /** Gets the password first from securementCallbackHandler, then from securementPassword if not found. */
103
- @ Override
104
- public WSPasswordCallback getPassword (String username ,
105
- int doAction ,
106
- String clsProp ,
107
- String refProp ,
108
- RequestData reqData ) {
109
- WSPasswordCallback callback ;
110
- if (securementCallbackHandler != null ) {
111
- int reason = 0 ;
112
-
113
- switch (doAction ) {
114
- case WSConstants .UT :
115
- case WSConstants .UT_SIGN :
116
- reason = WSPasswordCallback .USERNAME_TOKEN ;
117
- break ;
118
- case WSConstants .SIGN :
119
- reason = WSPasswordCallback .SIGNATURE ;
120
- break ;
121
- case WSConstants .ENCR :
122
- reason = WSPasswordCallback .KEY_NAME ;
123
- break ;
124
- }
125
- callback = new WSPasswordCallback (username , reason );
126
- Callback [] callbacks = new Callback []{callback };
127
- try {
128
- securementCallbackHandler .handle (callbacks );
129
- }
130
- catch (UnsupportedCallbackException ex ) {
131
- throw new Wss4jSecuritySecurementException (ex .getMessage (), ex );
132
- }
133
- catch (IOException ex ) {
134
- throw new Wss4jSecuritySecurementException (ex .getMessage (), ex );
135
- }
136
- }
137
- else {
138
- callback = new WSPasswordCallback (username , WSPasswordCallback .UNKNOWN );
139
- callback .setPassword (securementPassword );
140
- }
141
- return callback ;
142
- }
143
-
144
84
@ Override
145
85
public String getPassword (Object msgContext ) {
146
86
return securementPassword ;
@@ -172,18 +112,11 @@ public void setProperty(Object msgContext, String key, Object value) {
172
112
}
173
113
174
114
@ Override
175
- protected void doSenderAction (int doAction , Document doc , RequestData reqData , Vector actions , boolean isRequest )
176
- throws WSSecurityException {
115
+ protected void doSenderAction (int doAction ,
116
+ Document doc ,
117
+ RequestData reqData ,
118
+ List <Integer > actions ,
119
+ boolean isRequest ) throws WSSecurityException {
177
120
super .doSenderAction (doAction , doc , reqData , actions , isRequest );
178
121
}
179
-
180
- @ Override
181
- protected boolean verifyTimestamp (Timestamp timestamp , int timeToLive ) throws WSSecurityException {
182
- return super .verifyTimestamp (timestamp , timeToLive );
183
- }
184
-
185
- @ Override
186
- protected boolean verifyTrust (X509Certificate cert , RequestData reqData ) throws WSSecurityException {
187
- return super .verifyTrust (cert , reqData );
188
- }
189
122
}
0 commit comments