var certbase = _env.IsDevelopment() ? "" : AppDomain.CurrentDomain.BaseDirectory;
var pathpfx = Path.Combine(certbase, "xxxxx.pfx");
var pathxml = Path.Combine(certbase, "metadata.xml");
.AddSaml2(options =>
{
options.SPOptions.EntityId = new EntityId("https://aaaa.aaa.com.tr");
options.SPOptions.ReturnUrl = new Uri("https://localhost:5003/Account/SignInPost");
options.SPOptions.MinIncomingSigningAlgorithm =
"http://www.w3.org/2000/09/xmldsig#rsa-sha1";
options.IdentityProviders.Add(
new IdentityProvider(
new EntityId("https://bbbbb.bbb.com.tr"), options.SPOptions)
{
MetadataLocation = pathxml,
LoadMetadata = true,
SingleSignOnServiceUrl = new Uri("https://bbbbb.bbb.com.tr/SAML/SSOService.aspx"),
Binding = Sustainsys.Saml2.WebSso.Saml2Binding.UriToSaml2BindingType(new
Uri("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect")),
SingleLogoutServiceUrl = new Uri("https://bbbbb.bbb.com.tr/SAML/SLOService.aspx"),
});
options.SPOptions.ServiceCertificates.Add(new X509Certificate2(pathpfx, "password"));
});
我的 saml 工作正常,但我不知道发生了什么,我的代码现在无法工作。
当我在 Chrome 上运行代码时出现此错误 =>
UnexpectedInResponseToException:收到的消息 _55ae387d-0b1e-4466-9b2b-d34a5254437c 包含意外的 InResponseTo“iddfcfd98961654500864ee897d823ce87”。未找到保存请求状态的 cookie,因此该消息不应具有 InResponseTo 属性。如果执行 SP 启动的登录时设置的 cookie 丢失,通常会发生此错误。
我的metadata.xml没问题
我的pfx也还可以。
我已经寻找解决我的问题超过两天了,但我找不到任何可以帮助我的东西。您对解决这个问题有何建议?你可以帮帮我吗?
堆栈内部
UnexpectedInResponseToException: Received message _63021ef9-2b93-4b0a-ab75-88d42e8a4c9c contains unexpected InResponseTo "idc0faf551a5bf421da3a9e582b57f685a". No cookie preserving state from the request was found so the message was not expected to have an InResponseTo attribute. This error typically occurs if the cookie set when doing SP-initiated sign on have been lost.
Sustainsys.Saml2.Saml2P.Saml2Response.ValidateInResponseTo(IOptions options, IEnumerable<ClaimsIdentity> claimsIdentities)
Sustainsys.Saml2.Saml2P.Saml2Response.GetClaims(IOptions options, IDictionary<string, string> relayData)
Sustainsys.Saml2.WebSso.AcsCommand.ProcessResponse(IOptions options, Saml2Response samlResponse, StoredRequestState storedRequestState, IdentityProvider identityProvider, string relayState)
Sustainsys.Saml2.WebSso.AcsCommand.Run(HttpRequestData request, IOptions options)
Sustainsys.Saml2.AspNetCore2.Saml2Handler.HandleRequestAsync()
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)