【发布时间】:2021-10-08 19:56:47
【问题描述】:
我正在尝试使用基于声明的身份验证对我们的内部 STS 服务器构建一个 asp.net 4.7 (v4.5 WIF)。我们有较旧的工作 .Net 应用程序 (
问题在于新应用从不联系 STS 服务器。
我推测失败在于我如何设置联合 web.config 与旧版本。这是我最新的配置,不工作,然后是使用旧身份进程 (WIF 3.5) 工作的配置。
V4.0 WIF web.config(新 4.7 项目)
<system.identityModel>
<identityConfiguration>
<audienceUris>
<add value="urn:jabberwocky" />
</audienceUris>
<issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<trustedIssuers>
<add thumbprint="{MyThumbprint}" name="https://{MyIssuerURL}" />
</trustedIssuers>
</issuerNameRegistry>
<certificateValidation certificateValidationMode="None" />
</identityConfiguration>
</system.identityModel>
<system.identityModel.services>
<federationConfiguration>
<cookieHandler requireSsl="false" />
<wsFederation passiveRedirectEnabled="true"
issuer="https://{MySTSUrl}"
realm="urn:jabberwocky"
reply="http://localhost:44301/"
requireHttps="true" />
</federationConfiguration>
</system.identityModel.services>
V3.5 WIF web.config(旧 4.0 项目)
<microsoft.identityModel>
<service>
<audienceUris>
<add value="urn:Jabberwocky" />
</audienceUris>
<certificateValidation certificateValidationMode="None" />
<claimsAuthenticationManager type="{Namespace}.MyAuthenticationManager, {Namespace}" />
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true"
issuer="https://{MySTSUrl}"
requireHttps="true"
realm="urn:Jabberwocky" />
<cookieHandler requireSsl="true" />
</federatedAuthentication>
<issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<trustedIssuers>
<add thumbprint="{MyThumbprint}" name="https://{MyIssuerURL}" />
</trustedIssuers>
</issuerNameRegistry>
</service>
</microsoft.identityModel>
- 我知道它不会命中 STS 服务器,因为我使用了无效的
audienceUris值作为测试,而且我不会像在旧项目中那样被服务器拒绝。 - 我感觉这与旧版本中缺少
federatedAuthentication值有关,但在新版本中找不到。
【问题讨论】:
-
如果你想控制正在发生的事情,我建议切换到程序化方法。看看我的教程wiktorzychla.com/2014/11/…至于你当前的配置,确保SAM和FAM模块也都在那里。
-
@WiktorZychla 将该建议作为答案,我会这样标记它。正如我在您的网站上所指出的,我需要 FAM 和 SAM。
-
至于您在我的博客条目下的评论,如果您遵循我的编程方法,则 web.config 中不需要 FAM。它只需要在 web.config 中用于静态、声明性方法,就像你的一样。
-
知道了,只有在非程序化的情况下才有意义。
标签: c# wif .net-4.7.2 sts claims-authentication