当前位置:网站首页>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 !
边栏推荐
- Apt update and apt upgrade commands - what is the difference?
- [set theory] relational closure (reflexive closure | symmetric closure | transitive closure)
- [teacher Zhao Yuqiang] calculate aggregation using MapReduce in mongodb
- Txt document download save as solution
- Detailed explanation of findloadedclass
- [teacher Zhao Yuqiang] use the catalog database of Oracle
- Skywalking8.7 source code analysis (I): agent startup process, agent configuration loading process, custom class loader agentclassloader, plug-in definition system, plug-in loading
- 【一起上水硕系列】Day 10
- Detailed explanation of contextclassloader
- 最大似然估计,散度,交叉熵
猜你喜欢
Loss function in pytorch multi classification
Method of finding prime number
[teacher Zhao Yuqiang] calculate aggregation using MapReduce in mongodb
Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
深度学习,从一维特性输入到多维特征输入引发的思考
项目总结--01(接口的增删改查;多线程的使用)
2022.DAY592
Kubernetes notes (VI) kubernetes storage
Strategy pattern: encapsulate changes and respond flexibly to changes in requirements
Redhat7系统root用户密码破解
随机推荐
2022.DAY592
最大似然估计,散度,交叉熵
Apple submitted the new MAC model to the regulatory database before the spring conference
Jedis source code analysis (II): jediscluster module source code analysis
Disruptor learning notes: basic use, core concepts and principles
多线程与高并发(7)——从ReentrantLock到AQS源码(两万字大章,一篇理解AQS)
MySQL 5.7.32-winx64 installation tutorial (support installing multiple MySQL services on one host)
[teacher Zhao Yuqiang] MySQL flashback
Maximum likelihood estimation, divergence, cross entropy
How to create your own repository for software packages on Debian
The server data is all gone! Thinking caused by a RAID5 crash
Configure DTD of XML file
Common exceptions when Jenkins is released (continuous update...)
Solve the 1251 client does not support authentication protocol error of Navicat for MySQL connection MySQL 8.0.11
Installation du plug - in CAD et chargement automatique DLL, Arx
[written examination question analysis] | | get [sizeof and strlen] [pointer and array] graphic explanation + code analysis
[set theory] relational closure (reflexive closure | symmetric closure | transitive closure)
Final review Day8
BeanDefinitionRegistryPostProcessor
Personal outlook | looking forward to the future from Xiaobai's self analysis and future planning