【发布时间】: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