【问题标题】:ASP.NET MVC bypass/simulate ws-federation/claims-based authenticationASP.NET MVC 绕过/模拟 ws-federation/基于声明的身份验证
【发布时间】:2015-01-30 19:05:53
【问题描述】:

在我们的 ASP.NET MVC 5 项目中,我们已将应用程序设置为使用 ws-federation 身份验证和 Azure 访问控制。

摘自我们的 Web.config:

...   
<system.identityModel.services>
    <federationConfiguration>
      <cookieHandler requireSsl="false" persistentSessionLifetime="30:0:0" />
      <wsFederation passiveRedirectEnabled="true" realm="http://our-realm/.../" reply="http://localhost/" requireHttps="false" issuer="https://ourissuername.accesscontrol.windows.net/v2/wsfederation" />
    </federationConfiguration>
</system.identityModel.services>
...
<modules runAllManagedModulesForAllRequests="true">
  <remove name="FormsAuthentication" />
  <add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
  ...
</modules>
...

在应用程序的后期,我们依赖 ClaimsPrincipal.Current.Identity.IsAuthenticated 并拥有所有必需的声明,至少是电子邮件地址。

出于压力测试的目的,我们希望使用我们的自定义声明模拟硬编码的ClaimsPrincipal(例如,通过运行一些仅适用于此配置的自定义代码)并绕过整个 wsfederation 过程,尤其是整个重定向。例如,我们可以只删除 WSFederationAuthenticationModule 并能够跳过 ws-federation 过程,但我不知道如何提供自己的 ClaimsPrincipal

任何提示如何以最少的努力解决这个问题? (最少的努力,因为它不会用于生产等)

【问题讨论】:

    标签: c# asp.net-mvc wif claims-based-identity ws-federation


    【解决方案1】:

    您是否查看过 Visual Studio 身份和访问工具插件 (https://visualstudiogallery.msdn.microsoft.com/e21bf653-dfe1-4d81-b3d3-795cb104066e)?它有开发 STS 服务来提供虚假的身份验证信息进行测试。

    【讨论】:

    • 谢谢,是的,我知道,但它不会绕过整个重定向过程,我希望摆脱它,如果没有它,压力测试场景会工作得更好
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-29
    • 1970-01-01
    • 2013-07-20
    • 2014-04-14
    • 2016-03-07
    • 2019-08-09
    • 2019-01-01
    相关资源
    最近更新 更多