cxf git commit: Adding WS-Security tests for SHA-512
Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 9d7c9508b -> a2f2eb7e2 Adding WS-Security tests for SHA-512 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a2f2eb7e Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a2f2eb7e Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a2f2eb7e Branch: refs/heads/3.1.x-fixes Commit: a2f2eb7e29e3632ecae740f1edf8d4c05689f24b Parents: 9d7c950 Author: Colm O hEigeartaigh Authored: Thu Sep 22 11:52:54 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Sep 22 11:56:04 2016 +0100 -- .../cxf/systest/ws/x509/SHA512PolicyLoader.java | 117 +++ .../cxf/systest/ws/x509/X509TokenTest.java | 28 - .../cxf/systest/ws/x509/DoubleItX509.wsdl | 63 ++ .../org/apache/cxf/systest/ws/x509/client.xml | 14 +++ .../org/apache/cxf/systest/ws/x509/server.xml | 13 +++ .../apache/cxf/systest/ws/x509/stax-server.xml | 14 +++ 6 files changed, 248 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/a2f2eb7e/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/SHA512PolicyLoader.java -- diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/SHA512PolicyLoader.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/SHA512PolicyLoader.java new file mode 100644 index 000..09872d5 --- /dev/null +++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/SHA512PolicyLoader.java @@ -0,0 +1,117 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.systest.ws.x509; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.w3c.dom.Element; +import org.apache.cxf.Bus; +import org.apache.cxf.ws.policy.AssertionBuilderRegistry; +import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion; +import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder; +import org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteLoader; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.Policy; +import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder; +import org.apache.wss4j.dom.WSConstants; +import org.apache.wss4j.policy.SPConstants; +import org.apache.wss4j.policy.model.AbstractSecurityAssertion; +import org.apache.wss4j.policy.model.AlgorithmSuite; + +/** + * This class retrieves the default AlgorithmSuites plus a custom AlgorithmSuite with the RSA SHA-512 + * signature + */ +public class SHA512PolicyLoader implements AlgorithmSuiteLoader { + +public SHA512PolicyLoader(Bus bus) { +bus.setExtension(this, AlgorithmSuiteLoader.class); +} + +public AlgorithmSuite getAlgorithmSuite(Bus bus, SPConstants.SPVersion version, Policy nestedPolicy) { +AssertionBuilderRegistry reg = bus.getExtension(AssertionBuilderRegistry.class); +if (reg != null) { +String ns = "http://cxf.apache.org/custom/security-policy";; +final Map assertions = new HashMap(); +QName qName = new QName(ns, "Basic128RsaSha512"); +assertions.put(qName, new PrimitiveAssertion(qName)); + +reg.registerBuilder(new PrimitiveAssertionBuilder(assertions.keySet()) { +public Assertion build(Element element, AssertionBuilderFactory fact) { +if (XMLPrimitiveAssertionBuilder.isOptional(element) +|| XMLPrimitiveAssertionBuilder.isIgnorable(element)) { +return super.build(element, fact); +} +QName q = new QName(element.getNamespaceURI(), element.getLocalName()); +return assertions.get(q); +} +}); +} +return new SHA512AlgorithmSuite(version, nestedPolicy); +} + +public static class
cxf git commit: Adding WS-Security tests for SHA-512
Repository: cxf Updated Branches: refs/heads/master f66dea949 -> a5df4ba24 Adding WS-Security tests for SHA-512 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a5df4ba2 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a5df4ba2 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a5df4ba2 Branch: refs/heads/master Commit: a5df4ba24a2f967a0434b9eaa7363f90838f9343 Parents: f66dea9 Author: Colm O hEigeartaigh Authored: Thu Sep 22 11:52:54 2016 +0100 Committer: Colm O hEigeartaigh Committed: Thu Sep 22 11:52:54 2016 +0100 -- .../cxf/systest/ws/x509/SHA512PolicyLoader.java | 117 +++ .../cxf/systest/ws/x509/X509TokenTest.java | 28 - .../cxf/systest/ws/x509/DoubleItX509.wsdl | 63 ++ .../org/apache/cxf/systest/ws/x509/client.xml | 14 +++ .../org/apache/cxf/systest/ws/x509/server.xml | 13 +++ .../apache/cxf/systest/ws/x509/stax-server.xml | 14 +++ 6 files changed, 248 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cxf/blob/a5df4ba2/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/SHA512PolicyLoader.java -- diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/SHA512PolicyLoader.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/SHA512PolicyLoader.java new file mode 100644 index 000..09872d5 --- /dev/null +++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/SHA512PolicyLoader.java @@ -0,0 +1,117 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.systest.ws.x509; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.w3c.dom.Element; +import org.apache.cxf.Bus; +import org.apache.cxf.ws.policy.AssertionBuilderRegistry; +import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion; +import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder; +import org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteLoader; +import org.apache.neethi.Assertion; +import org.apache.neethi.AssertionBuilderFactory; +import org.apache.neethi.Policy; +import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder; +import org.apache.wss4j.dom.WSConstants; +import org.apache.wss4j.policy.SPConstants; +import org.apache.wss4j.policy.model.AbstractSecurityAssertion; +import org.apache.wss4j.policy.model.AlgorithmSuite; + +/** + * This class retrieves the default AlgorithmSuites plus a custom AlgorithmSuite with the RSA SHA-512 + * signature + */ +public class SHA512PolicyLoader implements AlgorithmSuiteLoader { + +public SHA512PolicyLoader(Bus bus) { +bus.setExtension(this, AlgorithmSuiteLoader.class); +} + +public AlgorithmSuite getAlgorithmSuite(Bus bus, SPConstants.SPVersion version, Policy nestedPolicy) { +AssertionBuilderRegistry reg = bus.getExtension(AssertionBuilderRegistry.class); +if (reg != null) { +String ns = "http://cxf.apache.org/custom/security-policy";; +final Map assertions = new HashMap(); +QName qName = new QName(ns, "Basic128RsaSha512"); +assertions.put(qName, new PrimitiveAssertion(qName)); + +reg.registerBuilder(new PrimitiveAssertionBuilder(assertions.keySet()) { +public Assertion build(Element element, AssertionBuilderFactory fact) { +if (XMLPrimitiveAssertionBuilder.isOptional(element) +|| XMLPrimitiveAssertionBuilder.isIgnorable(element)) { +return super.build(element, fact); +} +QName q = new QName(element.getNamespaceURI(), element.getLocalName()); +return assertions.get(q); +} +}); +} +return new SHA512AlgorithmSuite(version, nestedPolicy); +} + +public static class SHA512Alg