簡體   English   中英

Web服務+ Windows身份驗證問題

[英]Web Services + Windows Authentication Questions

我有一個用於使用表單身份驗證的Web項目。 我有支持Windows身份驗證的新要求。 該項目包含兩個Web服務,一個用於Silverlight頁面(MapService),一個用於各種ajax調用(AsyncService)現在一切正常,但是有兩件事我不太了解。

Web.Config中的配置如下:

<bindings>
      <basicHttpBinding>
        <binding name="WindowsClientOverTcp">
          <security mode="Transport">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding name="AsyncWindowsOverTcp">
          <security mode="Transport">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service name="Project.MapService.MapService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="WindowsClientOverTcp" name="WindowsClientOverTcp" contract="Project.MapService.MapService" />
      </service>
      <service name="Project.AsyncService.AsyncService">
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="AsyncWindowsOverTcp" name="AsyncWindowsOverTcp" behaviorConfiguration="Project.AsyncService.AsyncServiceAspNetAjaxBehavior" contract="Project.AsyncService.AsyncService" />
      </service>
  </services>
  1. 通過此設置,使用SSL基本上是必需的嗎? 我已經讀過,將傳輸安全與Windows ClientCredentialType一起使用會強制使用HTTPS終結點,這似乎是事實。 我只想向客戶或管理人員說“如果他們需要Windows身份驗證,我們的應用程序必須使用https”,是否合理?

  2. 對於AsyncService,它顯然需要客戶端提供Windows憑據,但是我完全不需要更改JS / Ajax代碼,它仍然可以正常工作。 客戶端瀏覽器在做一些魔術嗎? 由於沒有客戶端配置,因此我不了解如何對呼叫進行身份驗證。

謝謝

  1. 不,您不需要HTTPS即可使用Windows身份驗證。 您確實需要將IIS配置為使用集成安全性,並且如果調用者來自同一Windows域或受信任的Windows域,則IIS將能夠對用戶進行身份驗證。

  2. 如果瀏覽器正在使用您的Windows域或受信任域的憑據運行,並且您的Web應用配置為使用Windows身份驗證,則該瀏覽器會將它在IIS下運行的憑據包括在內。

編輯:一些其他信息。 如果您如上所述使用BasicHttpBinding並希望對其進行保護,那么一個不錯的選擇是將TransportWithMessageCredential用作您的安全模式。 這樣可以使用傳輸層(HTTPS)保護消息,並在消息中包含Windows憑據。 另請參見http://msdn.microsoft.com/zh-cn/library/ms731925.aspx上的 “對WCF安全進行編程”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM