Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the authority management system based on the common components of easy water?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to implement the rights management system based on easy water public components". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to implement the rights management system based on the public components of Yi Shui"!

Quick start

When using spring security, you can refer to the following steps

Add spring security dependencies to the project

Org.springframework.boot spring-boot-starter-security com.yishuifengxiao.common common-spring-boot-starter 4.1.2

2 add the following code to the project

The following code user should be guaranteed to be scanned by @ ComponentScan.

@ Configuration@EnableWebSecuritypublic class SecurityConfig extends AbstractSecurityConfig {@ Override protected void configure (HttpSecurity http) throws Exception {/ / call the default configuration applyAuthenticationConfig (http) in the parent class;}}

The sample code for this code can be found in com.yishuifengxiao.common.security.SecurityConfig

Implement the UserDetailsService interface, complete your authorization logic, and inject it into spring.

[special note] when users do not configure their own authorization logic according to this step, the component will implement a default implementation by default. In the default implementation, the user can log in with any user name with a password (12345678).

4 manage and configure resources

For specific resource rights management, see Resource Management

After adding the above configuration, only the default path built into the component can be authorized, and access to other url will be redirected to the address of / index. For specific configuration and reasons, please refer to the official documentation.

At this point, I believe you have a deeper understanding of "how to implement the rights management system based on public components of Yi Shui". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report