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


当前回答

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

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

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

其他回答

定义

身份验证——你是你声称的那个人吗? 授权——你被授权去做你想做的事情吗?

例子

web应用程序使用谷歌登录。当用户成功登录后,谷歌发送回:

JWT令牌。可以对其进行验证和解码以获得身份验证信息。令牌是由谷歌签名的吗?用户的姓名和电子邮件是什么? 一个访问令牌。这将授权web应用程序代表用户访问谷歌api。例如,应用程序可以访问用户的谷歌日历事件吗?这些权限取决于请求的范围,以及用户是否允许。

另外:

公司可能有一个管理仪表板,允许客户支持来管理公司的用户。该公司使用谷歌Sign-In,而不是提供允许客户支持访问此仪表板的自定义注册解决方案。

JWT令牌(从谷歌登录过程接收)被发送到公司的授权服务器,以确定用户是否拥有组织托管域(email@company.com)的G Suite帐户?如果他们这样做了,他们是公司为客户支持而创建的谷歌小组的成员吗?如果以上都是,我们可以认为他们是通过认证的。

然后,公司的授权服务器向仪表板应用程序发送一个访问令牌。该访问令牌可用于向公司的资源服务器发出授权请求(例如,向发送回公司所有用户的端点发出GET请求的能力)。

  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/

正如身份验证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上的身份验证与授权

Authentication是一个验证的过程:

系统中的用户身份(用户名、登录名、电话号码、电子邮件……),通过提供证明(密钥、生物识别、短信……)作为扩展的多因素身份验证。 使用数字签名检查电子邮件[关于] 校验和

授权是身份验证之后的下一步。它是关于资源的权限/角色/特权。OAuth(开放授权)是授权的一个例子

身份验证是确定某人确实是他们所声称的那个人的过程。 授权是指决定谁可以做什么的规则。例如,亚当可能被授权创建和删除数据库, 而Usama只被授权阅读。

这两个概念是完全正交和独立的,但它们都是安全设计的核心,如果其中任何一个概念都不正确,就会导致妥协。

就web应用程序而言,简单地说,身份验证是指你检查登录凭证,看看你是否识别出用户已登录,而授权是指你在访问控制中查看是否允许用户查看、编辑、删除或创建内容。