【问题标题】:Securing ELMAH while yet making it possible to access it via RSS Reader保护 ELMAH,同时还可以通过 RSS 阅读器访问它
【发布时间】:2009-06-25 20:58:54
【问题描述】:

我们在应用程序中使用 ELMAH 错误异常日志记录。我想保护 ELMAH 不受普通用户的影响,同时仍可供应用程序的管理员/开发人员使用。

当您在 web.config 中使用表单身份验证设置安全性时,您将无法访问 RSS 提要。我希望能够保护 ELMAH,但仍然通过对 axd 的身份验证,以便能够从 RSS 阅读器访问 RSS 提要(即 /elmah.axd/rss)。

认为 http 身份验证是正确的,因为那时我可能可以使用以下 url 语法 http://username:password@somedomain.com/elmah.axd/rss 访问 rss 提要,我假设您需要在 web.config 中的特定路径上设置身份验证模式 =“windows” .一个问题是如何在虚拟文件上设置凭据?

看看 Google 会带回这个 article on CodeProject,了解如何使用 cookie 设置身份验证传递。这是解决我问题的好方法吗?

是否有其他更好的方法可以更好地访问 RSS 提要同时仍然安全?

谢谢。

【问题讨论】:

    标签: asp.net security web-config windows-authentication elmah


    【解决方案1】:

    Supporting HTTP Authentication and Forms Authentication in a Single ASP.NET Web Site

    基本上,您将一个名为 MADAM 的 dll 添加到您的项目中,调整您的 web.config 并配置您希望将哪些文件作为 Basic 而不是 Forms 进行身份验证:

    <configuration>
        <configSections>
            <sectionGroup name="madam">
                <section name="userSecurityAuthority" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                <section name="formsAuthenticationDisposition" type="Madam.FormsAuthenticationDispositionSectionHandler, Madam" />
            </sectionGroup>
        </configSections>
    
        ...
    
        <madam>
            <userSecurityAuthority ... />
    
            <formsAuthenticationDisposition>
                <discriminators all="[true|false]">
                    ...
                </discriminators>
            </formsAuthenticationDisposition>
        </madam>
    
        ...
    
        <system.web>
            <httpModules>
                <add name="FormsAuthenticationDisposition" type="Madam.FormsAuthenticationDispositionModule, Madam" />
                <add name="AuthenticationModule" type="MADAM Authentication Module Type" />
        </system.web>
    </configuration>
    

    这很容易设置并解决了我能够验证 elmah.axd 并且仍然能够使用基本身份验证凭据订阅 RSS 提要的问题。

    旁注 MADAM 是由写 ELMAH 的同一个人写的,巧合吗?

    【讨论】:

      【解决方案2】:

      取决于我猜的客户-我知道some desktop readers(当然其他人也这样做)支持需要身份验证的提要,并在首次请求时提供一个登录框-不确定他们在幕后做什么但它可以工作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-28
        • 2023-03-23
        • 2015-02-24
        • 1970-01-01
        • 2019-07-11
        • 1970-01-01
        • 1970-01-01
        • 2020-03-02
        相关资源
        最近更新 更多