use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder in project cxf by apache.
the class SHA512PolicyLoader method getAlgorithmSuite.
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<QName, Assertion> 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);
}
use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder in project cxf by apache.
the class Wsdl11AttachmentPolicyProviderTest method setUp.
@Before
public void setUp() {
control = EasyMock.createNiceControl();
bus = control.createMock(Bus.class);
bus.getExtension(ConfiguredBeanLocator.class);
EasyMock.expectLastCall().andReturn(null).anyTimes();
AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
abr.setIgnoreUnknownAssertions(false);
PrimitiveAssertionBuilder ab = new PrimitiveAssertionBuilder();
abr.registerBuilder(new QName("http://cxf.apache.org/test/assertions", "A"), ab);
abr.registerBuilder(new QName("http://cxf.apache.org/test/assertions", "B"), ab);
abr.registerBuilder(new QName("http://cxf.apache.org/test/assertions", "C"), ab);
PolicyBuilderImpl pb = new PolicyBuilderImpl();
bus.getExtension(PolicyBuilder.class);
EasyMock.expectLastCall().andReturn(pb).anyTimes();
bus.getExtension(PolicyEngine.class);
EasyMock.expectLastCall().andReturn(null).anyTimes();
pb.setAssertionBuilderRegistry(abr);
app = new Wsdl11AttachmentPolicyProvider();
app.setBuilder(pb);
app.setRegistry(new PolicyRegistryImpl());
control.replay();
}
use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder in project cxf by apache.
the class PolicyBuilderTest method setUp.
@Before
public void setUp() {
builder = new PolicyBuilderImpl();
AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
builder.setAssertionBuilderRegistry(abr);
PrimitiveAssertionBuilder ab = new PrimitiveAssertionBuilder();
abr.registerBuilder(new QName("http://sample.org/Assertions", "A"), ab);
abr.registerBuilder(new QName("http://sample.org/Assertions", "B"), ab);
abr.registerBuilder(new QName("http://sample.org/Assertions", "C"), ab);
}
use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder in project cxf by apache.
the class NormalizeTest method createBuilder.
private PolicyBuilderImpl createBuilder(Bus bus) {
PolicyBuilderImpl builder = new PolicyBuilderImpl();
builder.setBus(bus);
AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
builder.setAssertionBuilderRegistry(abr);
PrimitiveAssertionBuilder ab = new PrimitiveAssertionBuilder();
abr.registerBuilder(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityToken"), ab);
abr.registerBuilder(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityHeader"), ab);
abr.registerBuilder(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "Integrity"), ab);
abr.registerBuilder(new QName("http://sample.org/Assertions", "A"), ab);
abr.registerBuilder(new QName("http://sample.org/Assertions", "B"), ab);
abr.registerBuilder(new QName("http://sample.org/Assertions", "C"), ab);
return builder;
}
use of org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder in project cxf by apache.
the class MGF256AlgorithmSuiteLoader method getAlgorithmSuite.
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<QName, Assertion> assertions = new HashMap<>();
QName qName = new QName(ns, "Basic256GCMMGFSHA256");
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 GCMAlgorithmSuite(version, nestedPolicy);
}
Aggregations