我想了解基于 token 的身份验证的含义。我在互联网上搜索但找不到任何可以理解的内容。
最佳答案
我认为解释得很好here ——仅引用长文的关键句子:
The general concept behind a token-based authentication system is simple. Allow users to enter their username and password in order to obtain a token which allows them to fetch a specific resource - without using their username and password. Once their token has been obtained, the user can offer the token - which offers access to a specific resource for a time period - to the remote site.
换句话说:添加一层间接身份验证 - 用户不必使用每个 protected 资源的用户名和密码进行身份验证,而是以这种方式进行一次身份验证(在有限持续时间的 session 内),获得一个有时间限制的资源作为返回,并使用该 token 在 session 期间进行进一步的身份验证。
优点有很多 - 例如,用户一旦获得 token ,就可以将其传递到他们愿意在有限的时间和有限的资源中信任的其他自动化系统,但会不愿意愿意信任他们的用户名和密码(即,永远信任他们被允许访问的每项资源,或者至少在他们更改密码之前)。
如果仍有不清楚的地方,请编辑您的问题以澄清您不 100% 清楚的内容,我相信我们可以为您提供进一步帮助。
关于security - 什么是基于 token 的身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1592534/