Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
XFireWSS4JInHandler |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright 2005-2007 The Kuali Foundation | |
3 | * | |
4 | * | |
5 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.opensource.org/licenses/ecl2.php | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | package org.kuali.rice.ksb.config.xfire; | |
18 | ||
19 | import java.util.Properties; | |
20 | ||
21 | import org.apache.log4j.Logger; | |
22 | import org.apache.ws.security.components.crypto.Crypto; | |
23 | import org.apache.ws.security.components.crypto.Merlin; | |
24 | import org.apache.ws.security.handler.RequestData; | |
25 | import org.apache.ws.security.handler.WSHandlerConstants; | |
26 | /* | |
27 | import org.codehaus.xfire.MessageContext; | |
28 | import org.codehaus.xfire.fault.XFireFault; | |
29 | import org.codehaus.xfire.security.wss4j.WSS4JInHandler; | |
30 | */ | |
31 | import org.kuali.rice.core.config.ConfigContext; | |
32 | import org.kuali.rice.core.exception.RiceRuntimeException; | |
33 | import org.kuali.rice.core.util.ClassLoaderUtils; | |
34 | import org.kuali.rice.ksb.config.wss4j.CryptoPasswordCallbackHandler; | |
35 | import org.kuali.rice.ksb.messaging.ServiceInfo; | |
36 | ||
37 | ||
38 | /** | |
39 | * | |
40 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
41 | */ | |
42 | ||
43 | //TODO: Replace this class with cxf wss4j in interceptor | |
44 | 0 | public class XFireWSS4JInHandler{} |
45 | /* | |
46 | public class XFireWSS4JInHandler extends WSS4JInHandler { | |
47 | ||
48 | private static final Logger LOG = Logger.getLogger(XFireWSS4JInHandler.class); | |
49 | private ServiceInfo serviceInfo; | |
50 | ||
51 | public XFireWSS4JInHandler(ServiceInfo serviceInfo) { | |
52 | this.serviceInfo = serviceInfo; | |
53 | this.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE); | |
54 | this.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, CryptoPasswordCallbackHandler.class.getName()); | |
55 | this.setProperty(WSHandlerConstants.SIG_KEY_ID, "IssuerSerial"); | |
56 | this.setProperty(WSHandlerConstants.USER, ConfigContext.getCurrentContextConfig().getKeystoreAlias()); | |
57 | } | |
58 | ||
59 | @Override | |
60 | public Crypto loadSignatureCrypto(RequestData reqData) { | |
61 | try { | |
62 | return new Merlin(getMerlinProperties(), ClassLoaderUtils.getDefaultClassLoader()); | |
63 | } catch (Exception e) { | |
64 | throw new RiceRuntimeException(e); | |
65 | } | |
66 | } | |
67 | ||
68 | @Override | |
69 | public Crypto loadDecryptionCrypto(RequestData reqData) { | |
70 | return loadSignatureCrypto(reqData); | |
71 | } | |
72 | ||
73 | protected Properties getMerlinProperties() { | |
74 | Properties props = new Properties(); | |
75 | props.put("org.apache.ws.security.crypto.merlin.keystore.type", "jks"); | |
76 | props.put("org.apache.ws.security.crypto.merlin.keystore.password", ConfigContext.getCurrentContextConfig().getKeystorePassword()); | |
77 | props.put("org.apache.ws.security.crypto.merlin.alias.password", ConfigContext.getCurrentContextConfig().getKeystorePassword()); | |
78 | props.put("org.apache.ws.security.crypto.merlin.keystore.alias", ConfigContext.getCurrentContextConfig().getKeystoreAlias()); | |
79 | props.put("org.apache.ws.security.crypto.merlin.file", ConfigContext.getCurrentContextConfig().getKeystoreFile()); | |
80 | ||
81 | if (LOG.isDebugEnabled()) { | |
82 | LOG.debug("Using keystore location " + ConfigContext.getCurrentContextConfig().getKeystoreFile()); | |
83 | } | |
84 | return props; | |
85 | } | |
86 | ||
87 | @Override | |
88 | public void invoke(MessageContext context) throws XFireFault { | |
89 | if (getServiceInfo().getServiceDefinition().getBusSecurity()) { | |
90 | super.invoke(context); | |
91 | } | |
92 | } | |
93 | ||
94 | public ServiceInfo getServiceInfo() { | |
95 | return serviceInfo; | |
96 | } | |
97 | ||
98 | public void setServiceInfo(ServiceInfo serviceInfo) { | |
99 | this.serviceInfo = serviceInfo; | |
100 | } | |
101 | ||
102 | } | |
103 | */ |