SSO、CAS、OAuth、OIDC

news2024/9/20 22:32:19

在这里插入图片描述

参考

  • 简单了解概念: 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
  • 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、认证、…

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/467706.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

conda虚拟环境配置

文章目录 1 下载Anaconda2 创建自己的虚拟环境3 配置自己的虚拟环境 1 下载Anaconda 直接官网下载 Anaconda官网 2 创建自己的虚拟环境 可以直接在anaconda软件上添加 还可以通过命令行指令,打开终端输入conda create -n 名字 python3.7 3 配置自己的虚拟环境…

大厂高频面试:底层的源码逻辑知多少?

你好,我是何辉。今天我们来聊一聊Dubbo的大厂高频面试题。 大厂面试,一般重点考察对技术理解的深度,和中小厂的区别在于,不仅要你精于实战,还要你深懂原理,勤于思考并针对功能进行合理的设计。 网上一直流…

一文读懂RabbitMQ消息队列

一.什么是消息队列 1.简介 在介绍消息队列之前,应该先了解什么是 AMQP(Advanced Message Queuing Protocol, 高级消息队列协议,点击查看) 消息(Message)是指在应用间 传送的数据,消息可以非常简单&#xff…

【Golang开发入门】你真的会用Go写“Hello world“吗?

博主简介:努力学习的大一在校计算机专业学生,热爱学习和创作。目前在学习和分享:数据结构、Go,Java等相关知识。博主主页: 是瑶瑶子啦所属专栏: Go语言核心编程近期目标:写好专栏的每一篇文章 目录 一、Go项…

Zynq-7000、FMQL45T900的GPIO控制(六)---linux驱动层配置GPIO输入输出控制

本文使用的驱动代码 Zynq-7000、FMQL45T900的GPIO控制(六)-linux驱动层配置GPIO输入输出控制资源-CSDN文库 在Zynq-7000、FMQL45T900驱动层也时常会用到对GPIO的控制,这里就针对实际使用的情况进行说明,首先根据之前的帖子确实使…

监测HDD smart信息的脚本编写

最近需要完成一个测试HDD的项目,因为接的HDD太多,手动查看smart信息太麻烦,所以需要写一个自动帮我们检查smart信息的脚本。此遍文章只介绍直连或者JBOD模式下的信息监测,没有涉及到组RAID模式。 1 首先看下HDD的smart信息&#x…

谁在成为产业经济发展的推车人?

区域发展的新蓝图中,京东云能做什么?它的角色是什么?这个问题背后,隐藏的不仅是京东云自身的能力和价值,更是其作为中国互联网云厂商的代表之一,对“技术产业”的新论证。 作者|皮爷 出品|产业家 关于云…

饮用水中的六价铬去除工艺

铬是人体必需的微量元素,天然水不含铬,海水中铬的平均浓度为0.05μg/L,饮用水中铬含量更低。 铬在水中主要以三价和六价形式存在,三价的铬是对人体有益的元素,而六价铬是有毒的。由于其毒性之高,已被国家列…

固定转向和行进速度下的车辆轨迹计算方法

游戏车辆固定转向轨迹计算 概述 车辆游戏是我们经常接触到的一类游戏,这里游戏在只用键盘操作时,往往非常不方便。这是因为这一类游戏大部分都是按下按键时转向,释放按键时方向就会自动转正。这种控制方式在实现方面比较容易。但是缺点也很明…

如何实现Canvas图像的拖拽、点击等操作

上一篇Canvas的博文写完后,有位朋友希望能对Canvas绘制出来的图像进行点击、拖拽等操作,因为Canvas绘制出的图像能很好的美化。好像是想做炉石什么的游戏,我也没玩过。 Canvas在我的理解中就好像在一张画布上绘制图像,它只能看到…

MySQL用的在溜,不知道业务如何设计也白搭!!!

MySQL业务设计 作者: 博学谷狂野架构师GitHub:GitHub地址 (有我精心准备的130本电子书PDF) 只分享干货、不吹水,让我们一起加油!😄 逻辑设计 范式设计 范式概述 第一范式:当关系模式R的所有属…

浙江省CIO峰会|数据安全+数字化转型,美创特色实践获“年度数字化赋能服务商”

近日,浙江省CIO年度峰会暨数实融合创新发展大会在杭州成功举办。美创科技受邀参加本次峰会,与全省数字化领袖人才共话数字化发展。 对话数字化转型 美创分享能力实践 在本次峰会以“数字化转型的昨天 今天 明天”为主题的论坛对话环节,美创科…

Win11启用docker报错

这里写自定义目录标题 An unexpected error was encountered while executing a WSLcommand. An unexpected error was encountered while executing a WSLcommand. An unexpected error was encountered while executing a WSLcommand. provisioning docker WSL distros: se…

M2M场景之客户端凭证模式|OIDC OAuth2.0 认证协议最佳实践系列 【4】

在前两篇文章中,我们介绍了 OIDC 授权码以及授权码增强的 PKCE 模式,本次我们将重点围绕 (Client Credentials) 模式进行讲解 ,Client Credentials 模式是 OIDC 授权模式之一,它是一种用于客户端&#xff0…

微信小程序开发一个多少钱

小程序开发是当前比较流行的一项技术服务,能够为企业和个人带来巨大的商业价值和社会价值,但是小程序开发费用也是潜在的成本之一。在选择小程序开发服务时,了解开发费用如何计算、影响价格的因素以及如何降低成本等方面的知识,可…

055:cesium两种方法加载天地影像图

第055个 点击查看专栏目录 本示例的目的是介绍如何在vue+cesium中用两种方法加载天地影像图。一种是利用WebMapTileServiceImageryProvider,另一种是利用UrlTemplateImageryProvider. 直接复制下面的 vue+cesium源代码,操作2分钟即可运行实现效果. 文章目录 示例效果配置方…

bug记录:c++ mysql Connector:Lost connection to MySQL server during query

1.背景 使用mysql connector1.1.4版本,代码中有 mysql 连接池,每次执行 sql 时从连接池取出一个连接,先用isClosed()判断为false继续使用,否则创建新连接。     现在升级 mysql connector为1.1.13版本,业务代码未修…

Linux进程概念——其二

目录 环境变量 基本概念 常见环境变量 查看环境变量方法 测试PATH[重点] 测试HOME 和环境变量相关的命令 环境变量的组织方式 通过代码获取环境变量 通过系统调用获取或设置环境变量 环境变量通常是具有全局属性的[重点&#xff3d…

学会笔记本电脑录屏快捷键,轻松实现录屏!

案例:笔记本电脑录屏有快捷键吗? 【我每次打开笔记本电脑录屏都要耗费比较长的时间,这样会影响到我录屏的效率。在这里想问一下,有没有快速打开电脑录屏的方法?】 在日常的工作、学习、娱乐中,我们经常需…

算法训练第一周题解汇总

A - Sort the Subarray 大意:在s1找一个最大的 [l,r] 子区间,使其经过从小到大的排序后 能够变成 s2 题解:先确定最小的区间,然后慢慢扩大。 最小区间的确定:s1和s2第一个不相等的数开始,到最后…