我真的在试图理解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返回访问令牌,用于从资源服务器访问资源,OpenID返回JWT /加密令牌中关于资源的元数据细节
OAuth在授权之上构建身份验证:用户将对其身份的访问委托给应用程序,然后应用程序成为身份API的消费者,从而找出是谁首先授权了客户端http://oauth.net/articles/authentication/
如果您的用户只是想登录Facebook或Twitter,请使用OAuth。如果您的用户是运行自己的OpenID提供者的用户,请使用OpenID,因为他们“不希望其他人拥有自己的身份”。
我目前正在研究OAuth 2.0和OpenID连接规范。以下是我的理解: 之前他们是:
OpenID was proprietary implementation of Google allowing third party applications like for newspaper websites you can login using google and comment on an article and so on other usecases. So essentially, no password sharing to newspaper website. Let me put up a definition here, this approach in enterprise approach is called Federation. In Federation, You have a server where you authenticate and authorize (called IDP, Identity Provider) and generally the keeper of User credentials. the client application where you have business is called SP or Service Provider. If we go back to same newspaper website example then newspaper website is SP here and Google is IDP. In enterprise this problem was earlier solved using SAML. that time XML used to rule the software industry. So from webservices to configuration, everything used to go to XML so we have SAML, a complete Federation protocol OAuth: OAuth saw it's emergence as an standard looking at all these kind of proprietary approaches and so we had OAuth 1.o as standard but addressing only authorization. Not many people noticed but it kind of started picking up. Then we had OAuth 2.0 in 2012. CTOs, Architects really started paying attention as world is moving towards Cloud computing and with computing devices moving towards mobile and other such devices. OAuth kind of looked upon as solving major problem where software customers might give IDP Service to one company and have many services from different vendors like salesforce, SAP, etc. So integration here really looks like federation scenario bit one big problem, using SAML is costly so let's explore OAuth 2.o. Ohh, missed one important point that during this time, Google sensed that OAuth actually doesn't address Authentication, how will IDP give user data to SP (which is actually wonderfully addressed in SAML) and with other loose ends like: a. OAuth 2.o doesn't clearly say, how client registration will happen b. it doesn't mention anything about the interaction between SP (Resource Server) and client application (like Analytics Server providing data is Resource Server and application displaying that data is Client)
从技术上讲,这里已经给出了很好的答案,我想到了给出简要的进化观点
现在OpenID连接是最相关的,所以我将解释OpenID连接和OAuth 2之间的区别。
OpenID connect指定IDToken标准:https://openid.net/specs/openid-connect-core-1_0.html#IDToken
这是OpenID连接的主要贡献。因此,它指定了身份验证完成后响应中应该包含的内容。
IDToken需要是JWT令牌,并包含用户的信息,如用户id、用户名等。返回的信息取决于授权时传递的请求。它还包含令牌的过期日期,并且应该包含令牌的数字签名。此签名用于使用公钥验证令牌。
第二大差异与公钥有关。OpenID连接使用所谓的发现或众所周知的端点。它是一个公开开放的端点,只返回一个带有公钥和授权端点等值的JSON。
https://openid.net/specs/openid-connect-core-1_0.html#SelfIssuedDiscovery
因此OpenID本质上是与身份验证相关的,因为它指定了IDToken,这是通过检查数字签名和IDToken的过期日期来验证用户身份所必需的。
OAuth处理授权,特别是与作用域和验证资源服务器上的访问令牌相关的授权。
但是,正如这里所写的,OpenID使用OAuth 2授权进行身份验证。
https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
身份验证请求是OAuth 2.0授权请求,它请求授权服务器对最终用户进行身份验证。
简而言之,尝试将OpenID视为使用JWT令牌的身份验证,将OAuth视为具有作用域的授权。
推荐文章
- 摘要认证和基本认证的区别是什么?
- OAuth 2.0不记名令牌到底是什么?
- 什么是端点?
- 配置系统初始化失败
- 用Django实现OpenID的最佳解决方案是什么?
- 在Subversion中,我可以是我的登录名以外的用户吗?
- 认证授权失败时,AuthorizeAttribute为什么会重定向到登录页面?
- JWT刷新令牌流
- 将Keypair添加到现有的EC2实例中
- 身份验证:JWT使用vs会话
- 基于cookie的身份验证是如何工作的?
- 删除SQL Server Management Studio中记住的登录名和密码列表
- 如果JWT被偷了怎么办?
- node.js的用户认证库?
- OAuth 2中隐式授权授权类型的目的是什么?