【问题标题】:ADFS and Anonymous access to pathADFS 和匿名访问路径
【发布时间】:2016-02-25 13:55:05
【问题描述】:

我有一个配置为受 ADFS 保护的 Web 应用程序。它工作完美。我现在唯一的问题是我需要一条特定的匿名路径。

例子:

myapp.com/services/api -> 应受 adfs 保护。

myapp.com/services/myPublicPath -> 不应受 adfs 保护。

我不太确定如何实现这一点。我尝试在 web.config 上使用位置标签,但运气不佳.. 整个站点由 adfs 保护.. 我不知道如何创建异常。

这是我的 web.config。

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301879
  -->
<configuration>
  <configSections>
    <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
  </configSections>
  <appSettings>
  </appSettings>
  <connectionStrings>
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5" />
    <customErrors mode="Off"></customErrors>
    <authorization>
      <deny users="?" />
    </authorization>
  </system.web>
  <system.webServer>
    <modules>
      <remove name="FormsAuthentication" />
      <remove name="UrlRoutingModule-4.0" />
      <add name="WSFederationAuthenticationModule" />
      <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
    </modules>
    <handlers>
    </handlers>
  </system.webServer>
  <location path="FederationMetadata">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <location path="oauth">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <runtime>
  </runtime>
  <system.identityModel>
    <identityConfiguration>
      <securityTokenHandlers>
      </securityTokenHandlers>
      <audienceUris>
      </audienceUris>
      <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      </issuerNameRegistry>

      <certificateValidation certificateValidationMode="None" />
    </identityConfiguration>
  </system.identityModel>

  <system.identityModel.services>

    <federationConfiguration>
    </federationConfiguration>
  </system.identityModel.services>
</configuration>

提前致谢。

问候,

【问题讨论】:

  • 位置标签正常工作 - 你的是什么样的?
  • @nzpcmad 谢谢。我添加了 web.config 设置

标签: c# .net asp.net-web-api iis-7 adfs3.0


【解决方案1】:

“myapp.com/services/myPublicPath -> 不应受 adfs 保护。”

所以位置应该是这样的:

<location path="services/myPublicPath "> 
    <system.web>
        <authorization>
            <allow users="?"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-17
    • 2013-04-11
    • 2011-08-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多