SSO、CAS、OAuth、OIDC

2023-05-16

在这里插入图片描述

参考

  • 简单了解概念: https://www.bilibili.com/video/BV1XG411w7DN/
  • 简单了解操作: https://www.bilibili.com/video/BV1334y11739/ openid-connect
  • 👍流程图解: https://www.youtube.com/watch?v=t18YB3xDfXI (图:https://developer.okta.com/blog/2019/10/21/illustrated-guide-to-oauth-and-oidc)
  • 流程案例: https://www.youtube.com/watch?v=996OiexHze0
  • 流程案例(with docker Keycloak): https://www.bilibili.com/video/BV1334y11739/
    backup https://archive.org/details/keycloakopenid-connectflow-pundefined-output-264
  • 代码: https://www.bilibili.com/video/BV1hP4y1C7w8/
  • How to Hack OAuth - https://www.youtube.com/watch?v=aU9RsE4fcRM
  • news - https://www.youtube.com/watch?v=g_aVPdwBTfw&list=PLshTZo9V1-aEUg2S84KlisJBAyMEoEZ45

文章目录

    • OAuth 2.0
      • terminology
      • example: what's going on throughout the OAuth flow
      • OAuth Server (well-known authorization server)
    • OIDC - OpenID connect
      • example
    • Hack OAuth

OAuth 2.0

Authentication authN —— 认证 Who are you
Authorization authZ —— 授权 What can you do

OAuth 2.0 is a security standard where you give one application permission to access your data in another application instead of giving them your username and password. You can essentially give one app a key that gives them specific permission to access your data do things on your behalf in another application. —— authorization、delegate authorization

在这里插入图片描述

假设一个网站A想要你的联系人目录,你可以把gmail的联系人目录(contacts)给它。这过程就需要gmail授权(authorization)

  • 没登录gmail,登录gmail
  • 登录gmail后,gmail会询问你是否授权
  • 你在gmail点击授权后,生成一个凭证(token)
  • 网站A就可以携带这凭证到gmail中获取你的联系人目录
    • 这一般是网站A后台进行,但协议具体没规定,只规定了gmail可以将你的联系人目录响应给携带token的请求。

OAuth flow: 就是上述(你看得到、看不到)的流程

在这里插入图片描述
在这里插入图片描述

terminology

  • resource owner - you (the data owner)
  • client - 请求授权的应用(上述网站A)
  • authorization server - the application that knows the resource owner where the resource owner already has a account(上述gmail,认证那部分)
  • resource server - the application programming interface (API) (上述gmail,提供数据那部分)
    (⚠resource serverauthorization server可以是不同的!)
  • redirect url - the URL that the authorization server will redirect the resource owner back to after grant permission to the client
  • response type - the type of information the client expects to receive.
    • code (常见) - 直接响应授权代码(authorization code)
  • scope - 授权的范围,由资源服务商(resource server)自己规定
    • 如上述例子中,可以有如下范围
      • read contacts
      • create contact
      • delete contact
      • read profile
  • consent - the authorization server takes the scopes the client is requesting and verifies with the resource owner whether or not they want to give the client permission.
    在这里插入图片描述
  • client id - it is generated by the authorization server and is used to identify the client with the authorization server
  • client secret - a secret password that is generated by the authorization server and only the client and authorization server know. this allows them to secretly share information privately behind the scenes
  • authorization code - a short-lived temporary code the authorization server send back to the client. the client then privately send the authorization code back to the authorization server along with the client secret in exchange for a access token
  • access token - the key the client will use form that point forward to communicate with the resource server. this is like a key or a key card that give the client permission to request data or perform actions with the resource server on your behalf
    在这里插入图片描述

在这里插入图片描述

example: what’s going on throughout the OAuth flow

  1. you (resource owner) want to allow 网站A (client) to access your contacts
  2. the client redirect your browser to the authorization server and include with the request the client id, redirect uri, response type and one or more scopes it needs
  3. the authorization server verifies who you are and if necessary to prompt a login
  4. the authorization server then presents you with a form based on the scopes requested by the client and you have the opportunity to grant or deny permission
  5. the authorization server redirects back to the client using the redirect uri along with a temporary authorization code
  6. the client then contacts the authorization server directly, which means that the client don’t use the your browser and securely sends its client id and client secret and authorization code
  7. the authorization server verifies the data and responds with an access token
  8. the access token is a value the client dosen’t understand as far as the client is concerned the access token is just a string of gibberish. however the client can use the access token to send request to the resource server
  9. the resource server verifies the access token and if valid responds with the data requested by the client

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

OAuth Server (well-known authorization server)

  • https://oauth2.thephpleague.com
  • Google OAuth playground
  • https://openidconnect.net
  • https://developer.okta.com

OIDC - OpenID connect

OAuth 2.0 只设计了授权(authorization)环节。在这个授权环节中,数据请求方(客户端,client)最终只拿到一个可以去取数据的access token。在取得数据前,client都无法知道你(you, resource owner)是谁

OIDC is a thin layer that site on top of OAuth 2.0 that adds functionality around login and profile information about the person who is logging in

instead of a key, OIDC is like giving the client application a badge (标记) the badge not only gives the clients specific permission it also provides some basic information about who you are

在这里插入图片描述

where OAuth enables authorization from one app to another, OIDC enable a client to establish a login session often referred to as authentication as well as to gain information about the person login in the resource owner which is often called identity

when an authorization server supports OIDC is sometimes called an identity provider since it provides information about the resource owner back to the client

OpenID connect enables scenarios where one login can be use across multiple applications also known as single sign-on SSO. for example an application could support SSO with social networking services such as Facebook or Twitter so that users can choose to leverage a login they already have and are comfortable using

在这里插入图片描述

example

  1. you点击client中的授权链接
  2. 💡 client将的的浏览器重定向到authorization server地址,其中scopeopenid (而不再是什么read contacts、delete contact、…)
  3. authorization server校验you
  4. authorization server询问you
  5. authorization serverclient响应authorization code
  6. client携带authorization code和其他信息与authorization server联系
  7. 💡 authorization server校验信息无误后返回access tokenid token
    这里的id token是携带你信息的,这些信息可以被client识别、存储。它的格式一般是json,称为JSON web token,JWT。这里包含的信息成为之claims
    在这里插入图片描述

在这里插入图片描述

3 - 6 stop are same

在这里插入图片描述

通过IODC,client拿到你在resource server中的登录信息

Hack OAuth

RFC 6749 Section 10
RFC 8252 Section 8
RFC 6819
draft-ietf-oauth-security-topics

AppAuth.io

在这里插入图片描述

todo https://blog.csdn.net/LawssssCat/article/details/105065992
todo https://lawsssscat.blog.csdn.net/article/details/106989017
todo https://lawsssscat.blog.csdn.net/article/details/104811038
todo 整理关键词:oauth、auth、认证、…

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SSO、CAS、OAuth、OIDC 的相关文章

随机推荐

  • align-items 与 align-content 的区别

    最明显的区别是align content 适用于多行 xff0c align item 则是适用于单行 align content xff08 单行无效 xff09 可以设置上对齐 下对齐 居中 拉伸 平分剩余空间 xff1b align
  • Apache Traffic Server 简介

    http blog sina com cn s blog 502c8cc40100mw7n html 作者 xff1a 王柯龙 一 介绍 Apache Traffic Server xff08 ATS 或 TS xff09 是一个高 性能
  • 反向代理原理

    局域网主机联入互联网的一种方式 xff0c 使用代理上网可以节约紧缺的IP地址资源 xff0c 而且可以阻断外部主机对内部主机的访问 xff0c 使内部网主机免受外部网主机的攻击 但是 xff0c 如果想让互联网上的主机访问内部网的主机资源
  • SQLite 揭秘

    http msdn microsoft com zh cn magazine ff898405 aspx 孜孜不倦的程序员 SQLite 揭秘 Ted Neward 下载示例代码 为了与本刊主题保持一致 xff0c 现在应该回过头来介绍一下
  • Actor的原理

    http www cnblogs com netfocus p 3365166 html 先从著名的c10k问题谈起 有一个叫Dan Kegel的人在网上 xff08 http www kegel com c10k html xff09 提
  • 【车载开发系列】CAN总线帧种类介绍篇

    车载开发系列 CAN总线帧种类介绍篇 CAN总线帧种类介绍篇 车载开发系列 CAN总线帧种类介绍篇一 CAN总线当中帧的种类二 五种类型帧用途说明三 数据帧的组成1 xff09 帧起始2 xff09 仲裁段3 xff09 控制段4 xff0
  • VS2013 C++ Rest SDK 环境配置方法

    简介 C 43 43 REST SDK 是 Microsoft 的一个开源跨平台项目 xff08 使用 MIT 开源协议 xff09 其使用大量现代异步 C 43 43 API 实现了一个基于 HTTP HTTPS 协议的 服务端 客户端
  • 【日常】FIFA历年四强

    世界杯 xff0c 全称 xff1a 国际足联世界杯 xff08 FIFA World Cup xff09 世界杯每四年举办一次 xff0c 任何国际足联会员国 xff08 地区 xff09 都可以派出代表队报名参加这项赛事 从1930年第
  • 【日常】圣诞节、颜色⛄

    2022年圣诞节到来啦 xff0c 很高兴这次我们又能一起度过 关于圣诞节 x1f384 xff0c 大家想到什么颜色 xff1f x1f98c x1f381 x1f385 x1f525 demo online https codepen
  • 【笔记】openwrt - full cone NAT(全锥NAT)、解决“arp_cache: neighbor table overflow!”

    最近安装了比特彗星 xff08 bitcomet xff09 后 xff0c 老是收到警告说日志的接收超过每秒上限了 一看日志 xff0c 好家伙 xff0c 一堆的kern info kernel 194004 157620 neighb
  • 【记录】ChatGPT使用记录

    文章目录 2023年02月08日数学哲学Java其他 2023年02月09日ChatGPT网络 2023年02月10日算法组网 2023年02月11日ChatGPT xff08 优化目标 xff09 DOS 2023年02月15日影评 xf
  • 简历模板百度网盘自取

    链接 https pan baidu com s 1ptO hJs69ZA8kwdjRUwc7A 提取码 sibc 复制这段内容后打开百度网盘手机App xff0c 操作更方便哦 来自HHppGo的分享
  • 【工具】笔记软件测评(简单)

    介绍 笔记软件测评 印象笔记 开源 markdown xff08 不好用 xff09 本地存储 臭名昭著 xff0c 被资本搞烂的理想 notion 开源 本地存储 数据导出 xff1a PDF HTML Markdown amp CSV
  • 【工具】logseq 使用分享

    Github https github com logseq logseq 我用 logseq 记录的学习笔记 xff1a 战争历史 https lawsssscat github io logseq worldwar 三月八日国际劳动妇女
  • 谈一谈搜索引擎是如何跟踪你、出卖你的

    文章目录 跟踪结果点击跟踪关键词跟踪 other 跟踪 结果点击跟踪 以b网为例 xff0c 当我们搜索关键词 haha 后 xff0c 搜索结果链接是这样子的 xff1a https www baidu com link url 61 X
  • 整理alacritty使用笔记

    github xff1a https github com alacritty alacritty features xff1a https github com alacritty alacritty blob master docs f
  • 整理windows terminal使用笔记

    github xff1a https github com microsoft terminal 之前这篇文章写了windows中powershell的美化 xff0c 过程中安装了windows terminal 这里记录windows
  • 区分/区别:su、su -、sudo、sudo su -

    su和su 的区别 su 不设置环境变量su 设置环境变量 su 和sudo su 的区别 su 输入root用户密码sudo su 输入当前用户密码 xff08 前提 xff1a 当前用户在 etc sudors或 etc sudors
  • 整理ps使用笔记

    尽管使用ps只需要记住常用命令 xff1a ps aux ps ef 并且理解输出的列含义即可 但不理解命令的含义 xff0c 用起来总有种空虚感 下面研究一下 文章目录 介绍BSD默认simpleaxT r listoutput 总结 介
  • SSO、CAS、OAuth、OIDC

    参考 简单了解概念 xff1a https www bilibili com video BV1XG411w7DN 简单了解操作 xff1a https www bilibili com video BV1334y11739 openid