- 四种角色
- 客户端(第三方Application,Client)
- 资源所有者(用户,Resource Owner,RO)
- 授权服务器(Authorization Server,AS)
- 资源服务器(Resource Server,RS)
另外还Agent(一般指浏览器)
- 四种grant type
- Authorization Code: used with server-side Applications,用于Client从服务器端与RS交换数据
- Implicit: used with Mobile Apps or Web Applications (applications that run on the user’s device),在浏览器或App中与RS交换数据
- Resource Owner Password Credentials: used with trusted Applications, such as those owned by the service itself(RO信任Client把账户密码给Client用于其与RS交换数据)
- Client Credentials: used with Applications API access,Client访问自己在RS上的资源,Client即为RO
第1种grant type为何要使用authorization code
- 安全考虑,authorization code这种grant type,最适合服务器端web应用。code用于Client向RS交换token,token甚至对于RO及Agent都不必知道。即在浏览器中不必出现token,token只在Client的服务器端与RS间使用。
- 这种类型可用于长生命期(Long-lived),Client对RS的访问,不必须每次申请token,但可以有refresh token。
OAuth2.0琐记
最新推荐文章于 2024-12-08 20:35:55 发布