You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2014/06/04 15:39:54 UTC
git commit: Allow a KeyValueToken policy with no child Policy Element
Repository: cxf
Updated Branches:
refs/heads/2.7.x-fixes d32a83895 -> d0c1bcf2f
Allow a KeyValueToken policy with no child Policy Element
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d0c1bcf2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d0c1bcf2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d0c1bcf2
Branch: refs/heads/2.7.x-fixes
Commit: d0c1bcf2fe373979e5e1c3c659ecd2d2c6ccdae6
Parents: d32a838
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Jun 4 14:39:16 2014 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Jun 4 14:39:16 2014 +0100
----------------------------------------------------------------------
.../policy/builders/KeyValueTokenBuilder.java | 25 +++++++++++---------
1 file changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/d0c1bcf2/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java
----------------------------------------------------------------------
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java
index d53dd13..b49f229 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java
@@ -18,10 +18,13 @@
*/
package org.apache.cxf.ws.security.policy.builders;
+import java.util.logging.Logger;
+
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
+import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.ws.policy.PolicyConstants;
@@ -35,6 +38,7 @@ import org.apache.neethi.builders.AssertionBuilder;
public class KeyValueTokenBuilder implements AssertionBuilder<Element> {
private static final String MS_NS = "http://schemas.microsoft.com/ws/2005/07/securitypolicy";
+ private static final Logger LOG = LogUtils.getL7dLogger(KeyValueTokenBuilder.class);
public KeyValueTokenBuilder() {
}
@@ -62,19 +66,18 @@ public class KeyValueTokenBuilder implements AssertionBuilder<Element> {
Element polEl = PolicyConstants.findPolicyElement(element);
if (polEl == null) {
- throw new IllegalArgumentException(
- "sp:KeyValueToken/wsp:Policy must have a value"
- );
- }
-
- token.setPolicy(polEl);
- Element child = DOMUtils.getFirstElement(polEl);
- if (child != null) {
- QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
- if ("RsaKeyValue".equals(qname.getLocalPart())) {
- token.setForceRsaKeyValue(true);
+ LOG.warning("sp:KeyValueToken/wsp:Policy should have a value!");
+ } else {
+ token.setPolicy(polEl);
+ Element child = DOMUtils.getFirstElement(polEl);
+ if (child != null) {
+ QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
+ if ("RsaKeyValue".equals(qname.getLocalPart())) {
+ token.setForceRsaKeyValue(true);
+ }
}
}
+
return token;
}