在web应用程序中有什么不同?我经常看到缩写“auth”。它是代表认证还是授权?或者两者都有?
当前回答
我发现这篇文章中的类比对我很有帮助。
Consider a person walking up to a locked door to provide care to a pet while the family is away on vacation. That person needs: Authentication is in the form of a key. The lock on the door only grants access to someone with the correct key in much the same way that a system only grants access to users who have the correct credentials. Authorization is in the form of permissions. Once inside, the person has the authorization to access the kitchen and open the cupboard that holds the pet food. The person may not have permission to go into the bedroom for a quick nap.
因此,简而言之,认证是关于用户身份的,而授权是关于用户权限的。
其他回答
我试图用最简单的语言来解释这一点
1)身份验证意味着“你是你所说的那个人吗?”
2)授权意味着“你能做你想做的事吗?”
这在下图中也有描述。
我试图用最好的术语来解释它,并创造了一个相同的图像。
补充@Kerrek的答案;
身份验证为通用形式(所有员工都可以登录机器)
授权是专用形式(但管理员只能在机器上安装/卸载应用程序)
我发现这篇文章中的类比对我很有帮助。
Consider a person walking up to a locked door to provide care to a pet while the family is away on vacation. That person needs: Authentication is in the form of a key. The lock on the door only grants access to someone with the correct key in much the same way that a system only grants access to users who have the correct credentials. Authorization is in the form of permissions. Once inside, the person has the authorization to access the kitchen and open the cupboard that holds the pet food. The person may not have permission to go into the bedroom for a quick nap.
因此,简而言之,认证是关于用户身份的,而授权是关于用户权限的。
简而言之,请。: -)
身份验证=登录名+密码(你是谁) 授权=权限(你被允许做的事情)
简短的“auth”最有可能指的是第一个或两者。
在用户环境中:
身份验证=验证用户的身份(从技术上讲,你可以验证很多不同的东西,比如密码、税务信息、社会安全信息、驾照、指纹或其他生物识别信息……但通常用户名/密码就足够了)
授权=允许用户做某事(你可以设置角色['管理员','卖家','买家'…权限['访问控制中心','删除产品'…并将这些角色赋予用户,然后验证用户有一个允许他执行操作的角色)
权限与CRUD操作有直接关系,因此如果构建一个UI,您可以将对象列为行,并在任意给定角色的对象权限的创建、读取、更新和删除的4列中设置复选框。
就像在我上面的例子中,“访问控制中心”是对控制中心对象的完整的创建、读取、更新和删除访问,而“删除产品”是对产品对象的删除访问。
注意:HTTP授权头用于访问资源的权限,但实际上用于所有资源访问的身份验证。
在我的头脑中和代码中更容易想到验证和权限,因为这两个词
听起来不一样 不要有相同的缩写 授权的实际实现通常涉及角色和权限的实现
身份验证是验证,授权是检查权限。Auth可以是任何一种意思,但更常用的是“用户认证”,即。“用户身份验证”。很多时候没有显式的授权实现(角色和权限),只是使用身份验证来提供执行每个可用操作的授权。这就是Auth。
推荐文章
- 检查SQL Server登录是否已经存在
- 阻止人们入侵基于php的Flash游戏高分表的最佳方法是什么
- SQL Server 2008不能用新创建的用户登录
- Passport.js -错误:序列化用户到会话失败
- 令牌身份验证vs. cookie
- JWT vs cookie用于基于令牌的身份验证
- 在php中生成一个随机密码
- java.util.Random和java.security. securerrandom的区别
- Docker和安全密码
- 准备好的语句如何防止SQL注入攻击?
- 为什么人们会写“throw 1;<不要邪恶>”和“for(;;);”在json响应前?
- 非加密用途的最快哈希?
- 为跨源请求设置cookie
- SHA512 vs. Blowfish和Bcrypt
- REST身份验证方案的安全性