package com.irts.prestations.
config;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
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.EnableW
ebSecurity;
import org.springframework.security.web.SecurityFilterChain;
/**
* Configuration de sécurité désactivée pour les tests
* Active par défaut quand azure.ad.enabled=false
*/
@Configuration
@EnableWebSecurity
@ConditionalOnProperty(name = "azure.ad.enabled", havingValue =
"false", matchIfMissing = true)
public class TestSecurityConfig {
@Bean
public SecurityFilterChain testFilterChain(HttpSecurity http) throws
Exception {
http
.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(authz -> authz
.anyRequest().permitAll()
);
return http.build();