当前位置:网站首页>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 .
边栏推荐
- Implementation of placing the scroll bar on the top of the uniapp
- 新华三交换机系统基本配置命令
- Flower shop window (linear DP)
- 04 _ In simple terms index (I)
- How to do well in we media? Did you do these steps right?
- 浅析分布式系统之体系结构-事务与隔离级别(多对象、多操作)下篇
- Can we really make money by doing we media editing?
- 如何做好自媒体?这几个步骤你做对了吗?
- 04 _ 深入浅出索引(上)
- Mysql(九)Your password has expired. To log in you must change it using a client that supports expired
猜你喜欢

See from the minute, carve on the details: Exploration of SVG generated vector format website icon (favicon)
![[creation mode] builder mode](/img/8d/989c69772502a3ccda320025236e46.png)
[creation mode] builder mode

回溯法/解空间树 排列树

Backtracking / solution space tree permutation tree

Everything about JS functions

Design and implementation of data analysis system
![[系统安全] 四十二.Powershell恶意代码检测系列 (4)论文总结及抽象语法树(AST)提取](/img/d9/67ad40ba63de8006b67e51b0c82a84.png)
[系统安全] 四十二.Powershell恶意代码检测系列 (4)论文总结及抽象语法树(AST)提取

02 _ 日志系统:一条SQL更新语句是如何执行的?

04 _ In simple terms index (I)

04 _ 深入浅出索引(上)
随机推荐
新华三交换机系统基本配置命令
04 _ In simple terms index (I)
2022 Tibet's latest eight major construction personnel (labor workers) simulation test question bank and answers
Charles自动保存响应数据
Social software soul withdraws its IPO application: Tencent is a major shareholder
企业开发如何写出优雅的二级分类【美团小案例】
Riskscanner of multi Cloud Security compliance scanning platform
Hot seek tiger, a list of eco economic models
Square and storage box (linear DP)
Talk about the principle of QR code scanning login
PHP Apache built-in stress testing tool AB (APACHE bench)
Oauth2的理解
Learn more about and use ThreadLocal
19. 二叉搜索樹的插入删除修剪
【MongoDB】4. Usage specification of mongodb
Summary of redis basic knowledge
Tangzhengrong: CTO is the intersection of business thinking and technical thinking
Qcustomplot 1.0.1 learning (3) - plotting quadratic functions
Implementation of the function of recording login status
19. 二叉搜索树的插入删除修剪