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