我正在使用Sustainsys软件包Sustainsys.Saml2.AspNetCore2
在ASP.NET Core 3.1中构建服务提供商Web应用程序,该应用程序使用SAML2
使用Azure B2C作为身份提供程序。我有以下问题:
如果我使用Sha1
作为签名算法,并使用选项MinIncomingSigningAlgorithm
,则CryptoConfig.CreateFromName
会引发异常,因为该方法不知道{{1} }算法。
如果我使用Sha1
作为签名算法,则即使我在自定义Sha256
中指定了Sha1
,Azure B2C仍会用<Item Key="XmlSignatureAlgorithm">Sha256</Item>
签名响应政策。 我应该注意,这似乎只有在服务提供商启动单个注销流程时才会发生。登录流程完成无问题,并且签名算法为RelyingParty
。这是我的RelyingParty部分:
Sha256
此外,Azure B2C的元数据使用 <RelyingParty>
<DefaultUserJourney ReferenceId="SignUpOrSignIn" />
<TechnicalProfile Id="PolicyProfile">
<DisplayName>PolicyProfile</DisplayName>
<Protocol Name="SAML2"/>
<Metadata>
<Item Key="XmlSignatureAlgorithm">Sha256</Item>
</Metadata>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="displayName" />
<OutputClaim ClaimTypeReferenceId="givenName" />
</OutputClaims>
<SubjectNamingInfo ClaimType="objectId" ExcludeAsClaim="true"/>
</TechnicalProfile>
</RelyingParty>
作为签名和摘要方法。这是相关的部分:
Sha256
我们非常感谢您的帮助。谢谢。
答案 0 :(得分:1)
事实证明,我还需要将<Item Key="XmlSignatureAlgorithm">Sha256</Item>
添加到技术配置文件中(如上所述,它是RelyingParty的一部分)。这解决了我单次退出时遇到的问题。
<TechnicalProfile Id="Saml2AssertionIssuer">
<Protocol Name="None"/>
<OutputTokenFormat>SAML2</OutputTokenFormat>
<Metadata>
<Item Key="XmlSignatureAlgorithm">Sha256</Item>
</Metadata>
</TechnicalProfile>