Restful API 认证推荐? [英] Restful API authentication recommendation?

查看:30
本文介绍了Restful API 认证推荐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发几个 RESTful API 供 3rd 方调用,这些 API 需要身份验证(基于 apikey 和秘密)和授权(基于 HTTP 方法和 URI).

I am developing several RESTful API for 3rd party to call, and these API need authentication (apikey & secret based), and authorization (HTTP method & URI based).

是否有任何我们可以重用的现有软件阻止我推出我们自己的安全层实现?

Are there any existing software we can reuse that prevent me from rolling out our own implementation for the security layer?

推荐答案

HTTP 为您提供了相应的支持,因此您无需重新发明轮子

HTTP gives you granted support for that, so you don't need to reinvent the wheel

无论使用:

  • HTTP Auth Basic(使用 SSL 绕过纯文本密码提交问题)
  • HTTP 身份验证摘要

Auth Digest 的优势在于它不以明文形式传输密码并处理重放攻击(使用随机数).

Auth Digest has advantage, that it does not transmit the passowrd in cleartext and handles replay attacks (with nonces).

我们使用 HTTP Auth Digest(Tomcat servlet 容器直接支持它),我们对此感到满意.

We use HTTP Auth Digest (Tomcat servlet container has direct support for it) and we are content with it.

有些客户在 Digest 方面有问题(不是那么简单),所以现在我会选择 Basic 和 SSL.Basic 的优势还在于您可以进行抢占式身份验证(在第一个请求中发送 user:pwd).

Some clients have problems with Digest (not so trivial), so these days I would opt for Basic and SSL. Advantage for Basic is also that you can you preemptive authentication (sending user:pwd in first request).

这篇关于Restful API 认证推荐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆