2013-08-22 49 views
1

我有一個Windows服務公開一些使用Windows身份驗證和AD角色訪問受限的WCF服務。Windows服務託管ServiceStack和Windows身份驗證?

其中一項服務是當前作爲MMC(Microsoft管理控制檯)Snapin實施的管理客戶端的服務。

我想改變這個基於瀏覽器的儀表板與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。

問候, 安德斯

回答

1

我問過類似的question。簡短的回答是ServiceStack不知道任何關於Windows身份驗證的信息。看到我上面的問題的解決方案,看看是否有幫助你。

+0

我已經看過濾器,但事情是,你需要訪問HttpListenerContext。正如我所看到的,您只能訪問HttpListenerRequest: public override void Execute(IHttpRequest req,IHttpResponse res,object requestDto) var request = req.OriginalRequest as HttpListenerRequest; } – Amunk

相關問題