仅在localhost域上具有无限循环的WIF 3.5问题

时间:2014-11-28 19:38:06

标签: asp.net wif

当我在localhost上运行我的应用程序时,应用程序在身份验证过程中进入无限循环,更具体地说,当从STS发出令牌并在RP上接收时,请求返回到STS并且此过程无限重复。

我的RP网站的web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
        <add name="WSFederationAuthenticationModule" type="Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
        <add name="SessionAuthenticationModule" type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
    </modules>
    <system.web>
        <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </assemblies>
        </compilation>
        <httpModules>
          <add name="Session" type="System.Web.SessionState.SessionStateModule" />
          <add name="WSFederationAuthenticationModule" type="Microsoft.IdentityModel.Web.WSFederationAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          <add name="SessionAuthenticationModule" type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        </httpModules>
        <microsoft.identityModel>
            <service>
                <certificateValidation certificateValidationMode="None" />

                <issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
                    <trustedIssuers>
                      <add thumbprint="*VALUE*" name="CertficateName" />
                    </trustedIssuers>
                </issuerNameRegistry>

                <audienceUris>
                    <add value="http://localhost/RP/" />
                </audienceUris>

                <federatedAuthentication>
                    <wsFederation
                        issuer="http://localhost/STS/"
                        realm="http://localhost/RP/"
                        reply="http://localhost/RP/"
                        requireHttps="false"
                        persistentCookiesOnPassiveRedirects="true" />
                    <cookieHandler
                        mode="Default"
                        domain="localhost"
                        hideFromScript="false"
                        name="FedAuthCookie"
                        path="/RP/"
                        requireSsl="false"
                        persistentSessionLifetime="60.0:0:0" />
                </federatedAuthentication>
            </service>
        </microsoft.identityModel>
</configuration>

奇怪的是,在完全相同的配置下,该应用适用于http://test.com/RPhttp://test.com/RP/等域,但不适用于http://localhost/RPhttp://localhost/RP/

我既没有在事件查看器中也没有在运行时出现错误,令牌由STS发出,但可能由于某种原因它没有被RP应用或接受。

0 个答案:

没有答案