【问题标题】:NTLM authentication for OpenRastaOpenRasta 的 NTLM 身份验证
【发布时间】:2012-03-13 17:08:09
【问题描述】:

根据我之前关于 OpenRasta 身份验证的question,我想知道是否可以为在 IIS 外作为可执行文件运行的 OpenRasta 服务配置 NTLM 身份验证。

干杯。

【问题讨论】:

    标签: restful-authentication ntlm openrasta


    【解决方案1】:

    抱歉,我没有仔细阅读这个问题。不幸的是,我不相信您可以开箱即用地做到这一点。 OpenRasta 提供了一个 HttpListenerHost,它将 System.Net.HttpListener 实例封装为 private 变量。请参阅this forum thread 中的代码以了解如何在控制台应用程序中使用HttpListenerHost。如果HttpListener 变量是public 或至少是protected,那么按照以下代码行设置AuthenticationSchemes 属性应该很简单:

    var host = new HttpListenerHost();
    host.Listener.AuthenticationSchemes = AuthenticationSchemes.Ntlm;
    

    如果您确实需要此功能,您可以获取 OpenRasta 的源代码并对其进行更新以公开底层 HttpListener 变量,以便您可以根据自己的喜好对其进行配置。

    ====================>> IIS 的原始答案:

    首先,您创建一个为 OpenRasta 配置的标准 WebForms 或 MVC 项目,如 Getting Start wiki page. 中所示。接下来,如 Wrox article 中所述配置项目以支持 Windows 身份验证。支持 Windows 身份验证将同时启用NTLM & Kerberos 身份验证。

    【讨论】:

    • 在 IIS 位上,您如何在您的应用程序中检索安全上下文,它会在 ICommunicationContext 上可用吗?谢谢
    • 我想我可以为您指出访问 ICommunicationContext 的正确方向,但我现在没有时间检查它。这个blog post 显示了 OpenRasta 2.1 中的扩展点,可以在管道中访问 ICommunicationContext。
    • 谢谢 Sixto,我知道如何获取 ICommunicationContext,我的问题是用户凭据是否可用,如果没有,我该如何获取它们?
    • HttpListenerCommunicationContext 有一个 User 属性,该属性具有凭据,但当 OpenRasta 启动时,我不知道 ASP.NET 下存在哪个 ICommunicationObject 实现。您可以在调试模式下检查以深入了解 ICommunicationContext 实例以获取类似属性。
    • 在 HttpListener 和 asp.net 中,ICommunicationContext.User 属性设置为来自托管环境的任何流,身份验证模块也是如此。
    猜你喜欢
    • 1970-01-01
    • 2011-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多