当前位置:网站首页>Oauth2.0 - explanation of simplified mode, password mode and client mode
Oauth2.0 - explanation of simplified mode, password mode and client mode
2022-07-03 06:01:00 【Xiao bichao】
One 、OAuth2.0
In the last article, we have discussed OAuth2.0 I explained , And the authentication process of authorization code mode , And built a simple authentication service and resource service , In the previous article, we only explained the authentication login mode of authorization code , This article is about simplifying patterns 、 Password mode 、 Client mode these three modes are demonstrated and explained , Here is the address of the last article :
In the preparation of the previous article , We have released all models to c1 This customer id, So in the demonstration of the following mode, we can directly use the project built in the previous article :
Two 、 Simplified mode
The simplified mode is relative to the authorization code mode , It reduces the exchange through authorization code Token Steps for .
The resource owner opens the client , The client requires authorization from the resource owner , It redirects the browser to the authorization server , The identity information of the client will be attached during redirection
The browser displays the authorize to authorization server page , After that, the user agrees to authorize .
The authorization server sends the authorization code to the token (access_token) With Hash In the form of redirection uri Of fargment Send to browser .
Generally speaking , Simplified mode is used for third-party single page applications without server side , Because no server can receive authorization code .
characteristic
- Simple . The process is simple
- For pure front end applications
- unsafe . A bit careless ,Token Can be obtained by malicious scripts
- Token The validity period is short , When the browser is closed, it will fail
Browser access :
http://localhost:8020/oauth/authorize?client_id=c1&response_type=token&scope=all&redirect_uri=http://www.baidu.com
In the address bar, you can see the returned token:
Use Token Access resource interface :
3、 ... and 、 Password mode
- The resource owner will the user name 、 The password is sent to the client
- The client holds the user name of the resource owner 、 The password requests a token from the authorization server (access_token)
This model is very simple , But it means directly leaking sensitive user information to client, So this shows that this model can only be used for client It's our own development . So password patterns are generally used for our own development , The first is native App Or first party single page applications .
characteristic :
- Need to enter account password , Extremely unsafe , Third party applications need to be highly trusted
- It is applicable to situations where other authorization modes cannot be adopted
Use PostMan send out POST request :
http://localhost:8020/oauth/token?client_id=c1&client_secret=secret&grant_type=password&username=admin&password=1234
Use Token Access resource interface :
Four 、 Client mode
- The client sends its own identity information to the authorization server , And request a token (access_token)
- After confirming that the identity of the client is correct , Put the token (access_token) Send to client
This is the most convenient but insecure mode . So this requires us to be right client Complete trust , and client It's also safe . So this pattern is generally used to provide server-side services that we fully trust . such as , Partner system docking , Pull a set of user information .
characteristic
- The authorization dimension is the application dimension , Not user dimension . Therefore, it is possible for multiple users to share one Token The situation of
- Shared resources applicable to application dimensions
Use PostMan send out POST request :
http://localhost:8020/oauth/token?client_id=c1&client_secret=secret&grant_type=client_credentials
Use Token Access resource interface :
Love little buddy can pay attention to my personal WeChat official account. , Get more learning materials !
边栏推荐
- [branch and cycle] | | super long detailed explanation + code analysis + a trick game
- 伯努利分布,二项分布和泊松分布以及最大似然之间的关系(未完成)
- Apache+php+mysql environment construction is super detailed!!!
- Btrfs and ext4 - features, strengths and weaknesses
- [teacher Zhao Yuqiang] kubernetes' probe
- Why should there be a firewall? This time xiaowai has something to say!!!
- 从小数据量 MySQL 迁移数据到 TiDB
- QT read write excel -- qxlsx insert chart 5
- MySQL 5.7.32-winx64 installation tutorial (support installing multiple MySQL services on one host)
- [teacher Zhao Yuqiang] the most detailed introduction to PostgreSQL architecture in history
猜你喜欢
Kubernetes notes (II) pod usage notes
Redhat7 system root user password cracking
Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
Kubernetes cluster environment construction & Deployment dashboard
Together, Shangshui Shuo series] day 9
Kubernetes notes (III) controller
[teacher Zhao Yuqiang] the most detailed introduction to PostgreSQL architecture in history
@Import annotation: four ways to import configuration classes & source code analysis
[teacher Zhao Yuqiang] kubernetes' probe
Understand expectations (mean / estimate) and variances
随机推荐
智牛股项目--05
Why should there be a firewall? This time xiaowai has something to say!!!
项目总结--01(接口的增删改查;多线程的使用)
Together, Shangshui Shuo series] day 9
[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation
[teacher Zhao Yuqiang] Flink's dataset operator
Redis cannot connect remotely.
Apt update and apt upgrade commands - what is the difference?
[teacher Zhao Yuqiang] Cassandra foundation of NoSQL database
Bio, NiO, AIO details
Core principles and source code analysis of disruptor
Final review (Day6)
[function explanation (Part 1)] | | knowledge sorting + code analysis + graphic interpretation
[teacher Zhao Yuqiang] use the catalog database of Oracle
Personal outlook | looking forward to the future from Xiaobai's self analysis and future planning
[trivia of two-dimensional array application] | [simple version] [detailed steps + code]
PHP用ENV获取文件参数的时候拿到的是字符串
Analysis of Clickhouse mergetree principle
Txt document download save as solution
Clickhouse learning notes (I): Clickhouse installation, data type, table engine, SQL operation