boolean mustUnderstand = true;
String actor = null;
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
// extract Assertion information
if (aim != null) {
Binding transport = null;
ais = aim.get(SP12Constants.TRANSPORT_BINDING);
if (ais != null) {
for (AssertionInfo ai : ais) {
transport = (Binding)ai.getAssertion();
ai.setAsserted(true);
}
}
ais = aim.get(SP12Constants.ASYMMETRIC_BINDING);
if (ais != null) {
for (AssertionInfo ai : ais) {
transport = (Binding)ai.getAssertion();
ai.setAsserted(true);
}
}
ais = aim.get(SP12Constants.SYMMETRIC_BINDING);
if (ais != null) {
for (AssertionInfo ai : ais) {
transport = (Binding)ai.getAssertion();
ai.setAsserted(true);
}
}
if (transport == null && isRequestor(message)) {
transport = new TransportBinding(SP12Constants.INSTANCE,
message.getExchange().getBus()
.getExtension(PolicyBuilder.class));
}
if (transport != null) {
WSSecHeader secHeader = new WSSecHeader(actor, mustUnderstand);
Element el = secHeader.insertSecurityHeader(saaj.getSOAPPart());
try {
//move to end
saaj.getSOAPHeader().removeChild(el);
saaj.getSOAPHeader().appendChild(el);
} catch (SOAPException e) {
//ignore
}
if (transport instanceof TransportBinding) {
new TransportBindingHandler((TransportBinding)transport, saaj,
secHeader, aim, message).handleBinding();
} else if (transport instanceof SymmetricBinding) {
new SymmetricBindingHandler((SymmetricBinding)transport, saaj,
secHeader, aim, message).handleBinding();
} else {
new AsymmetricBindingHandler((AsymmetricBinding)transport, saaj,
secHeader, aim, message).handleBinding();
}
if (el.getFirstChild() == null) {
el.getParentNode().removeChild(el);
}
}
ais = aim.get(SP12Constants.WSS10);
if (ais != null) {
for (AssertionInfo ai : ais) {
ai.setAsserted(true);
}
}
ais = aim.get(SP12Constants.WSS11);
if (ais != null) {
for (AssertionInfo ai : ais) {
ai.setAsserted(true);
}
}