我真的在试图理解OpenID和OAuth之间的区别?也许它们是完全不同的两件事?
当前回答
OpenID和OAuth都是用于身份验证和/或授权的基于http的协议。两者都旨在允许用户执行操作,而无需向客户端或第三方提供身份验证凭据或全面权限。虽然它们是相似的,并且有建议将它们一起使用的标准,但它们是单独的协议。
OpenID用于联合身份验证。客户机接受来自任何提供者的身份断言(尽管客户机可以自由地将提供者列入白名单或黑名单)。
OAuth用于委托授权。客户端向提供者注册,提供者提供授权令牌,客户端接受这些授权令牌以代表用户执行操作。
OAuth目前更适合于授权,因为身份验证后的进一步交互被内置到协议中,但这两个协议都在不断发展。OpenID及其扩展可用于授权,OAuth可用于身份验证,可以将其视为无操作授权。
其他回答
OpenID(主要)用于识别/身份验证,这样stackoverflow.com就知道我拥有chris.boyle.name(或任何位置),因此我可能就是昨天拥有chris.boyle.name并获得一些声誉点的同一个人。
OAuth是为授权代表您执行操作而设计的,因此stackoverflow.com(或任何地方)可以请求许可,例如,自动代表您发送Tweet,而不需要知道您的Twitter密码。
我目前正在研究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)
从技术上讲,这里已经给出了很好的答案,我想到了给出简要的进化观点
有三种方法可以比较OAuth和OpenID:
1. 目的
OpenID是为联邦身份验证而创建的,也就是说,允许第三方使用用户已经拥有的帐户为您验证用户身份。联合这个术语在这里非常重要,因为OpenID的全部意义在于可以使用任何提供者(白名单除外)。你不需要预先选择或与提供商协商协议,以允许用户使用他们拥有的任何其他帐户。
OAuth的创建是为了消除用户与第三方应用程序共享密码的需要。它实际上是作为解决OpenID问题的一种方式开始的:如果您在站点上支持OpenID,则不能使用HTTP基本凭据(用户名和密码)来提供API,因为用户在站点上没有密码。
The problem is with this separation of OpenID for authentication and OAuth for authorization is that both protocols can accomplish many of the same things. They each provide a different set of features which are desired by different implementations but essentially, they are pretty interchangeable. At their core, both protocols are an assertion verification method (OpenID is limited to the 'this is who I am' assertion, while OAuth provides an 'access token' that can be exchanged for any supported assertion via an API).
2. 特性
这两种协议都为站点提供了一种方法,可以将用户重定向到其他地方,然后返回一个可验证的断言。OpenID提供身份断言,而OAuth以访问令牌的形式更为通用,可用于“向OAuth提供者询问问题”。但是,它们各自支持不同的特性:
OpenID - the most important feature of OpenID is its discovery process. OpenID does not require hard coding each the providers you want to use ahead of time. Using discovery, the user can choose any third-party provider they want to authenticate. This discovery feature has also caused most of OpenID's problems because the way it is implemented is by using HTTP URIs as identifiers which most web users just don't get. Other features OpenID has is its support for ad-hoc client registration using a DH exchange, immediate mode for optimized end-user experience, and a way to verify assertions without making another round-trip to the provider.
OAuth - the most important feature of OAuth is the access token which provides a long lasting method of making additional requests. Unlike OpenID, OAuth does not end with authentication but provides an access token to gain access to additional resources provided by the same third-party service. However, since OAuth does not support discovery, it requires pre-selecting and hard-coding the providers you decide to use. A user visiting your site cannot use any identifier, only those pre-selected by you. Also, OAuth does not have a concept of identity so using it for login means either adding a custom parameter (as done by Twitter) or making another API call to get the currently "logged in" user.
3.技术的实现
这两种协议在使用重定向获取用户授权方面具有共同的架构。在OAuth中,用户授权访问他们受保护的资源,在OpenID中,用户授权访问他们的身份。但这就是他们所有的共同点。
每个协议都有不同的方法来计算用于验证请求或响应的真实性的签名,并且每个协议都有不同的注册要求。
OAuth在授权之上构建身份验证:用户将对其身份的访问委托给应用程序,然后应用程序成为身份API的消费者,从而找出是谁首先授权了客户端http://oauth.net/articles/authentication/
OpenID和OAuth都是用于身份验证和/或授权的基于http的协议。两者都旨在允许用户执行操作,而无需向客户端或第三方提供身份验证凭据或全面权限。虽然它们是相似的,并且有建议将它们一起使用的标准,但它们是单独的协议。
OpenID用于联合身份验证。客户机接受来自任何提供者的身份断言(尽管客户机可以自由地将提供者列入白名单或黑名单)。
OAuth用于委托授权。客户端向提供者注册,提供者提供授权令牌,客户端接受这些授权令牌以代表用户执行操作。
OAuth目前更适合于授权,因为身份验证后的进一步交互被内置到协议中,但这两个协议都在不断发展。OpenID及其扩展可用于授权,OAuth可用于身份验证,可以将其视为无操作授权。
推荐文章
- “刷新令牌”的目的是什么?
- 摘要认证和基本认证的区别是什么?
- OAuth 2.0不记名令牌到底是什么?
- 什么是端点?
- 配置系统初始化失败
- 用Django实现OpenID的最佳解决方案是什么?
- 在Subversion中,我可以是我的登录名以外的用户吗?
- 认证授权失败时,AuthorizeAttribute为什么会重定向到登录页面?
- JWT刷新令牌流
- 将Keypair添加到现有的EC2实例中
- 身份验证:JWT使用vs会话
- 基于cookie的身份验证是如何工作的?
- 删除SQL Server Management Studio中记住的登录名和密码列表
- 如果JWT被偷了怎么办?
- node.js的用户认证库?