1 /** 2 * Copyright 2005-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 package org.kuali.rice.ksb.config.xfire; 17 18 /* 19 import org.codehaus.xfire.MessageContext; 20 import org.codehaus.xfire.fault.XFireFault; 21 import org.codehaus.xfire.security.wss4j.WSS4JInHandler; 22 */ 23 24 25 /** 26 * 27 * @author Kuali Rice Team (rice.collab@kuali.org) 28 */ 29 30 //TODO: Replace this class with cxf wss4j in interceptor 31 public class XFireWSS4JInHandler{} 32 /* 33 public class XFireWSS4JInHandler extends WSS4JInHandler { 34 35 private static final Logger LOG = Logger.getLogger(XFireWSS4JInHandler.class); 36 private ServiceInfo serviceInfo; 37 38 public XFireWSS4JInHandler(ServiceInfo serviceInfo) { 39 this.serviceInfo = serviceInfo; 40 this.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE); 41 this.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, CryptoPasswordCallbackHandler.class.getName()); 42 this.setProperty(WSHandlerConstants.SIG_KEY_ID, "IssuerSerial"); 43 this.setProperty(WSHandlerConstants.USER, ConfigContext.getCurrentContextConfig().getKeystoreAlias()); 44 } 45 46 @Override 47 public Crypto loadSignatureCrypto(RequestData reqData) { 48 try { 49 return new Merlin(getMerlinProperties(), ClassLoaderUtils.getDefaultClassLoader()); 50 } catch (Exception e) { 51 throw new RiceRuntimeException(e); 52 } 53 } 54 55 @Override 56 public Crypto loadDecryptionCrypto(RequestData reqData) { 57 return loadSignatureCrypto(reqData); 58 } 59 60 protected Properties getMerlinProperties() { 61 Properties props = new Properties(); 62 props.put("org.apache.ws.security.crypto.merlin.keystore.type", "jks"); 63 props.put("org.apache.ws.security.crypto.merlin.keystore.password", ConfigContext.getCurrentContextConfig().getKeystorePassword()); 64 props.put("org.apache.ws.security.crypto.merlin.alias.password", ConfigContext.getCurrentContextConfig().getKeystorePassword()); 65 props.put("org.apache.ws.security.crypto.merlin.keystore.alias", ConfigContext.getCurrentContextConfig().getKeystoreAlias()); 66 props.put("org.apache.ws.security.crypto.merlin.file", ConfigContext.getCurrentContextConfig().getKeystoreFile()); 67 68 if (LOG.isDebugEnabled()) { 69 LOG.debug("Using keystore location " + ConfigContext.getCurrentContextConfig().getKeystoreFile()); 70 } 71 return props; 72 } 73 74 @Override 75 public void invoke(MessageContext context) throws XFireFault { 76 if (getServiceInfo().getServiceDefinition().getBusSecurity()) { 77 super.invoke(context); 78 } 79 } 80 81 public ServiceInfo getServiceInfo() { 82 return serviceInfo; 83 } 84 85 public void setServiceInfo(ServiceInfo serviceInfo) { 86 this.serviceInfo = serviceInfo; 87 } 88 89 } 90 */