当前位置:网站首页>Web Security (x) what is OAuth 2.0?
Web Security (x) what is OAuth 2.0?
2022-07-01 05:22:00 【jinyangjie0】
One 、 summary
OAuth 2.0 It's the most popular authorization mechanism , Used to authorize third-party applications , Get user data .
Take the wechat scenario as an example . Wechat stores my friends' information , Third party applications need to get this information , You must be authenticated and authorized by wechat , Request to jump to wechat , Wechat users agree to authorize third-party applications , Get friend information .
In short ,OAuth It's a kind of authorization mechanism . The owner of the data tells the system , Agree to authorize third party applications to enter the system , Get the data . The system then generates a short-term entry token (token), In place of a password , For third party applications .
Two 、 Tokens and passwords
token (token) With the code (password) It's the same thing , You can enter the system , But there are three differences .
(1) The token is short-term , The expiration will automatically lapse , Users can't modify it themselves . Passwords are usually valid for a long time , Users don't modify , It won't change .
(2) The token can be revoked by the data owner , It's going to fail immediately . Passwords are generally not allowed to be revoked by others .
(3) The token has a scope of authority (scope). For Web Services , A read-only token is more secure than a read-write token . Passwords are generally full authority .
The above designs , The token ensures that the third-party application can obtain permission , At the same time, it can be controlled at any time , It won't endanger the system . This is it. OAuth 2.0 The advantages of .
Be careful , As long as you know the token , You can get into the system . The system generally does not reconfirm the identity , therefore Tokens must be kept confidential , The consequences of leaking a token are the same as leaking a password . That's why the validity period of the token , It's usually set very short .
3、 ... and 、OAuth 2.0 Four ways of
OAuth 2.0 There are four processes for obtaining tokens , According to the specific scene , Choose the right way , Issue tokens... To third-party applications .
Authorization code (authorization-code): It means that the third-party application applies for an authorization code first , Then use the code to get the token
Hidden (implicit): Issue a token directly to the front end . There are some WEB Applications are pure front end applications , No back end , The token must be stored on the front end .
Cryptogram (password): Provide the password directly , Request token by password . If you highly trust an app , You can use this method .
Client credentials (client credentials): For command line applications without a front end , That is, request the token at the command line .
Four 、 Update token
The validity of the token has reached , If you ask the user to go through the above process again , Apply for a new token , It's probably not a good experience , And there's no need .OAuth 2.0 Allow users to automatically update tokens .
The way to do it is ,B When the website issues the token , Two tokens at a time , One for getting data , Another is used to get a new token (refresh token Field ). Before the token expires , The user to use refresh token Send a request , To update token .
边栏推荐
- Data consistency between redis and database
- El cascade echo failed; El cascader does not echo
- [daily question in summer] function of rogu p3742 UMI
- Worried about infringement? Must share copyrightless materials on the website. Don't worry about the lack of materials for video clips
- Principle, technology and implementation scheme of data consistency in distributed database
- More than one file was found with OS independent path ‘lib/armeabi-v7a/libyuv.so‘.
- 1076 Forwards on Weibo
- Memtable for leveldb source code analysis
- 0xc000007b应用程序无法正常启动解决方案(亲测有效)
- Buffer stream and transform stream
猜你喜欢

工业导电滑环的应用

Sqlplus connects using the instance name
![[data recovery in North Asia] a data recovery case of raid crash caused by hard disk drop during data synchronization of hot spare disk of RAID5 disk array](/img/22/606ff1e8dad3d5896b32d2146b0477.jpg)
[data recovery in North Asia] a data recovery case of raid crash caused by hard disk drop during data synchronization of hot spare disk of RAID5 disk array

Unity drags and modifies scene camera parameters under the editor

使用 Nocalhost 开发 Rainbond 上的微服务应用

Actual combat: gateway api-2022.2.13

如何创建一个根据进度改变颜色的进度条

el-form表单新增表单项动态校验;el-form校验动态表单v-if不生效;

Copier le matériel de conseils de bébé ne peut pas être vide, comment résoudre?

Rainbow combines neuvector to practice container safety management
随机推荐
担心侵权?必备无版权素材网站分享,不用担心视频剪辑缺素材
LevelDB源码分析之LRU Cache
Global and Chinese markets for business weather forecasting 2022-2028: Research Report on technology, participants, trends, market size and share
El cascade echo failed; El cascader does not echo
Precautions for use of conductive slip ring
How to hide browser network IP address and modify IP internet access?
AcWing 884. Gauss elimination for solving XOR linear equations
Global and Chinese market of 3D design and modeling software 2022-2028: Research Report on technology, participants, trends, market size and share
Serialization and deserialization of objects
[RootersCTF2019]babyWeb
AcWing 889. 01 sequence satisfying the condition (Cartland number)
工业导电滑环的应用
Global and Chinese market for instant messaging security and compliance solutions 2022-2028: Research Report on technology, participants, trends, market size and share
第05天-文件操作函数
Single page application
Distributed - summary list
Global and Chinese market of enterprise wireless LAN 2022-2028: Research Report on technology, participants, trends, market size and share
Print stream and system setout();
Youqitong [vip] v3.7.2022.0106 official January 22 Edition
Actual combat: gateway api-2022.2.13