增加同意验证,但是没有成功

This commit is contained in:
2025-08-07 10:18:28 +08:00
parent d2e479b9f8
commit ad85efaa74
7 changed files with 167 additions and 57 deletions

View File

@@ -25,10 +25,11 @@ public class SecurityConfig {
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(auth -> auth
.requestMatchers("/public/**").permitAll()
.requestMatchers("/admin/**").hasRole("ADMIN")
.requestMatchers("/user/**").hasAnyRole("USER", "ADMIN")
.anyRequest().authenticated()
.requestMatchers("/public/**").permitAll()
.requestMatchers("/admin/**").hasRole("ADMIN")
// .requestMatchers("/user/**").hasAnyRole("USER", "ADMIN")
.requestMatchers("/user/**").permitAll()
.anyRequest().authenticated()
);
return http.build();
}