我有一个配置为受 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>
提前致谢。
问候,