Код: Выделить всё
@Configuration
public class SecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.cors(cors -> cors.configurationSource(request -> {
CorsConfiguration config = new CorsConfiguration();
config.setAllowedOrigins(List.of("http://localhost:8080"));
config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
config.setAllowCredentials(true); // Allow cookies or authentication headers
config.setAllowedHeaders(List.of("Authorization", "Content-Type", "X-Requested-With"));
return config;
}))
.csrf().disable() // Disable CSRF
.authorizeHttpRequests(auth -> auth
.requestMatchers("/saml2/**").permitAll() // Allow SAML endpoints
.requestMatchers("/login/**").permitAll() // Allow SAML endpoints
.requestMatchers("https://localhost:8080/**").permitAll() // Allow SAML endpoints
.anyRequest().authenticated() // Adjust based on your requirements
);
return http.build();
}
}
Я также пытался поиграться с запросами , добавил в код некоторые другие проблемы с переполнением стека. Но пока ничего не помогло.
Подробнее здесь: https://stackoverflow.com/questions/793 ... -dont-work
Мобильная версия