use of org.apache.cxf.ws.policy.AssertionBuilderRegistry in project OpenAM by OpenRock.
the class SoapSTSConsumer method addAMSessionTokenSupport.
/**
* This method registers the AMSessionToken AssertionBuilder and InterceptorProvider required to consume a sts instance
* protected by a SecurityPolicy binding specifying OpenAMToken Assertions.
*/
private void addAMSessionTokenSupport() {
PolicyInterceptorProviderRegistry pipr = bus.getExtension(PolicyInterceptorProviderRegistry.class);
pipr.register(new OpenAMSessionTokenClientInterceptorProvider());
AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
abr.setIgnoreUnknownAssertions(false);
abr.registerBuilder(AMSTSConstants.AM_SESSION_TOKEN_ASSERTION_QNAME, new OpenAMSessionTokenClientAssertionBuilder(callbackHander));
}
use of org.apache.cxf.ws.policy.AssertionBuilderRegistry 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.AssertionBuilderRegistry in project cxf by apache.
the class WSRMP12PolicyLoader method registerBuilders.
public void registerBuilders() {
AssertionBuilderRegistry reg = bus.getExtension(AssertionBuilderRegistry.class);
if (reg == null) {
return;
}
reg.registerBuilder(new RM12AssertionBuilder());
}
use of org.apache.cxf.ws.policy.AssertionBuilderRegistry 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.AssertionBuilderRegistry in project OpenAM by OpenRock.
the class SoapSTSLifecycleImpl method registerCustomPolicyInterceptors.
/*
This method will register the OpenAMSessionToken AssertionBuilder and InterceptorProvider instances with the cxf
Bus, so that any OpenAMSessionToken SecurityPolicy bindings in any of the published soap-sts instances can be
supported. Note that this registration is global to all soap-sts instances published in this realm, as the AssertionBuilderRegistry
and the PolicyInterceptorProviderRegistry are global to a cxf Bus, and thus to a cxf deployment. This does not cause
problems however, as the OpenAM session validation which is consumed as part of realizing this interceptor context
is specific only to a realm, and each soap-sts deployment is realm specific (as it corresponds to a soap-sts-agent,
which is also realm-specific.) Note, however, if we wanted to support OpenID Connect ID tokens, then a global
interceptor would have to be registered which would ultimately consult sts-instance-specific state corresponding to the
authN context which would validate this OIDC id token, and the key used to look-up this instance-specific
state from the global interceptor would be the last url constituent of the soap-sts invocation (including any realm
elements), as this is the soap-sts-instance identifier.
*/
private void registerCustomPolicyInterceptors() {
final boolean createIfNecessary = false;
final Bus bus = BusFactory.getDefaultBus(createIfNecessary);
final PolicyInterceptorProviderRegistry policyInterceptorProviderRegistry = bus.getExtension(PolicyInterceptorProviderRegistry.class);
policyInterceptorProviderRegistry.register(openAMSessionTokenServerInterceptorProvider);
AssertionBuilderRegistry assertionBuilderRegistry = bus.getExtension(AssertionBuilderRegistry.class);
assertionBuilderRegistry.registerBuilder(AMSTSConstants.AM_SESSION_TOKEN_ASSERTION_QNAME, new OpenAMSessionTokenServerAssertionBuilder());
}
Aggregations