authentication - OAuth2.0的用例

标签 authentication go oauth oauth-2.0 multi-tenant

我正在构建一个 Multi-Tenancy saas(软件即服务)架构。我必须为系统构建身份验证系统

根据我的研究,我认为我需要构建基于OAuth2.0 和带有JWT token 的不记名 token 的身份验证系统。

在阅读了很多有关如何构建 OAuth2.0 服务器的 OAuth2.0 之后,我仍然不明白OAuth 的完整概念,并且对无论我是否需要它或者我需要一些其他的身份验证系统。

我的系统需要的是我们将向所有客户提供一个SDK,每个客户将有一个Application Id一个 key 使用 SDK 客户端将连接到我们系统中存在的他的应用程序。

application ID 会将客户映射到他在我们系统中的应用程序,client secret key 将在应用程序内验证客户端。我还需要构建吗基于OAuth2.0的认证系统还是我可以根据需要构建自己的认证系统?

OAUTH2.0 的用例是什么?我们什么时候不需要它来实现?

最佳答案

首先,正如OAuth authentication中明确指出的那样

OAuth 2.0 is not an authentication protocol.

Authentication in the context of a user accessing an application tells an application who the current user is and whether or not they're present. A full authentication protocol will probably also tell you a number of attributes about this user, such as a unique identifier, an email address, and what to call them when the application says "Good Morning".

However, OAuth tells the application none of that.
OAuth says absolutely nothing about the user, nor does it say how the user proved their presence or even if they're still there.
As far as an OAuth client is concerned, it asked for a token, got a token, and eventually used that token to access some API. It doesn't know anything about who authorized the application or if there was even a user there at all.

有一个使用 OAuth 进行用户身份验证的标准:OpenID Connect,与 OAuth2 兼容。

The OpenID Connect ID Token is a signed JSON Web Token (JWT) that is given to the client application along side the regular OAuth access token.
The ID Token contains a set of claims about the authentication session, including an identifier for the user (sub), the identifier for the identity provider who issued the token (iss), and the identifier of the client for which this token was created (aud).

在 Go 中,您可以查看 coreos/dex ,一个 OpenID Connect Identity (OIDC) 和 OAuth 2.0 Provider with Pluggable Connector。

关于authentication - OAuth2.0的用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36974902/

相关文章:

xml - 不支持的关系类型

encryption - 如何从 RSA JWK 中提取公钥和私钥?

time - 为什么 time.Parse 会错误地解析时间?

delphi - 断开连接时发生 IdHTTP 访问冲突

PHP从文本文件登录

java - mfp WL.Client.createSecurityCheckChallengeHandler() 或 WLAuthorizationManager.login() 中登录失败

http - Gorilla mux, 'catch' 响应代码的最佳方式

python - 从 gdata.gauth.OAuthHmacToken python 对象中检索 token 和 secret

grails spring security oauth 仍然需要本地用户名/密码?

php - 如何使用 Javascript 获取 URL 变量