我真的在试图理解OpenID和OAuth之间的区别?也许它们是完全不同的两件事?
当前回答
很多人仍然访问这个网站,这里有一个非常简单的图表来解释它
礼貌维基百科
其他回答
OpenID、OAuth、OpenID Connect的区别解释:
OpenID is a protocol for authentication while OAuth is for authorization. Authentication is about making sure that the guy you are talking to is indeed who he claims to be. Authorization is about deciding what that guy should be allowed to do. In OpenID, authentication is delegated: server A wants to authenticate user U, but U's credentials (e.g. U's name and password) are sent to another server, B, that A trusts (at least, trusts for authenticating users). Indeed, server B makes sure that U is indeed U, and then tells to A: "ok, that's the genuine U". In OAuth, authorization is delegated: entity A obtains from entity B an "access right" which A can show to server S to be granted access; B can thus deliver temporary, specific access keys to A without giving them too much power. You can imagine an OAuth server as the key master in a big hotel; he gives to employees keys which open the doors of the rooms that they are supposed to enter, but each key is limited (it does not give access to all rooms); furthermore, the keys self-destruct after a few hours. To some extent, authorization can be abused into some pseudo-authentication, on the basis that if entity A obtains from B an access key through OAuth, and shows it to server S, then server S may infer that B authenticated A before granting the access key. So some people use OAuth where they should be using OpenID. This schema may or may not be enlightening; but I think this pseudo-authentication is more confusing than anything. OpenID Connect does just that: it abuses OAuth into an authentication protocol. In the hotel analogy: if I encounter a purported employee and that person shows me that he has a key which opens my room, then I suppose that this is a true employee, on the basis that the key master would not have given him a key which opens my room if he was not.
(源)
OpenID Connect与OpenID 2.0有何不同? OpenID Connect执行许多与OpenID 2.0相同的任务,但确实如此 以一种api友好的方式,在本地和移动设备上都可用 应用程序。OpenID Connect为健壮性定义了可选机制 签名和加密。而OAuth 1.0a和OpenID的集成 2.0需要一个扩展,在OpenID连接中,OAuth 2.0功能与协议本身集成。
(源)
OpenID connect will give you an access token plus an id token. The id token is a JWT and contains information about the authenticated user. It is signed by the identity provider and can be read and verified without accessing the identity provider. In addition, OpenID connect standardizes quite a couple things that oauth2 leaves up to choice. for instance scopes, endpoint discovery, and dynamic registration of clients. This makes it easier to write code that lets the user choose between multiple identity providers.
(源)
谷歌是2.0版的
谷歌的OAuth 2.0 api可用于身份验证和 授权。本文档描述了我们的OAuth 2.0实现 用于身份验证,符合OpenID Connect 规范,并且是OpenID认证。在 “OAuth 2.0访问谷歌接口”也适用于本业务。如果 如果您想以交互方式探索此协议,我们推荐 谷歌OAuth 2.0游乐场。
(源)
我想谈谈这个问题的一个特定方面,如以下评论所述:
OAuth:在授予某些特性的访问权限之前,必须进行身份验证,对吗?所以OAuth =什么OpenId +授予访问某些功能?- Hassan Makarov 6月21日1:57
是的……也没有。答案很微妙,所以请耐心听我说。
当OAuth流将您重定向到目标服务(即OAuth提供者)时,您很可能需要在将令牌交还给客户机应用程序/服务之前使用该服务进行身份验证。然后,生成的令牌允许客户端应用程序代表给定用户发出请求。
注意最后一句话的一般性:具体来说,我写的是“代表给定用户”,而不是“代表您”。一个常见的错误是假设“拥有与给定用户拥有的资源交互的能力”意味着“您和目标资源的所有者是同一人”。
不要犯这样的错误。
虽然您确实使用OAuth提供者进行身份验证(例如,通过用户名和密码,或者SSL客户端证书或其他方式),但客户端获得的回报不应该被视为身份证明。例如,在一个流中,对另一个用户的资源的访问被委托给您(通过代理,OAuth客户端)。授权并不意味着身份验证。
要处理身份验证,您可能需要研究OpenID Connect,它本质上是OAuth 2.0设置的基础之上的另一层。以下是关于OpenID Connect(在我看来)最突出的一点(来自https://oauth.net/articles/authentication/):)
OpenID Connect is an open standard published in early 2014 that defines an interoperable way to use OAuth 2.0 to perform user authentication. In essence, it is a widely published recipe for chocolate fudge that has been tried and tested by a wide number and variety of experts. Instead of building a different protocol to each potential identity provider, an application can speak one protocol to as many providers as they want to work with. Since it's an open standard, OpenID Connect can be implemented by anyone without restriction or intellectual property concerns. OpenID Connect is built directly on OAuth 2.0 and in most cases is deployed right along with (or on top of) an OAuth infrastructure. OpenID Connect also uses the JSON Object Signing And Encryption (JOSE) suite of specifications for carrying signed and encrypted information around in different places. In fact, an OAuth 2.0 deployment with JOSE capabilities is already a long way to defining a fully compliant OpenID Connect system, and the delta between the two is relatively small. But that delta makes a big difference, and OpenID Connect manages to avoid many of the pitfalls discussed above by adding several key components to the OAuth base: [...]
The document then goes on to describe (among other things) token IDs and a UserInfo endpoint. The former provides a set of claims (who you are, when the token was issued, etc, and possibly a signature to verify the authenticity of the token via a published public key without having to ask the upstream service), and the latter provides a means of e.g. asking for the user's first/last name, email, and similar bits of info, all in a standardized way (as opposed to the ad-hoc extensions to OAuth that people used before OpenID Connect standardized things).
我相信重新审视这个问题是有意义的,正如评论中所指出的,OpenID Connect的引入可能带来更多的困惑。
OpenID Connect是一种类似于OpenID 1.0/2.0的身份验证协议,但它实际上构建在OAuth 2.0之上,因此您将获得授权功能和身份验证功能。这两者之间的区别在这篇(相对较新的,但很重要的)文章中有很好的详细解释:http://oauth.net/articles/authentication/
OAuth返回访问令牌,用于从资源服务器访问资源,OpenID返回JWT /加密令牌中关于资源的元数据细节
OpenId使用OAuth来处理身份验证。
通过类比,就像。net依赖于Windows API。你可以直接调用Windows API,但是它太宽了,太复杂了,方法参数太大了,你很容易犯错误/bug /安全问题。
OpenId/OAuth也是如此。OpenId依赖于OAuth来管理身份验证,但定义了特定的令牌(Id_token)、数字签名和特定的流。
推荐文章
- 摘要认证和基本认证的区别是什么?
- OAuth 2.0不记名令牌到底是什么?
- 什么是端点?
- 配置系统初始化失败
- 用Django实现OpenID的最佳解决方案是什么?
- 在Subversion中,我可以是我的登录名以外的用户吗?
- 认证授权失败时,AuthorizeAttribute为什么会重定向到登录页面?
- JWT刷新令牌流
- 将Keypair添加到现有的EC2实例中
- 身份验证:JWT使用vs会话
- 基于cookie的身份验证是如何工作的?
- 删除SQL Server Management Studio中记住的登录名和密码列表
- 如果JWT被偷了怎么办?
- node.js的用户认证库?
- OAuth 2中隐式授权授权类型的目的是什么?