这是 Jboss 6.4 附带的 Picketlink Federation 2.5.4 SP4 类 org.picketlink.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler 的摘录(2.5.4 SP4 的 picketlink.org github 上没有标签?)。我的问题是第一行 request.getRequestDocument() 返回 null。对象本身,请求(SAML2HandlerRequest)看起来很好(不为空):
public void handleStatusResponseType(SAML2HandlerRequest request, SAML2HandlerResponse response)
throws ProcessingException {
HTTPContext httpContext = (HTTPContext) request.getContext();
ResponseType responseType = (ResponseType) request.getSAML2Object();
(...)
Document responseDocument = request.getRequestDocument();
Element assertionElement =
DocumentUtil.getChildElement(responseDocument.getDocumentElement(),
new QName(JBossSAMLConstants.ASSERTION.get()));
if (assertionElement != null) {
try {
Document assertionDocument = DocumentUtil.createDocument();
Node clonedAssertion = assertionElement.cloneNode(true);
assertionDocument.adoptNode(clonedAssertion);
assertionDocument.appendChild(clonedAssertion);
String assertionAttributeName = (String) handlerConfig
.getParameter(GeneralConstants.ASSERTION_SESSION_ATTRIBUTE_NAME);
if (assertionAttributeName != null) {
session.setAttribute(assertionAttributeName, assertionDocument);
}
session.setAttribute(GeneralConstants.ASSERTION_SESSION_ATTRIBUTE_NAME, assertionDocument);
} catch (ConfigurationException e) {
throw new ProcessingException("Could not store assertion document into session.", e);
}
}
仅供参考,我需要此文档的原因是,正如您在代码中看到的那样,如果 responseDocument 为 null,则 asserionElement 为 null。如果 assertionElement 为空,那么我的 SAML 令牌将不在给定键下的 HTTPSession 中,这就是我所需要的。
身份提供者是 PingIdentity。在我必须学习整个 PicketLink 代码库之前,这里可能会发生什么提示或技巧?
谢谢!
仅供参考,我的设置是 jboss 6.4,带有它附带的纠察链接(2.5.4 SP4),带有用于 SAML 令牌(IdP)的 PingIdentity。仅供参考,一切都在从 WebApp 1 到 WebApp 2 的 SSO 场景中工作,唯一的事情是我需要从 WebApp 2 上的 SSO 会话中获取 SAML 令牌......