2009-01-26 26 views
8

我在網上發現了很多有關使用ASP.NET成員提供程序和wsHttpBindings的資料,但是我沒有看到任何有關webHttpBindings的使用方法。使用ASP.NET成員資格提供程序限制對WCF REST(webHttpBinding)服務的訪問?

我要尋找一個系統,該系統將在兩種情況下工作:

  1. 的用戶登錄到一個asp.net網站,該網站正在向服務呼叫。
  2. 用戶直接通過REST訪問服務。

這是可能的使用內置框架(即通過配置)?如果是的話,我該如何配置服務?用戶如何將證書傳遞給REST服務?

回答

2

我發現最好的來源是在這裏:http://www.leastprivilege.com/FinallyUsernamesOverTransportAuthenticationInWCF.aspx

該網站也有噸的其他信息有關設置HTTP模塊來處理基本身份驗證(我猜你將會使用,因爲它是一種標準)。

HTTP模塊驗證方法位於Codeplex上與示例代碼和這裏的一切:http://www.codeplex.com/CustomBasicAuth

+0

能否請你回答http://stackoverflow.com/questions/9584198/authentication-service-using-wcf? – Lijo 2012-03-06 13:08:21

0

ADO.NET Data Services你的意思是?

您可以爲實體構建QueryInterceptor並限制對其的訪問。 例如:

[QueryInterceptor("foo_entity")] 
    public Expression<Func<foo_entity, bool>> FilterMembership() 
    { 
     MembershipUser user = Membership.GetUser(); 
     Guid userGuid = (Guid)user.ProviderUserKey; 
     return c => c.UserId == userGuid; 
    } 
相關問題