【发布时间】:2023-03-05 00:23:01
【问题描述】:
这是我在这里的第一个问题,所以如果我遗漏了什么或需要提供更多信息,请告诉我!
关键细节:
- C# 4.5
- IIS 7.5 (Win 2008 R2)
- Sitecore 6.6 修订版 130529
我正在尝试将 Sitecore 链接到 Visual Studio Identity and Access Tool 提供的 VS2012 LocalSTS 实例,遵循 Kevin Buckley (link) 的博客文章,该文章是在 WIF 集成到 C# 4.5 之前编写的。我正在尝试执行被动 RP 行为。
我已酌情将Microsoft.IdentityModel 命名空间更新为System.IdentityModel 和System.IdentityModel.Services 命名空间。
我的<system.IdentityModel> 部分如下:
<system.identityModel>
<identityConfiguration>
<audienceUris>
<add value="http://localhost/" />
</audienceUris>
<certificateValidation certificateValidationMode="None" />
<issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry">
<authority name="LocalSTS">
<keys>
<add thumbprint="9B74CB2F320F7AAFC156E1252270B1DC01EF40D0" />
</keys>
<validIssuers>
<add name="LocalSTS" />
</validIssuers>
</authority>
</issuerNameRegistry>
</identityConfiguration>
我的<system.identityModel.services>如下:
<system.identityModel.services>
<federationConfiguration>
<cookieHandler requireSsl="false" />
<wsFederation passiveRedirectEnabled="true"
issuer="http://localhost:14691/wsFederationSTS/Issue"
realm="http://localhost/"
reply="http://localhost/sitecore modules/fedauthenticator/sso"
requireHttps="false" />
</federationConfiguration>
</system.identityModel.services>
我已经在<system.webServer><modules>下添加了相关模块(WSFederationAuthenticationModule、SessionAuthenticationModule):
<add type="Sitecore.Web.RewriteModule, Sitecore.Kernel"
name="SitecoreRewriteModule" />
<add type="Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus"
name="SitecoreHttpModule" />
<add name="WSFederationAuthenticationModule"
type="System.IdentityModel.Services.WSFederationAuthenticationModule,
System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
preCondition="managedHandler" />
<add name="SessionAuthenticationModule"
type="FedAuthenticator.Authentication.WSSessionAuthenticationModule,
FedAuthenticator"
preCondition="managedHandler" />
我看到的行为如下:
- 用户导航到受 Sitecore 保护的页面
- WIF FAM 模块触发并在 EndRequest 处确定返回 401 状态
- WIF FAM 根据设置重定向到 LocalSTS IdP(使用适当的查询字符串)
- Javascript 自动提交表单 - 我已在浏览器中禁用 JS 以进行测试,但它可以工作
- LocalSTS 页面 POST 到
reply属性中指定的 URL,并在表单的wresult字段中使用令牌信息
这就是问题发生的地方。我的理解是,FAM 挂钩 AuthenticateRequest 事件,然后继续检测安全令牌(通过 wa 和 wresult 表单字段的存在和值)并解码 SSO 令牌。
我的问题是这永远不会发生 - 我已启用跟踪并覆盖 WSFederationAuthenticationModule 进行检查,虽然它第一次正确检测到事件并调用 CreateSignInRequest 和 RedirectToIdentityProvider 步骤,但随后的 POST 到该站点(包含令牌)不会触发 AuthenticateRequest,因此 FAM 不会检测、创建 cookie 或将正确的 IPrincipal 分配给请求。
这会导致无限循环,其中请求收到 401,被 302 重定向到 LocalSTS SSO 页面,该页面提交、POST 到 Sitecore SSO 页面,该页面提供 401,等等。
谁能提供一些关于我遗漏的东西的见解,或者任何其他可能阻碍 FAM 检测带有令牌信息的 POST 请求的东西?
【问题讨论】:
标签: sitecore single-sign-on saml-2.0