当前位置:网站首页>SSO and oauth2 solutions
SSO and oauth2 solutions
2022-06-22 01:05:00 【Cliven_】
1. SSO And OAuth2
Single sign on System Single sign-on (SSO) : Simply put, it is a system that does not need to log in to other systems repeatedly after logging in to one system design idea , One of the more famous implementations is CAS System .
OAuth2: It's a Open standards , This standard constrains a way for a user to allow a third application to access a user's resources in an application without providing a user name and password , In short, it's a 3 It is a relatively standardized process method for applying authentication and accessing user resources .
SSO And OAuth2 There's no comparison ,SSO It's a design idea ,OAuth2 It is a protocol for authentication and authorization of specific resources .
We can design a mechanism , To realize the single sign on system , use OAuth2 Protocol to do user authentication .
2. The fusion
The design idea of single sign on is as follows :
To put it simply, you can log in and access all connected systems with one account , Users do not need to authenticate again to access other applications after they are authenticated to enter the single sign on system .
OAuth2 Authorization code of Authorization code mode , It provides a more secure way to access user resources , This method needs to jump from the logged in system to the logged in system through connection , Then through authentication and authorization , Another application system passes Token Get user information , If yes OAuth Unfamiliar can refer to 《 understand OAuth 2.0 Ruan Yifeng 》
RFC6749
1.2. Protocol Flow
+--------+ +---------------+
| |--(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 ---| |
+--------+ +---------------+
4.1 Authorization Code Grant
+----------+
| Resource |
| Owner |
| |
+----------+
^
|
(B)
+----|-----+ Client Identifier +---------------+
| -+----(A)-- & Redirection URI ---->| |
| User- | | Authorization |
| Agent -+----(B)-- User authenticates --->| Server |
| | | |
| -+----(C)-- Authorization Code ---<| |
+-|----|---+ +---------------+
| | ^ v
(A) (C) | |
| | | |
^ v | |
+---------+ | |
| |>---(D)-- Authorization Code ---------' |
| Client | & Redirection URI |
| | |
| |<---(E)----- Access Token -------------------'
+---------+ (w/ Optional Refresh Token)
Usually we put Certification services And Resource service Put it all together , If we plot the above process with a sequence diagram , The effect is as follows :

adopt OAuth2 Generally speaking, the protocol is that the virtual user accesses the login page of the target application system first , Jump to the authentication server through the link on the login page to perform authentication and authorization operations , The application system only needs to provide one when docking with the system Standard callback interface Can be realized OAuth Docking .
But there is a problem with this approach : Users need to execute every application they access OAuth2 A whole process , To access multiple systems, you need to OAuth2 The authentication service has been authenticated for many times .
To achieve single sign on Log in to access all at once Design idea , We need to be right about OAuth2 Some processes have been adjusted , Requirements are as follows :
- Users no longer need to log in to the single sign on service , No need to enter other applications alone .
- After logging in, the user accesses the application through the connection of the single sign on service page , No re authentication is required during login .
- The application system only needs to connect to the single sign on system according to the standard OAuth2 Protocol docking .
Adjusted and integrated OAuth2 The single sign on sequence of is as follows :

- The user login SSO System, not application system .
- After authentication, enter the system list to display the docked applications
- After the user clicks apply ,SSO The callback address provided by the system according to the application registration , according to OAuth2 The protocol returns a redirect request with an authorization code .
- The browser redirects to the... Of the application system OAuth2 Standard interface , The rest of the process is similar to OAuth2 The agreement is consistent .
The scheme only needs to be well designed SSO System certification 、 User session management 、 When applying jump 301 Redirection process , Other and OAuth2 bring into correspondence with .
In the past OAuth2 Docking applications , In such a process, any adjustment is disordered , The newly docked application system is in accordance with OAuth2 Provided by agreement Standard callback interface Can be realized OAuth Docking , By high compatibility .
reference
[1]. understand OAuth 2.0 . Ruan Yifeng . 2014.05 . https://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html
[2]. ietf . RFC6749 The OAuth 2.0 Authorization Framework . 2012.10 . https://datatracker.ietf.org/doc/html/rfc6749#section-4.1
边栏推荐
- English语法_副词 - loud /aloud / loudly
- pytorch学习09:矩阵基本运算
- Pytorch learning 05: indexing and slicing
- 对“基于tensorflow+RNN的新浪新闻文本分类”一文的图示化理解
- Xshell比SecureCRT差吗?
- In the operation exchange of the points system, which behaviors of users can obtain points
- 判断系统CPU是否空闲
- isnull() ifnull() nullif()
- 【DailyFresh】课程记录2
- 导电滑环是如何工作的
猜你喜欢

数字化转型的下一个目标:提供准时制信息

Go Technology Daily (June 20, 2022) -- go: simple optimization notes

【环境踩坑】pycharm使用qt时报错

合理选择液压滑环密封间隙的重要性

Install easyx-vc2019

Pytorch learning 11:where and gather

How to use through-hole conductive slip ring

0x00007ffff3d3ecd0 in Io Vfprintf Interne (S = 0x7ffff40b5620 < io 2 1 stdout >

Pytorch learning 07:broadcast broadcast - automatic extension
![[examination skills] memory method and simple derivation of Green formula](/img/26/f28a9f4abaca94988845b3fdaaf571.png)
[examination skills] memory method and simple derivation of Green formula
随机推荐
Introduction to redis Series 7 - expiration policy
Bit operation bit or
聚宽 - 简单策略试验
判断系统CPU是否空闲
消息队列之取消会议和自动退款处理
HDOJ - Is It A Tree?
LVGL的一些介绍和移植
Go技术日报(2022-06-20)——Go:简单的优化笔记
【环境踩坑】No module named ‘PyQt5‘
Meetup03 review: introduction to the new version of linkis and the application practice of DSS
Graphical understanding of the article "text classification of Sina News Based on tensorflow+rnn"
0x00007ffff3d3ecd0 in _IO_vfprintf_internal (s=0x7ffff40b5620 <_IO_2_1_stdout_>
VScode 中查看本地ip地址
0x00007ffff3d3ecd0 in Io Vfprintf Interne (S = 0x7ffff40b5620 < io 2 1 stdout >
Pytorch learning 05: indexing and slicing
MSVC与GCC的差异(收集中)
[其他] 浅析ELF中的GOT与PLT
Are Huishang futures accounts reliable? How can a novice safely open an account?
pytorch学习12:自动求导
第八章 习题(45A)【微机原理】【习题】