比尔萄堡

上帝说: “要有光” 于是,就有了光。


  • 首页

  • 归档

  • 关于我

  • 公益404

  • 搜索

OAuth 2.0

时间: 2022-06-10 分类: 我的小脑/认证   字数: 487 字 阅读: 1分钟 阅读次数:

关键点

整体流程

 +--------+                               +---------------+
 |        |--(A)- Authorization Request ->|   Resource    |
 |        |                               |     Owner     |
 |        |<-(B)-- Authorization Grant ---|               |
 |        |                               +---------------+
 |        |
 |        |                               +---------------+
 |        |--(C)-- Authorization Grant -->| Authorization |
 | Client |                               |     Server    |
 |        |<-(D)----- Access Token -------|               |
 |        |                               +---------------+
 |        |
 |        |                               +---------------+
 |        |--(E)----- Access Token ------>|    Resource   |
 |        |                               |     Server    |
 |        |<-(F)--- Protected Resource ---|               |
 +--------+                               +---------------+

                 Figure 1: Abstract Protocol Flow

OAuth defines four roles:

  • resource owner 用户 An entity capable of granting access to a protected resource. When the resource owner is a person, it is referred to as an end-user.

  • resource server The server hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens.

  • client 通常表示第三方网站 An application making protected resource requests on behalf of the resource owner and with its authorization. The term “client” does not imply any particular implementation characteristics (e.g., whether the application executes on a server, a desktop, or other devices).

  • authorization server The server issuing access tokens to the client after successfully authenticating the resource owner and obtaining authorization.

模式

  • 授权码模式(authorization code)
  • 简化模式(implicit)
  • 密码模式(resource owner password credentials)
  • 客户端模式(client credentials)

    经典问题

    为什么需要refresh token

  • live-short access token 安全系数更好,而refresh token可以频繁向用户索要 用户名/密码

  • 通过refresh token,可以废弃之前的access token

  • refresh token不暴露给前端,access token可以暴露给前端【特殊场景】

  • refresh token 校验由 authorization server负责,access token由 resource server负责【持疑】

    access token通过哪个模块去校验

引用

official doc rcf6749 理解OAuth 2.0

#认证#

标题:OAuth 2.0

作者:训导主任林作栋

声明: 本博客文章除特别声明外,均采用 CC BY-NC-SA 3.0许可协议,转载请注明出处!

创作实属不易,如有帮助,那就打赏博主些许茶钱吧 ^_^
WeChat Pay

微信打赏

Alipay

支付宝打赏

B-tree
后台运行任务
训导主任林作栋

训导主任林作栋

戏谑的码农,北野武的拥趸,李安的迷弟,伍佰的Fans

55 日志
23 分类
62 标签
豆瓣
友情链接
  • Obsidian
  • V2EX
  • 关注黑客与极客
  • 廖雪峰
标签云
  • Linux 6
  • K8s 5
  • 数据库 5
  • Golang 4
  • Etcd 3
  • Mysql 3
  • Ai 2
  • Gitlab 2
  • Postgres 2
  • 前端 2
© 2010 - 2024 比尔萄堡
Powered by - Hugo v0.58.2 / Theme by - NexT
/
Storage by Vercel / 刘 ICP 备 18047355 号
0%