【发布时间】:2017-05-28 12:31:14
【问题描述】:
当您要使用多个不同的客户端时,保护 Web API 的最佳方法是什么?每个客户端都应该有自己的 API 密钥来连接。 现在我已经阅读了不同的内容,但我仍然有一些问题。
我找到了这个:http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/#comments,但这足够了吗?
所以基本上:
- 客户端使用给定的用户名/密码连接
- 客户端获取不记名令牌
- 客户端在每个发布到 api 的帖子中使用此令牌,直到时间戳结束
我还阅读了关于为每个客户端提供一个他可以使用的 API 密钥:http://bitoftech.net/2014/12/15/secure-asp-net-web-api-using-api-key-authentication-hmac-authentication/
最好的方法是什么?
【问题讨论】:
标签: c# asp.net-mvc api token hmac