use of org.apache.cxf.ws.policy.AssertionInfoMap in project cxf by apache.
the class AbstractCommonBindingHandler method getWss10.
protected Wss10 getWss10() {
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
AssertionInfo ai = PolicyUtils.getFirstAssertionByLocalname(aim, SPConstants.WSS10);
if (ai == null) {
ai = PolicyUtils.getFirstAssertionByLocalname(aim, SPConstants.WSS11);
}
if (ai != null) {
return (Wss10) ai.getAssertion();
}
return null;
}
use of org.apache.cxf.ws.policy.AssertionInfoMap in project cxf by apache.
the class AbstractCommonBindingHandler method unassertPolicy.
protected void unassertPolicy(Assertion assertion, Exception reason) {
if (assertion == null) {
return;
}
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Not asserting " + assertion.getName() + ": " + reason);
}
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
Collection<AssertionInfo> ais = aim.get(assertion.getName());
if (ais != null) {
for (AssertionInfo ai : ais) {
if (ai.getAssertion() == assertion) {
ai.setNotAsserted(reason.getMessage());
}
}
}
if (!assertion.isOptional()) {
throw new PolicyException(new Message(reason.getMessage(), LOG), reason);
}
}
use of org.apache.cxf.ws.policy.AssertionInfoMap in project cxf by apache.
the class AbstractCommonBindingHandler method assertAlgorithmSuite.
protected void assertAlgorithmSuite(AlgorithmSuite algorithmSuite) {
if (algorithmSuite == null) {
return;
}
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
Collection<AssertionInfo> algorithmSuiteAis = aim.get(algorithmSuite.getName());
for (AssertionInfo ai : algorithmSuiteAis) {
ai.setAsserted(true);
}
AlgorithmSuiteType algorithmSuiteType = algorithmSuite.getAlgorithmSuiteType();
String namespace = algorithmSuiteType.getNamespace();
if (namespace != null) {
Collection<AssertionInfo> algAis = aim.get(new QName(namespace, algorithmSuiteType.getName()));
if (algAis != null) {
for (AssertionInfo algAi : algAis) {
algAi.setAsserted(true);
}
}
}
}
use of org.apache.cxf.ws.policy.AssertionInfoMap in project tdi-studio-se by Talend.
the class WspPolicyInterceptor method handleMessage.
public void handleMessage(SoapMessage message) throws Fault {
AssertionInfoMap aim = (AssertionInfoMap) message.get(AssertionInfoMap.class);
if (null == aim) {
return;
}
QName qname = QNamesCollection.POLICY_WSP;
Collection<AssertionInfo> ais = (Collection<AssertionInfo>) aim.get(qname);
if ((null == ais) || (ais.size() == 0)) {
return;
}
for (AssertionInfo ai : ais) {
ai.setAsserted(true);
}
}
use of org.apache.cxf.ws.policy.AssertionInfoMap in project cxf by apache.
the class AbstractRMInterceptorTest method testAssertReliability.
@Test
public void testAssertReliability() {
RMInterceptor interceptor = new RMInterceptor();
Message message = control.createMock(Message.class);
EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(null);
AssertionInfoMap aim = control.createMock(AssertionInfoMap.class);
Collection<AssertionInfo> ais = new ArrayList<>();
EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim).times(2);
PolicyAssertion a = control.createMock(PolicyAssertion.class);
AssertionInfo ai = new AssertionInfo(a);
EasyMock.expectLastCall();
control.replay();
interceptor.assertReliability(message);
assertFalse(ai.isAsserted());
aim.put(RM10Constants.RMASSERTION_QNAME, ais);
interceptor.assertReliability(message);
assertFalse(ai.isAsserted());
ais.add(ai);
interceptor.assertReliability(message);
}
Aggregations