return null;
}
}
protected AssertionWrapper addSamlToken(SamlToken token) throws WSSecurityException {
AssertionInfo info = null;
Collection<AssertionInfo> ais = aim.getAssertionInfo(token.getName());
for (AssertionInfo ai : ais) {
if (ai.getAssertion() == token) {
info = ai;
if (!isRequestor()) {
info.setAsserted(true);
return null;
}
}
}
//
// Get the SAML CallbackHandler
//
Object o = message.getContextualProperty(SecurityConstants.SAML_CALLBACK_HANDLER);
if (o == null && message.getContextualProperty(SecurityConstants.TOKEN) != null) {
SecurityToken securityToken = (SecurityToken)message.getContextualProperty(SecurityConstants.TOKEN);
Element tokenElement = (Element)securityToken.getToken();
String namespace = tokenElement.getNamespaceURI();
String localname = tokenElement.getLocalName();
if ((token.isUseSamlVersion11Profile10() || token.isUseSamlVersion11Profile11())
&& WSConstants.SAML_NS.equals(namespace) && "Assertion".equals(localname)) {
return new AssertionWrapper(tokenElement);
} else if (token.isUseSamlVersion20Profile11()
&& WSConstants.SAML2_NS.equals(namespace) && "Assertion".equals(localname)) {
return new AssertionWrapper(tokenElement);
}
}
CallbackHandler handler = null;
if (o instanceof CallbackHandler) {
handler = (CallbackHandler)o;
} else if (o instanceof String) {
try {
handler = (CallbackHandler)ClassLoaderUtils
.loadClass((String)o, this.getClass()).newInstance();
} catch (Exception e) {
handler = null;
}
}
if (handler == null) {
policyNotAsserted(token, "No SAML CallbackHandler available");
return null;
}
SAMLParms samlParms = new SAMLParms();
samlParms.setCallbackHandler(handler);
if (token.isUseSamlVersion11Profile10() || token.isUseSamlVersion11Profile11()) {
samlParms.setSAMLVersion(SAMLVersion.VERSION_11);
} else if (token.isUseSamlVersion20Profile11()) {
samlParms.setSAMLVersion(SAMLVersion.VERSION_20);
}
info.setAsserted(true);
AssertionWrapper assertion = new AssertionWrapper(samlParms);
boolean selfSignAssertion =
MessageUtils.getContextualBoolean(
message, SecurityConstants.SELF_SIGN_SAML_ASSERTION, false