Код: Выделить всё
package com.api.business_manager_api.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http
.csrf().disable()
.authorizeHttpRequests(
authorizeConfig -> {
authorizeConfig.requestMatchers("/user").permitAll();
authorizeConfig.anyRequest().authenticated();
})
.httpBasic()
.and()
.build();
}
}
< /code>
Однако, несмотря на это, я не могу сделать запрос почтальона по маршруту, поскольку он возвращает несанкционированную ошибку 401. Но если я использую armitall () Подробнее здесь: https://stackoverflow.com/questions/755 ... one-to-acc