通过SAML2的Sitecore SSO-AuthenticateRequest未触发

通过SAML2的Sitecore SSO-AuthenticateRequest未触发,sitecore,single-sign-on,saml-2.0,Sitecore,Single Sign On,Saml 2.0,这是我在这里的第一个问题,如果我遗漏了什么或需要提供更多信息,请告诉我 主要详情: C#4.5 IIS 7.5(Win 2008 R2) Sitecore 6.6修订版130529 我试图将Sitecore链接到VisualStudio提供的VS2012 LocalSTS实例,这是Kevin Buckley()在WIF集成到C#4.5之前写的一篇博文。我正在尝试执行被动RP行为 我已将Microsoft.IdentityModel名称空间更新为System.IdentityModel和Sys

这是我在这里的第一个问题,如果我遗漏了什么或需要提供更多信息,请告诉我

主要详情:

  • C#4.5
  • IIS 7.5(Win 2008 R2)
  • Sitecore 6.6修订版130529
我试图将Sitecore链接到VisualStudio提供的VS2012 LocalSTS实例,这是Kevin Buckley()在WIF集成到C#4.5之前写的一篇博文。我正在尝试执行被动RP行为

我已将
Microsoft.IdentityModel
名称空间更新为
System.IdentityModel
System.IdentityModel.Services
名称空间(视情况而定)

我的
部分如下:

<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>
    <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.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>
    <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>

我已在
下添加了相关模块(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页面使用表单的
    wresult
    字段中的令牌信息发布到
    reply
    属性中指定的URL
这就是问题所在。我的理解是,FAM钩住
AuthenticateRequest
事件,然后继续检测安全令牌(通过
wa
wresult
表单字段的存在和值)并解码SSO令牌

我的问题是这种情况从未发生过-我已启用跟踪并覆盖了
WSFederationAuthenticationModule
以进行检查,尽管它第一次正确检测到事件并调用
CreateSignInRequest
RedirectToIdentityProvider
步骤,但随后发布到站点(包含令牌)不会触发AuthenticateRequest,因此FAM不会检测、创建cookie或为请求分配正确的IPrincipal

这导致了一个无休止的循环,其中请求接收401,302重定向到LocalSTS SSO页面,该页面提交、发布到Sitecore SSO页面,该页面提供401,等等


有人能提供一些关于我遗漏的信息,或者任何可能妨碍FAM检测带有令牌信息的POST请求的信息吗?

令人尴尬的是,回答我自己的问题-出现这种情况的原因是,
response
参数将SSO表单POST定向到一个URL,Sitecore通过重定向到NotFound页面来响应该URL(即Sitecore将POST目标解析为不存在)

由于NotFound页面没有任何安全性,AuthenticateRequest没有启动

我还没有弄清楚NotFound页面导致重定向回SSO页面的原因-但至少现在,一旦我纠正了
响应
配置字段中的错误值,FAM就会检测到令牌,并正确处理后续模块(SAM等)

编辑-找到重定向循环的原因

重定向循环是由web.config中的错误设置引起的,如下所示:

<authorization>
  <deny users="?"/>
</authorization>

这意味着令牌被发布到NotFound页面,Sitecore显然拦截了请求,因此没有触发FAM,因此用户没有经过身份验证。这导致401响应代码(由于deny语句)启动SSO重定向-创建循环