当前位置:网站首页>Daily blog - wechat service permission 12 matters
Daily blog - wechat service permission 12 matters
2022-06-11 15:37:00 【Little craftsman】
List of articles

Concept popularization
About permissions , Let's start with a few core concepts
- authentication
- to grant authorization
- authentication
authentication
for instance : enter one user name / password , Click to log in , The business logic executed in the background is authentication ----------> Verify user name / Is the password correct , Can I log in to the system , This is authentication
to grant authorization
for instance : Different users have different permissions through system authorization , Authorization is to grant permission to related users or roles to operate resources , Of course, there are also many third-party system licenses .
authentication
for instance ; The same system , After different people log in successfully , The permissions are different , When the user operates , The background will verify whether the corresponding operation can be performed , This is authentication , namely Verify whether the user has the operation permission of the corresponding resource .

For monomer application authentication 、 to grant authorization 、 authentication
We know : The core of the permission problem is to solve authentication 、 Authentication and authorization issues .
Let's first look at how to deal with the above problems in monomer applications .
How to handle authentication
In monomer application , For user login , The user name will be verified first / password , It usually involves the encryption of passwords , The general judgment is whether the corresponding password after encryption is equal to the password stored in the database , If it's equal , Login succeeded .
If the user logs in successfully , Generally, it will return the credentials related to the user's successful login .
- If it is JWT Words , Will return Token
- If conversation is used , Will pass Set-Cookie return SessionId To the client
How authorization is handled
In monomer applications , Authorization is to modify user related role information , Or modify the role related permission information . Generally, after the user logs in again , The latest permission information takes effect .
How to handle authentication
Single applications usually pass through interceptors (Spring Security、Apache Shrio They are essentially interceptors ), Block user requests .
In this case, the authentication scheme will also be JWT still HTTP Sessions are handled separately
- If it is JWT Words , The user information will be obtained through decryption
- If it is a conversational way , According to the conversation ID, From storage ( It's usually Redis) To get user information .
Either way , Finally, the permission verification is performed on the corresponding request according to the user information .
Generally, there are two authentication methods , But it's all role-based .
One is Implicit role-based authentication , namely Directly determine whether you have the operation permission of the corresponding resource according to the role , For example, the role is administrator , You can delete the user , The role is an ordinary user , Only user information can be viewed .
This is generally applicable in simple systems , A common way is through annotations , Indicate which interface can be accessed by which role . But this method will become difficult to maintain in complex systems .The other is Accurate role-based authentication , Such authentication scheme , Roles are usually assigned explicit permissions , The corresponding authentication method is Find out the specific permission set according to the user role , Then make further judgment . This method is more effective and convenient in complex systems .

Under the microservice Architecture authentication 、 to grant authorization 、 authentication
In microservices , Authentication of permission processing 、 Authorization function implementation , No difference with single application .
边栏推荐
- safePoint讲解及其安插思路分析
- Implementation of the function of recording login status
- [mysql_11] addition, deletion and modification of data processing
- Don't you understand the design and principle of thread pool? Break it up and crush it. I'll teach you how to design the thread pool
- The research results of Professor xuweixin from the school of atmosphere of Sun Yat sen University on extreme precipitation caused by weak convection were reported by science highlights
- Flower shop window (linear DP)
- Design and implementation of data analysis system
- Implementation of gray-scale publishing scheme for microservice architecture based on gateway and Nacos
- 线程实战入门【硬核慎入!】
- 02 _ Log system: how does an SQL UPDATE statement execute?
猜你喜欢

Design and implementation of data analysis system

High number_ Chapter 6 infinite series__ Marklaurin series

2022.02.28

uniapp開發微信小程序,從構建到上線

uniapp开发微信小程序,从构建到上线

2022 Tibet's latest junior firefighter simulation test question bank and answers

Implementation of the function of recording login status
![[azure application service] nodejs express + msal realizes the authentication experiment of API Application token authentication (AAD oauth2 idtoken) -- passport authenticate()](/img/11/7262211654680512dae0a9a696740e.png)
[azure application service] nodejs express + msal realizes the authentication experiment of API Application token authentication (AAD oauth2 idtoken) -- passport authenticate()

Station B executives interpret the financial report: the epidemic has no impact on the company's long-term development, and the video trend is irresistible

Google Earth engine (GEE) - create a simple panel demo to display the map
随机推荐
Qcustomplot 1.0.1 learning (3) - plotting quadratic functions
[process blocks and methods of SystemVerilog] ~ domain, always process block, initial process block, function, task, life cycle
How can local retail release the "imprisoned value" and make physical stores grow again?
企业开发如何写出优雅的二级分类【美团小案例】
uniapp滚动条置顶实现
06 _ 全局锁和表锁 :给表加个字段怎么有这么多阻碍?
基于STM32F1的开源小项目
我的代码变量名称统一 记录
How to do well in we media? Did you do these steps right?
[SystemVerilog interface] ~ interface
[creation mode] builder mode
Let me tell you the benefits of code refactoring
07 _ 行锁功过:怎么减少行锁对性能的影响?
回溯法/活动安排 最大兼容活动
思科瑞递交科创板注册:拟募资6亿 年营收2.22亿
In June, 2019, cat teacher's report on monitoring
【创建型模式】单例模式
高数_第6章无穷级数__马克劳林级数
Riskscanner of multi Cloud Security compliance scanning platform
[creation mode] abstract factory mode