Getting to Know Spring Security

A heavyweight security management framework

1. The configuration is cumbersome

2. The concept is cumbersome

Advantage:

1. Security

In SSM, Spring Security is less used because of cumbersome configuration. However, Spring Boot has made automatic configuration for Spring Security, so in Boot, security is used a lot.

Let me take you to write a simple example

Create a Spring Boot project and add the following dependencies to the project

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

A web dependency and a security dependency.

Create a new interface to visit

 

 Entered the login page, at this point, we did nothing, the project already exists on the login page.

The default username is user, and the password is in the following location

 

 

 login successful

Logout is also written for you, access the logout interface in the address bar

 

 

 Back to the login page.

We can simply set our own account password in the configuration file

 

 When you set your own account password, the console will no longer print the password.

At this time, the login account password becomes your own setting.

admin 123456

Guess you like

Origin blog.csdn.net/a2285786446/article/details/131120615