【问题标题】:Windows Service hosted ServiceStack and Windows Authentication?Windows 服务托管 ServiceStack 和 Windows 身份验证?
【发布时间】:2013-08-22 09:47:13
【问题描述】:

我有一个 Windows 服务,它公开了一些使用 Windows 身份验证和 AD 角色限制访问的 WCF 服务。

其中一项服务是针对当前作为 MMC(Microsoft 管理控制台)管理单元实现的管理客户端的服务。

我想为使用 ServiceStack 和 Razorplugin 实现的基于浏览器的仪表板更改此设置。

开箱即用的 ServiceStack 不支持自托管服务的 Windows 身份验证。

以前有人做过吗?是否可以?例如在 ServiceStack 插件中实现类似的东西?

更新: 我可以像这样在我的 AppHostHttpListenerBase 派生的 AppHost 上启用 Windows 身份验证。

public override void Start(string urlBase)
{
            if (Listener == null)
            {
                Listener = new HttpListener();
            }

            Listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication | AuthenticationSchemes.Anonymous;
            Listener.AuthenticationSchemeSelectorDelegate = request =>
            {
                return request.Url.LocalPath.StartsWith("/public") ? AuthenticationSchemes.Anonymous : AuthenticationSchemes.IntegratedWindowsAuthentication;
            };

            base.Start(urlBase);
        } 

我真正需要的是通过过滤器访问 HttpListenerContext。

问候, 安德斯

【问题讨论】:

    标签: servicestack windows-authentication


    【解决方案1】:

    我问了一个类似的question。简短的回答是 ServiceStack 对 Windows 身份验证一无所知。请参阅上面我的问题的解决方案,看看是否对您有帮助。

    【讨论】:

    • 我已经查看了过滤器,但问题是您需要访问 HttpListenerContext。如我所见,您只能访问 HttpListenerRequest: public override void Execute(IHttpRequest req, IHttpResponse res, object requestDto) { var request = req.OriginalRequest as HttpListenerRequest; }
    猜你喜欢
    • 1970-01-01
    • 2019-05-19
    • 1970-01-01
    • 2016-06-10
    • 1970-01-01
    • 2012-02-17
    • 1970-01-01
    • 1970-01-01
    • 2012-04-18
    相关资源
    最近更新 更多