1

再会,

我们使用了 ITfoxtec 库版本 1.2.2。该解决方案正常工作。

我们现在正在集成 4.0.5 版库。我们需要使用 SHA-256 编码。我们使用了 Nugets 的 4.0.5 库。根据实现示例https://github.com/ITfoxtec/ITfoxtec.Identity.Saml2

我们在 中更改AccountController、添加App_Start \ IdentityConfig.cs和添加了IdentityConfig.RegisterIdentity()调用Global.asax

问题:提供程序请求中缺少 SigAlg 和 Signature 参数。

1.2.2版本库ITfoxtec、SAML tracker

4.0.5版本库ITfoxtec、SAML tracker

我们设置参数:

  • "Saml2:IdPMetadata" = "/App_Data/metadata.xml"
  • "Saml2:Issuer" value = "http://xxx"
  • "Saml2:SignatureAlgorithm" = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
  • "Saml2:SingleSignOnDestination" = "https://yyy/oamfed/idp/samlv20"
  • "Saml2:SingleLogoutDestination" = "https://yyy/oamfed/idp/samlv20"
  • "Saml2:SigningCertificateFingerPrint" = "5d223463130bd1e290f1ae8dc064d1c48ab517c2"
  • "Saml2:CertificateValidationMode" = "None"
  • "Saml2:RevocationMode" = "NoCheck"

该参数"Saml2:SigningCertificateFingerPrint"是自定义参数,我们从本地存储加载证书:

Saml2Configuration.SigningCertificate = CertificateUtil.Load (StoreName.My, StoreLocation.LocalMachine, X509FindType.FindByThumbprint, ConfigurationManager.AppSettings.Get ("Saml2: SigningCertificateFingerPrint"));

问题:为什么请求中缺少 SigAlg 和 Signature 参数?配置不好?执行不好?

请帮忙 嗯谢谢DM

4

1 回答 1

1

默认情况下,SAML 2.0 不需要对 Authn 请求进行签名(注销请求需要通过签名)。因此,ITfoxtec Identity Saml2包在请求中默认不包含 SigAlg 和 Signature 参数。

要签署 Authn 请求,请Saml2Configuration.SignAuthnRequest = true在代码或配置中设置"Saml2:SignAuthnRequest" = "true"

已编辑 - 从元数据中读取

Saml2Configuration.SignAuthnRequest可以从 IDP 元数据中设置WantAuthnRequestsSigned

.NET 框架示例代码:

if(entityDescriptor.IdPSsoDescriptor.WantAuthnRequestsSigned.HasValue) {
    Saml2Configuration.SignAuthnRequest = entityDescriptor.IdPSsoDescriptor.WantAuthnRequestsSigned.Value; 
}

.NET 框架示例IdentityConfig.cs

.NET Core 示例Startup.cs

于 2020-07-13T08:53:22.170 回答