【发布时间】:2015-02-20 07:24:49
【问题描述】:
我有一个签名的 AuthnRequest,当我将 saml 请求发送到 ADFS 时,会发生以下错误:
Microsoft.IdentityServer.Protocols.Saml.HttpSamlMessageException: MSIS7015:此请求不包含预期的协议消息 或根据 HTTP SAML 发现不正确的协议参数 协议绑定。在 Microsoft.IdentityServer.Web.HttpSamlMessageFactory.CreateMessage(HttpContext httpContext) 在 Microsoft.IdentityServer.Web.FederationPassiveContext.EnsureCurrent(HttpContext 上下文)
这是我签名的 AuthnRequest:
<?xml version="1.0"?>
<samlp:AuthnRequest xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Version="2.0" Destination="https://xadfs.xxx.com/adfs/ls/" ID="idde801c3623e24a46ac1b8249dadc6d49" IssueInstant="2014-12-22T07:05:33.7751472Z" AssertionConsumerServiceURL="http://sp.com/" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" IsPassive="false">
<saml:Issuer>https:/sp.com</saml:Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#idde801c3623e24a46ac1b8249dadc6d49">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>exOnraFOscgGqGJ730P1o7e0hsc=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>...Signature...</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>...Cert...</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
<samlp:NameIDPolicy AllowCreate="True" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient"/>
<samlp:RequestedAuthnContext Comparison="exact">
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext>
</samlp:AuthnRequest>
这是我的 POST 请求:
POST https://xadfs.xxx.com/adfs/ls/ HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Referer: https://sp.com/
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: xadfs.xxx.com
Content-Length: 3924
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: MSISIPSelectionPersistent=aHR0...
SAMLRequest=request&RelayState=token
你能告诉我我的 saml 请求有什么问题吗?
我有一个 MVC SP 并使用 SAML2 Nuget 包。
【问题讨论】:
-
很难说,您确定事件监视器中没有更多信息吗?如果没有,您可以尝试在 adfs 上设置更高的日志级别
-
您好,我知道是什么导致了问题,但仍然不知道如何解决。 NameIdPolicy (
) 解决了问题,当我删除它时,我得到了 saml 响应从 ADFS。有人可以解释一下如何添加 NameId 吗?
标签: c# asp.net-mvc-4 saml-2.0 adfs2.0 codeplex