1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.kuali.rice.ksb.config.wss4j; |
18 |
|
|
19 |
|
import org.apache.ws.security.WSPasswordCallback; |
20 |
|
import org.kuali.rice.core.api.config.ConfigurationException; |
21 |
|
import org.kuali.rice.core.api.config.property.Config; |
22 |
|
import org.kuali.rice.core.api.config.property.ConfigContext; |
23 |
|
|
24 |
|
import javax.security.auth.callback.Callback; |
25 |
|
import javax.security.auth.callback.CallbackHandler; |
26 |
|
import javax.security.auth.callback.UnsupportedCallbackException; |
27 |
|
import java.io.IOException; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@author |
35 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.5 |
|
36 |
|
public class CryptoPasswordCallbackHandler implements CallbackHandler { |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
41 |
0
|
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {... |
42 |
0
|
for (int i = 0; i < callbacks.length; i++) { |
43 |
0
|
if (callbacks[i] instanceof WSPasswordCallback) { |
44 |
0
|
WSPasswordCallback pc = (WSPasswordCallback) callbacks[i]; |
45 |
0
|
String password = ConfigContext.getCurrentContextConfig().getKeystorePassword(); |
46 |
0
|
if (password == null) { |
47 |
0
|
throw new ConfigurationException("Could not locate the webservice password. Should be configured as the '" + Config.KEYSTORE_PASSWORD + "' property."); |
48 |
|
} |
49 |
0
|
pc.setPassword(password); |
50 |
|
} else { |
51 |
0
|
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback"); |
52 |
|
} |
53 |
|
} |
54 |
|
} |
55 |
|
} |