简体   繁体   English

访问令牌机器的可移植性

[英]Access Token machine portability

I'm developing a REST API which uses an Access Token for verifying & validating. 我正在开发使用访问令牌进行验证和验证的REST API。

There is one scenario where user can obtain the Access Token by providing proper credentials and use the same Access Token from a different machine to access any REST API. 在一种情况下,用户可以通过提供适当的凭据来获取访问令牌,并使用来自另一台计算机的相同访问令牌来访问任何REST API。

I just wanted to check if there's any downside to allowing such a case? 我只是想检查允许这种情况是否有不利之处?

Assuming we're talking OAuth 2.0: it actually depends on the access token type: a so-called Bearer access tokens can be used by any Client that gets hold of it. 假设我们正在谈论OAuth 2.0:它实际上取决于访问令牌的类型:任何拥有它的客户端都可以使用所谓的Bearer访问令牌。 Bearer access tokens are used in the majority of OAuth 2.0 deployments today. 如今,大多数OAuth 2.0部署中都使用了承载访问令牌。

Other types of access tokens are emerging (so-called Proof of Possession tokens) that require the Client to prove that they are really the intended presenter. 正在出现其他类型的访问令牌(所谓的所有权证明令牌),要求客户证明它们确实是预期的演示者。 In that case just having the access token on a different machine is not enough. 在那种情况下,仅将访问令牌放在另一台计算机上是不够的。 In even more advanced emerging scenario's ("token binding") the token may be bound to the TLS connection so it can never be used by another Client or on another connection. 在更高级的新兴方案中(“令牌绑定”),令牌可能会绑定到TLS连接,因此它永远不会被另一个客户端或另一个连接使用。

But as said, for the majority of OAuth 2.0 deployments today, it would be possible to use the Bearer access token from another machine. 但是,正如所说的那样,对于当今大多数OAuth 2.0部署而言,可以使用来自另一台计算机的Bearer访问令牌。

The access token should be signed by the server, and shouldn't include any information about the specific client/machine used to access it. 访问令牌应由服务器签名,并且不应包含有关用于访问它的特定客户端/机器的任何信息。

For example, in the OAuth 2.0 password grant flow, the username/password is exchanged for an access token. 例如,在OAuth 2.0密码授予流程中,用户名/密码被交换为访问令牌。 The token is signed by the issuing token server, and represents that user's authentication and authorization claims. 令牌由发行令牌服务器签名,代表用户的身份验证和授权声明。 What machine the user is making requests from makes no difference. 用户从哪台计算机发出请求没有区别。

So, tl;dr - yes, access tokens are portable between machines. 因此, tl; dr-是的,访问令牌可在机器之间移植。 It's not a typical use case (how would the access token get from one machine to another?), but it's perfectly valid. 这不是典型的用例(访问令牌将如何从一台计算机转移到另一台计算机?),但这是完全有效的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM