簡體   English   中英

Web API - 身份驗證建議

[英]Web API - Authentication Advice

背景: - 在使用VS 2012的ASP.Net 4.0 / C#的Web窗體應用程序中使用Web API - 有些頁面將使用帶有JQuery的Web API調用,其他頁面將使用Web表單回發

需要執行以下操作:

  • 讓用戶使用用戶名/密碼登錄
  • 使用SQL Server DB驗證憑據
  • 生成令牌回到客戶端
  • 讓客戶端使用令牌對未來的API請求進行身份驗證
  • 無論是使用Web API還是Web表單回發,都要維護用戶會話

我不清楚的是:

  • 如何使用Web API生成令牌
  • 如何在每次調用時驗證令牌服務器端(在SQL Server中存儲?)
  • 如何使用混合的Web API / Web表單回發來維護用戶會話

我使用了來自http://thinktecture.github.io/的 Thinktecture IdentityModel。 它是一個很棒的庫,包括令牌生成。

這是我在實施時提到的原始文章

http://ben.onfabrik.com/posts/dog-fooding-our-api-authentication

如果您有興趣,我也會在我的博客上寫一些文章

http://sunilrav.com/post/Enable-Basic-Authetication-in-Aspnet-webapi-using-ThinktectureIdentityModel

http://sunilrav.com/post/Enable-CORS-in-Aspnet-webapi-using-ThinktectureIdentityModel

這篇文章在我做研究時幫助了我

REST服務身份驗證

暫無
暫無

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

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