我不知道如何使现有的旧ASP.NET MVC 4应用程序(基于声明的身份验证,Windows身份基础,ws-federation,旧的thinktecture身份服务器)使用带有WS-Federation插件的新Identity Server 4。是否需要使用OWIN中间件替换WIF的身份验证和会话模块,如here所述或同时使用两者?
这是来自web.config的配置:
<httpModules>
<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>
<audienceUris>
<add value="https://localhost/" />
</audienceUris>
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true" issuer="https://localhost/LoginEndpoint/issue/wsfed" realm="https://localhost/" requireHttps="false" />
<cookieHandler requireSsl="true" hideFromScript="true" />
</federatedAuthentication>
<applicationService>
<claimTypeRequired>
<claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" optional="true" />
<claimType type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" optional="true" />
</claimTypeRequired>
</applicationService>
<issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<trustedIssuers>
<add thumbprint="XXXXXXXXXXXX" name="https://localhost/LoginEndpoint/" />
</trustedIssuers>
</issuerNameRegistry>
<certificateValidation certificateValidationMode="None" />
<serviceCertificate>
<!--Needed for cookie encyption in web-farm environment. -->
<certificateReference x509FindType="FindByThumbprint" findValue="XXXXXXXXXXXXXXXXX" />
</serviceCertificate>
</service>
</microsoft.identityModel>
任何帮助将不胜感激!甚至建议是否有更好的框架或方法可用于现有的SSO解决方案,可以与旧的ASP.NET MVC 4客户端一起使用。
在客户端,您可以使用OWIN stack。
请注意,这是.NET Core,但原则是相同的。
如果您愿意,您仍然可以使用WIF。您只需要更改IDP URL和wtrealm参数。
在服务器端,您需要Rock Solid Knowledge WS-Fed插件。
关注这个approach。
另一种方法是更改为idsrv4支持开箱即用的OpenID Connect。
这里有一个很好的walk-through。