在web应用程序中有什么不同?我经常看到缩写“auth”。它是代表认证还是授权?或者两者都有?


当前回答

身份验证是验证您的登录用户名和密码的过程。

授权是验证您是否可以访问某些内容的过程。

其他回答

简而言之,请。: -)

身份验证=登录名+密码(你是谁) 授权=权限(你被允许做的事情)

简短的“auth”最有可能指的是第一个或两者。

  Authentication Authorization
What does it do? Verifies credentials Grants or denies permissions
How does it work? Through passwords, biometrics, one-time pins, or apps Through settings maintained by security teams
Is it visible to the user? Yes No
It is changeable by the user? Partially No
How does data move? Through ID tokens Through access tokens

更详细的答案请参考:https://www.okta.com/identity-101/authentication-vs-authorization/

混淆是可以理解的,因为这两个词听起来很相似,而且概念经常密切相关并一起使用。此外,如前所述,常用的缩写Auth也没有帮助。

其他人已经很好地描述了身份验证和授权的含义。这里有一个简单的规则来帮助区分这两者:

身份验证验证您的身份(或真实性,如果您喜欢) 授权验证您的权限,即您访问和可能更改某些内容的权利。

在用户环境中:

身份验证=验证用户的身份(从技术上讲,你可以验证很多不同的东西,比如密码、税务信息、社会安全信息、驾照、指纹或其他生物识别信息……但通常用户名/密码就足够了)

授权=允许用户做某事(你可以设置角色['管理员','卖家','买家'…权限['访问控制中心','删除产品'…并将这些角色赋予用户,然后验证用户有一个允许他执行操作的角色)

权限与CRUD操作有直接关系,因此如果构建一个UI,您可以将对象列为行,并在任意给定角色的对象权限的创建、读取、更新和删除的4列中设置复选框。

就像在我上面的例子中,“访问控制中心”是对控制中心对象的完整的创建、读取、更新和删除访问,而“删除产品”是对产品对象的删除访问。

注意:HTTP授权头用于访问资源的权限,但实际上用于所有资源访问的身份验证。

在我的头脑中和代码中更容易想到验证和权限,因为这两个词

听起来不一样 不要有相同的缩写 授权的实际实现通常涉及角色和权限的实现

身份验证是验证,授权是检查权限。Auth可以是任何一种意思,但更常用的是“用户认证”,即。“用户身份验证”。很多时候没有显式的授权实现(角色和权限),只是使用身份验证来提供执行每个可用操作的授权。这就是Auth。

正如身份验证vs授权所言:

Authentication is the mechanism whereby systems may securely identify their users. Authentication systems provide an answers to the questions: Who is the user? Is the user really who he/she represents himself to be? Authorization, by contrast, is the mechanism by which a system determines what level of access a particular authenticated user should have to secured resources controlled by the system. For example, a database management system might be designed so as to provide certain specified individuals with the ability to retrieve information from a database but not the ability to change data stored in the datbase, while giving other individuals the ability to change data. Authorization systems provide answers to the questions: Is user X authorized to access resource R? Is user X authorized to perform operation P? Is user X authorized to perform operation P on resource R?

参见:

Wikipedia上的身份验证与授权