fix(security): 添加注释说明

This commit is contained in:
vertoryao 2024-05-21 15:07:53 +08:00
parent 200ad5b2d4
commit c82f92d3b6
2 changed files with 4 additions and 0 deletions

View File

@ -61,6 +61,7 @@ public class SpringSecurityConfig {
filter.setAuthenticationFailureHandler(customAuthenticationFailureHandler); filter.setAuthenticationFailureHandler(customAuthenticationFailureHandler);
filter.setFilterProcessesUrl("/api/rest/user/login"); filter.setFilterProcessesUrl("/api/rest/user/login");
filter.setAuthenticationManager(authenticationManager()); filter.setAuthenticationManager(authenticationManager());
// 将登录后的请求信息保存到Session中不然会报null
filter.setSecurityContextRepository(new HttpSessionSecurityContextRepository()); filter.setSecurityContextRepository(new HttpSessionSecurityContextRepository());
return filter; return filter;
} }

View File

@ -3,11 +3,14 @@ package com.zsc.edu.bill;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import java.util.ArrayList;
@SpringBootTest @SpringBootTest
class BillApplicationTests { class BillApplicationTests {
@Test @Test
void contextLoads() { void contextLoads() {
} }
} }