View Javadoc

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