我已经创建了我相信您正在努力实现的设置。所以我有 Portal1 和 Portal2。两个门户都设置为通过 idsrv2(thinktecture 身份服务器)对用户进行身份验证,并设置为使用 HRD。idsrv2 设置为通过 HRD 将用户身份验证委托给 idsrv(thinktecture 身份服务器)。
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 的配置(我认为很重要的部分):
最后是 idsrv2 的配置:
以及在 Portal1 上进行身份验证时的最后网络流