Fixing merge
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/edbadd5a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/edbadd5a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/edbadd5a Branch: refs/heads/3.0.x-fixes Commit: edbadd5a9e980694106979e85221714e600f8b7c Parents: efe0365 Author: Colm O hEigeartaigh <[email protected]> Authored: Mon Aug 17 17:08:06 2015 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Mon Aug 17 17:08:06 2015 +0100 ---------------------------------------------------------------------- .../cxf/ws/security/wss4j/WSS4JUtils.java | 58 ++++---------------- .../policyhandlers/AbstractBindingBuilder.java | 26 --------- .../cxf/sts/operation/AbstractOperation.java | 18 ------ 3 files changed, 12 insertions(+), 90 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/edbadd5a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java index 387fb56..5ff2500 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JUtils.java @@ -24,11 +24,7 @@ import java.net.URL; import java.security.Key; import java.security.cert.X509Certificate; import java.util.Date; -<<<<<<< HEAD -======= import java.util.List; -import java.util.Map; ->>>>>>> 17dbc12... Consolidate some code in WS-Security/STS import java.util.Properties; import javax.crypto.SecretKey; @@ -55,13 +51,9 @@ import org.apache.wss4j.common.crypto.Crypto; import org.apache.wss4j.common.crypto.CryptoFactory; import org.apache.wss4j.common.crypto.PasswordEncryptor; import org.apache.wss4j.common.ext.WSSecurityException; -<<<<<<< HEAD -======= -import org.apache.wss4j.common.util.Loader; import org.apache.wss4j.dom.WSConstants; import org.apache.wss4j.dom.WSSecurityEngineResult; import org.apache.wss4j.dom.handler.WSHandlerResult; ->>>>>>> 17dbc12... Consolidate some code in WS-Security/STS import org.apache.wss4j.stax.ext.WSSConstants; import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants; import org.apache.xml.security.exceptions.XMLSecurityException; @@ -363,36 +355,6 @@ public final class WSS4JUtils { return CryptoFactory.getInstance(propFilename, classLoader); } -<<<<<<< HEAD -======= - public static Crypto getSignatureCrypto( - Object s, - SoapMessage message, - PasswordEncryptor passwordEncryptor - ) throws WSSecurityException { - Crypto signCrypto = null; - if (s instanceof Crypto) { - signCrypto = (Crypto)s; - } else if (s != null) { - URL propsURL = SecurityUtils.loadResource(message, s); - Properties props = WSS4JUtils.getProps(s, propsURL); - if (props == null) { - LOG.fine("Cannot find Crypto Signature properties: " + s); - Exception ex = new Exception("Cannot find Crypto Signature properties: " + s); - throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex); - } - - signCrypto = CryptoFactory.getInstance(props, Loader.getClassLoader(CryptoFactory.class), - passwordEncryptor); - - EndpointInfo info = message.getExchange().getEndpoint().getEndpointInfo(); - synchronized (info) { - info.setProperty(SecurityConstants.SIGNATURE_CRYPTO, signCrypto); - } - } - return signCrypto; - } - /** * Get the certificate that was used to sign the request */ @@ -402,20 +364,24 @@ public final class WSS4JUtils { } for (WSHandlerResult rResult : results) { - List<WSSecurityEngineResult> signedResults = - rResult.getActionResults().get(WSConstants.SIGN); + List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults(); - if (signedResults != null && !signedResults.isEmpty()) { - for (WSSecurityEngineResult signedResult : signedResults) { - if (signedResult.containsKey(WSSecurityEngineResult.TAG_X509_CERTIFICATE)) { - return (X509Certificate)signedResult.get( - WSSecurityEngineResult.TAG_X509_CERTIFICATE); + if (wsSecEngineResults != null && !wsSecEngineResults.isEmpty()) { + for (WSSecurityEngineResult wser : wsSecEngineResults) { + Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION); + if (actInt.intValue() == WSConstants.SIGN) { + X509Certificate cert = + (X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE); + if (cert != null) { + return cert; + } } } + } } return null; } ->>>>>>> 17dbc12... Consolidate some code in WS-Security/STS } + http://git-wip-us.apache.org/repos/asf/cxf/blob/edbadd5a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java index 6a992cb..0bbcff7 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java @@ -1627,32 +1627,6 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle return encrUser; } -<<<<<<< HEAD - private static X509Certificate getReqSigCert(List<WSHandlerResult> results) { - /* - * Scan the results for a matching actor. Use results only if the - * receiving Actor and the sending Actor match. - */ - for (WSHandlerResult rResult : results) { - List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults(); - /* - * Scan the results for the first Signature action. Use the - * certificate of this Signature to set the certificate for the - * encryption action :-). - */ - for (WSSecurityEngineResult wser : wsSecEngineResults) { - Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION); - if (actInt.intValue() == WSConstants.SIGN) { - return (X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE); - } - } - } - - return null; - } - -======= ->>>>>>> 17dbc12... Consolidate some code in WS-Security/STS /** * Scan through <code>WSHandlerResult<code> list for a Username token and return * the username if a Username Token found http://git-wip-us.apache.org/repos/asf/cxf/blob/edbadd5a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java index f91edee..d64501f 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java @@ -543,27 +543,9 @@ public abstract class AbstractOperation { List<WSHandlerResult> results = (List<WSHandlerResult>) context.get(WSHandlerConstants.RECV_RESULTS); // DOM -<<<<<<< HEAD - if (results != null) { - for (WSHandlerResult rResult : results) { - List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults(); - for (WSSecurityEngineResult wser : wsSecEngineResults) { - int wserAction = - ((java.lang.Integer)wser.get(WSSecurityEngineResult.TAG_ACTION)).intValue(); - if (wserAction == WSConstants.SIGN) { - X509Certificate cert = - (X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE); - if (cert != null) { - return cert; - } - } - } - } -======= X509Certificate cert = WSS4JUtils.getReqSigCert(results); if (cert != null) { return cert; ->>>>>>> 17dbc12... Consolidate some code in WS-Security/STS } // Streaming
