message, SecurityConstants.MUST_UNDERSTAND, true
);
String actor = (String)message.getContextualProperty(SecurityConstants.ACTOR);
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 = null;
try {
el = secHeader.insertSecurityHeader(saaj.getSOAPPart());
} catch (WSSecurityException e) {
throw new SoapFault(
new Message("SECURITY_FAILED", LOG), e, message.getVersion().getSender()
);
}
try {
//move to end
SAAJUtils.getHeader(saaj).removeChild(el);
SAAJUtils.getHeader(saaj).appendChild(el);
} catch (SOAPException e) {
//ignore
}
WSSConfig config = (WSSConfig)message.getContextualProperty(WSSConfig.class.getName());
if (config == null) {
config = WSSConfig.getNewInstance();
}
translateProperties(message, config);
String asymSignatureAlgorithm =
(String)message.getContextualProperty(SecurityConstants.ASYMMETRIC_SIGNATURE_ALGORITHM);
if (asymSignatureAlgorithm != null && transport.getAlgorithmSuite() != null) {
transport.getAlgorithmSuite().setAsymmetricSignature(asymSignatureAlgorithm);
}
if (transport instanceof TransportBinding) {
new TransportBindingHandler(config, (TransportBinding)transport, saaj,
secHeader, aim, message).handleBinding();
} else if (transport instanceof SymmetricBinding) {
new SymmetricBindingHandler(config, (SymmetricBinding)transport, saaj,
secHeader, aim, message).handleBinding();
} else {
new AsymmetricBindingHandler(config, (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);
}
}