}
}
private List<WSSecurityEngineResult> processToken(Element tokenElement, final SoapMessage message)
throws WSSecurityException {
SAMLTokenProcessor p = new SAMLTokenProcessor();
WSDocInfo wsDocInfo = new WSDocInfo(tokenElement.getOwnerDocument());
RequestData data = new RequestData() {
public CallbackHandler getCallbackHandler() {
return getCallback(message);
}
public Validator getValidator(QName qName) throws WSSecurityException {
String key = null;
if (WSSecurityEngine.SAML_TOKEN.equals(qName)) {
key = SecurityConstants.SAML1_TOKEN_VALIDATOR;
} else if (WSSecurityEngine.SAML2_TOKEN.equals(qName)) {
key = SecurityConstants.SAML2_TOKEN_VALIDATOR;
}
if (key != null) {
Object o = message.getContextualProperty(key);
try {
if (o instanceof Validator) {
return (Validator)o;
} else if (o instanceof Class) {
return (Validator)((Class<?>)o).newInstance();
} else if (o instanceof String) {
return (Validator)ClassLoaderUtils.loadClass(o.toString(),
SamlTokenInterceptor.class)
.newInstance();
}
} catch (RuntimeException t) {
throw t;
} catch (Throwable t) {
throw new WSSecurityException(t.getMessage(), t);
}
}
return super.getValidator(qName);
}
};
data.setWssConfig(WSSConfig.getNewInstance());
List<WSSecurityEngineResult> results =
p.handleToken(tokenElement, data, wsDocInfo);
return results;
}