Thinktecture Identity Server HRD用于两个客户端APP和不同的返回URL

时间:2014-04-03 10:26:54

标签: thinktecture-ident-server

我已经关注了这篇文章Using IdSrv2 as IP-STS with membership store,并且可以在我的第一个客户端App上使用returnurl正常工作:abc.com/a.aspx在其中一个依赖方&资源。

对于我的场景,我只想创建一个我创建的身份提供程序。这是因为我不想显示我在HRD页面中创建的所有Idendity提供者只想显示我的IDP和来自社交网络的其他idnetity服务(facebook,google +等)。

但是当我登录到我的第二个客户端应用程序时,我遇到它总是返回到abc.com/a.aspx。有没有解决我问题的解决方案?

1 个答案:

答案 0 :(得分:2)

我已经创建了我认为你想要实现的设置。所以我有Portal1和Portal2。两个门户都设置为再次验证用户idsrv2(thinktecture identityserver)并设置为使用HRD。 Idsrv2设置为通过HRD将用户的身份验证委派给idsrv(thinktecture identityserver)。

Portal1 web.config(仅限重要部分)的配置为

<system.identityModel>
        <identityConfiguration>
          <audienceUris>
            <add value="https://localhost/Portal1/" />
          </audienceUris>
          <issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry">
            <authority name="http://idsrv2">
              <keys>
                <add thumbprint="BCD339ECD62BC50DEDA3B54D2236D12AE1217687" />
              </keys>
              <validIssuers>
                <add name="http://idsrv2" />
              </validIssuers>
            </authority>
          </issuerNameRegistry>
          <!--certificationValidationMode set to "None" by the the Identity and Access Tool for Visual Studio. For development purposes.-->
          <certificateValidation certificateValidationMode="None" />
        </identityConfiguration>
    </system.identityModel>
    <system.identityModel.services>
        <federationConfiguration>
          <cookieHandler requireSsl="false" />
          <wsFederation passiveRedirectEnabled="true" issuer="https://localhost/idsrv2/issue/hrd" realm="https://localhost/Portal1/" requireHttps="false" />
        </federationConfiguration>
    </system.identityModel.services>

Portal2的配置(仅限重要部分)是:

<system.identityModel>
    <identityConfiguration>
        <audienceUris>
            <add value="https://localhost/Portal2/" />
        </audienceUris>
        <issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry">
            <authority name="http://idsrv2">
                <keys>
                    <add thumbprint="BCD339ECD62BC50DEDA3B54D2236D12AE1217687" />
                </keys>
                <validIssuers>
                    <add name="http://idsrv2" />
                </validIssuers>
            </authority>
        </issuerNameRegistry>
        <!--certificationValidationMode set to "None" by the the Identity and Access Tool for Visual Studio. For development purposes.-->
        <certificateValidation certificateValidationMode="None" />
    </identityConfiguration>
</system.identityModel>
<system.identityModel.services>
    <federationConfiguration>
        <cookieHandler requireSsl="false" />
        <wsFederation passiveRedirectEnabled="true" issuer="https://localhost/idsrv2/issue/hrd" realm="https://localhost/Portal2/" requireHttps="false" />
    </federationConfiguration>
</system.identityModel.services>

现在,配置idsrv(我相信的部分很重要):

General configuration

Key configuration

WSFederation protocol configuration

Identity Providers

Relaying parties

最后配置idsrv2:

General configuration

Key configuration

WSFederation protocol configuration

Identity providers

Relaying parties

RP for Portal1 configuration

RP for Portal2 configuration

并在Portal1上进行身份验证时持续使用网络流

Network flow