如何禁用 WSO2 身份服务器的目标参数检查 samlp:AuthnRequest?

Joh*_*ade 1 wso2is

尝试在 wso2 Identity Server 5.0.0 + Service Packs 和第 3 方服务提供商之间设置 SAML。面临与另一个堆栈跟踪问题类似的问题, 除了 SP 无法将 Destination 参数添加到他们的 samlp:AuthnRequest 之外。

更具体。我收到的 samlp:AuthnRequest 如下所示:

<samlp:AuthnRequest
AssertionConsumerServiceURL='https://schoolname.academicworks.com/saml/callback'
ID='_388406f0-3581-0133-2bea-0610df7af2db'
IssueInstant='2015-09-04T22:21:32Z'
Version='2.0'
xmlns:samlp='urn:oasis:names:tc:SAML:2.0:protocol'>
<saml:Issuer xmlns:saml='urn:oasis:names:tc:SAML:2.0:assertion'>https://schoolname.academicworks.com/saml-sp</saml:Issuer>
<samlp:NameIDPolicy AllowCreate='true' Format='urn:oasis:names:tc:SAML:2.0:nameid-format:persistent' xmlns:samlp='urn:oasis:names:tc:SAML:2.0:protocol'/>
</samlp:AuthnRequest>
Run Code Online (Sandbox Code Playgroud)

此请求缺少 Destination 参数。有了这个请求,wso2 身份服务器会记录以下信息,并且 SAML 登录失败:

TID: [0] [IS] [2015-09-04 17:46:56,471]  WARN {org.wso2.carbon.identity.sso.saml.processors.SPInitSSOAuthnRequestProcessor} -  Destination validation for Authentication Request failed. Received: [null]. Expected: [https://ourhostname.ourschool.edu:443/samlsso] {org.wso2.carbon.identity.sso.saml.processors.SPInitSSOAuthnRequestProcessor}
Run Code Online (Sandbox Code Playgroud)

我在 SAML 文档中找不到任何需要 Destination 参数的地方,但 Identity Server 似乎确实这么认为。正如我参考的帖子所指出的,这个检查可以在源代码中找到

public class AuthnRequestProcessor
<snip>
// Validate 'Destination'
String idpUrl = IdentityUtil.getProperty(IdentityConstants.ServerConfig.SSO_IDP_URL);
if (authnReqDTO.getDestination() == null
                    || !idpUrl.equals(authnReqDTO.getDestination())) {
                String msg = "Destination validation for Authentication Request failed. " +
                                    "Received: [" + authnReqDTO.getDestination() + "]." +
                                            " Expected: [" + idpUrl + "]";
                log.warn(msg);
                return buildErrorResponse(authnReqDTO.getId(),
                        SAMLSSOConstants.StatusCodes.REQUESTOR_ERROR, msg);
}
Run Code Online (Sandbox Code Playgroud)

这是在文件中:components/identity/org.wso2.carbon.identity.sso.saml/4.2.1/src/main/java/org/wso2/carbon/identity/sso/saml/processors/AuthnRequestProcessor.java

我可以破解源代码以删除对 null 的检查,但随后我将永远维护它。有人遇到过这个吗?任何可用的解决方法?服务提供商无法添加此参数。

提前致谢,

约翰

Joh*_*ade 6

呃,答案是:如果 samlp:AuthnRequest 未签名,请确保取消选中服务提供商 -> 入站身份验证 -> SAML2 Web SSO 配置 -> 服务提供商页面上的“在身份验证请求中启用签名验证”复选框。

该错误具有欺骗性,因为您会认为它会因缺少的签名而吠叫,但我猜缺少的 Destination 参数是它遇到的第一个错误。

希望在这里张贴这个可以避免其他人的悲伤。