Fixing build
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/cadb4e5a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/cadb4e5a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/cadb4e5a Branch: refs/heads/3.0.x-fixes Commit: cadb4e5a19c568f806b03b72b8712c13688307eb Parents: d1c7f42 Author: Colm O hEigeartaigh <[email protected]> Authored: Tue May 12 16:39:53 2015 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Tue May 12 16:39:53 2015 +0100 ---------------------------------------------------------------------- .../wss4j/StaxSecurityContextInInterceptor.java | 12 ++------ .../ws/security/wss4j/WSS4JInInterceptor.java | 30 ++++++-------------- .../policyhandlers/AbstractBindingBuilder.java | 21 +------------- 3 files changed, 12 insertions(+), 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/cadb4e5a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSecurityContextInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSecurityContextInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSecurityContextInInterceptor.java index 1ed5da6..52d8cdb 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSecurityContextInInterceptor.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/StaxSecurityContextInInterceptor.java @@ -90,7 +90,7 @@ public class StaxSecurityContextInInterceptor extends AbstractPhaseInterceptor<S // Now go through the results in a certain order to set up a security context. Highest priority is first. - List<Event> desiredSecurityEvents = new ArrayList<>(); + List<Event> desiredSecurityEvents = new ArrayList<Event>(); desiredSecurityEvents.add(WSSecurityEventConstants.SamlToken); desiredSecurityEvents.add(WSSecurityEventConstants.UsernameToken); desiredSecurityEvents.add(WSSecurityEventConstants.KerberosToken); @@ -129,15 +129,9 @@ public class StaxSecurityContextInInterceptor extends AbstractPhaseInterceptor<S Object receivedAssertion = null; -<<<<<<< HEAD - if (event.getSecurityEventType() == WSSecurityEventConstants.SamlToken) { - String roleAttributeName = (String)msg.getContextualProperty( - SecurityConstants.SAML_ROLE_ATTRIBUTENAME); -======= if (desiredEvent == WSSecurityEventConstants.SamlToken) { - String roleAttributeName = (String)SecurityUtils.getSecurityPropertyValue( - SecurityConstants.SAML_ROLE_ATTRIBUTENAME, msg); ->>>>>>> 44bf65e... [CXF-6401] - Change the order that the set of security results are searched to create a security context + String roleAttributeName = + (String)msg.getContextualProperty(SecurityConstants.SAML_ROLE_ATTRIBUTENAME); if (roleAttributeName == null || roleAttributeName.length() == 0) { roleAttributeName = SAML_ROLE_ATTRIBUTENAME_DEFAULT; } http://git-wip-us.apache.org/repos/asf/cxf/blob/cadb4e5a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java ---------------------------------------------------------------------- diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java index 3549fc5..c29b412 100644 --- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java +++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java @@ -547,24 +547,12 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor { Boolean allowUnsignedSamlPrincipals = MessageUtils.getContextualBoolean(msg, SecurityConstants.ENABLE_UNSIGNED_SAML_ASSERTION_PRINCIPAL, false); - -<<<<<<< HEAD - for (int i = wsResult.size() - 1; i >= 0; i--) { - WSSecurityEngineResult o = wsResult.get(i); - - Integer action = (Integer)o.get(WSSecurityEngineResult.TAG_ACTION); - final Principal p = (Principal)o.get(WSSecurityEngineResult.TAG_PRINCIPAL); - final Subject subject = (Subject)o.get(WSSecurityEngineResult.TAG_SUBJECT); - final boolean useJAASSubject = MessageUtils - .getContextualBoolean(msg, SecurityConstants.SC_FROM_JAAS_SUBJECT, true); - final Object binarySecurity = o.get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN); - - final boolean isValidSamlToken = action == WSConstants.ST_SIGNED - || (allowUnsignedSamlPrincipals && action == WSConstants.ST_UNSIGNED); -======= + final boolean useJAASSubject = MessageUtils + .getContextualBoolean(msg, SecurityConstants.SC_FROM_JAAS_SUBJECT, true); + // Now go through the results in a certain order to set up a security context. Highest priority is first. - List<Integer> resultPriorities = new ArrayList<>(); + List<Integer> resultPriorities = new ArrayList<Integer>(); resultPriorities.add(WSConstants.ST_SIGNED); resultPriorities.add(WSConstants.ST_UNSIGNED); resultPriorities.add(WSConstants.UT); @@ -572,22 +560,20 @@ public class WSS4JInInterceptor extends AbstractWSS4JInterceptor { resultPriorities.add(WSConstants.SIGN); resultPriorities.add(WSConstants.UT_NOPASSWORD); - Map<Integer, List<WSSecurityEngineResult>> actionResults = wsResult.getActionResults(); for (Integer resultPriority : resultPriorities) { if (resultPriority == WSConstants.ST_UNSIGNED && !allowUnsignedSamlPrincipals) { continue; } ->>>>>>> 44bf65e... [CXF-6401] - Change the order that the set of security results are searched to create a security context - List<WSSecurityEngineResult> foundResults = actionResults.get(resultPriority); - if (foundResults != null && !foundResults.isEmpty()) { - for (WSSecurityEngineResult result : foundResults) { + for (WSSecurityEngineResult result : wsResult) { + Integer action = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION); + if (action == resultPriority) { final Object binarySecurity = result.get(WSSecurityEngineResult.TAG_BINARY_SECURITY_TOKEN); PublicKey publickey = (PublicKey)result.get(WSSecurityEngineResult.TAG_PUBLIC_KEY); X509Certificate cert = (X509Certificate)result.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE); - + if ((resultPriority == WSConstants.BST && !(binarySecurity instanceof KerberosSecurity)) || (resultPriority == WSConstants.SIGN && publickey == null && cert == null)) { continue; http://git-wip-us.apache.org/repos/asf/cxf/blob/cadb4e5a/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 5dc29bb..98de4de 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 @@ -918,34 +918,15 @@ public abstract class AbstractBindingBuilder extends AbstractCommonBindingHandle protected String getPassword(String userName, Assertion info, int usage) { //Then try to get the password from the given callback handler -<<<<<<< HEAD CallbackHandler handler = getCallbackHandler(); if (handler == null) { - policyNotAsserted(info, "No callback handler and no password available"); -======= - Object o = SecurityUtils.getSecurityPropertyValue(SecurityConstants.CALLBACK_HANDLER, message); - CallbackHandler handler = null; - try { - handler = SecurityUtils.getCallbackHandler(o); - if (handler == null) { - // Don't unassert for signature as we might get the password from the crypto properties - if (usage == WSPasswordCallback.SIGNATURE) { - LOG.info("No CallbackHandler available to retrieve a password. We will now try the crypto " - + "properties file for a private password"); - } else { - unassertPolicy(info, "No callback handler and no password available"); - } - return null; - } - } catch (Exception ex) { // Don't unassert for signature as we might get the password from the crypto properties if (usage == WSPasswordCallback.SIGNATURE) { LOG.info("No CallbackHandler available to retrieve a password. We will now try the crypto " + "properties file for a private password"); } else { - unassertPolicy(info, "No callback handler and no password available"); + policyNotAsserted(info, "No callback handler and no password available"); } ->>>>>>> a64265c... [CXF-6400] - Make ws-security.callback-handler optional for generating a WS-Security signature return null; }
