001 /** 002 * Copyright 2005-2012 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.ksb.config.xfire; 017 018 /* 019 import org.codehaus.xfire.MessageContext; 020 import org.codehaus.xfire.security.wss4j.WSS4JOutHandler; 021 */ 022 023 024 /** 025 * 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 */ 028 029 //TODO: Replace this class with a cxf wss4j out interceptor 030 public class XFireWSS4JOutHandler {} 031 032 /* 033 public class XFireWSS4JOutHandler extends WSS4JOutHandler { 034 035 private static final Logger LOG = Logger.getLogger(XFireWSS4JOutHandler.class); 036 037 private ServiceInfo serviceInfo; 038 039 public XFireWSS4JOutHandler(ServiceInfo serviceInfo) { 040 this.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE); 041 this.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, CryptoPasswordCallbackHandler.class.getName()); 042 this.setProperty(WSHandlerConstants.SIG_KEY_ID, "IssuerSerial"); 043 this.setProperty(WSHandlerConstants.USER, ConfigContext.getCurrentContextConfig().getKeystoreAlias()); 044 this.serviceInfo = serviceInfo; 045 } 046 047 @Override 048 public Crypto loadSignatureCrypto(RequestData reqData) { 049 try { 050 return new Merlin(getMerlinProperties(), ClassLoaderUtils.getDefaultClassLoader()); 051 } catch (Exception e) { 052 throw new RiceRuntimeException(e); 053 } 054 } 055 056 @Override 057 public Crypto loadDecryptionCrypto(RequestData reqData) { 058 return loadSignatureCrypto(reqData); 059 } 060 061 protected Properties getMerlinProperties() { 062 Properties props = new Properties(); 063 props.put("org.apache.ws.security.crypto.merlin.keystore.type", "jks"); 064 props.put("org.apache.ws.security.crypto.merlin.keystore.password", ConfigContext.getCurrentContextConfig().getKeystorePassword()); 065 props.put("org.apache.ws.security.crypto.merlin.alias.password", ConfigContext.getCurrentContextConfig().getKeystorePassword()); 066 props.put("org.apache.ws.security.crypto.merlin.keystore.alias", ConfigContext.getCurrentContextConfig().getKeystoreAlias()); 067 props.put("org.apache.ws.security.crypto.merlin.file", ConfigContext.getCurrentContextConfig().getKeystoreFile()); 068 069 if (LOG.isDebugEnabled()) { 070 LOG.debug("Using keystore location " + ConfigContext.getCurrentContextConfig().getKeystoreFile()); 071 } 072 073 return props; 074 } 075 076 @Override 077 public void invoke(MessageContext context) throws Exception { 078 if (getServiceInfo().getServiceDefinition().getBusSecurity()) { 079 super.invoke(context); 080 } 081 } 082 083 public ServiceInfo getServiceInfo() { 084 return serviceInfo; 085 } 086 087 public void setServiceInfo(ServiceInfo serviceInfo) { 088 this.serviceInfo = serviceInfo; 089 } 090 091 } 092 */