package fr.insee.rmes.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@EnableWebSecurity
public class SecurityContext extends WebSecurityConfigurerAdapter {

	@Value("${fr.insee.rmes.force.ssl}")
	Boolean requiresSSL;

	@Override
	protected void configure(HttpSecurity http) throws Exception {

		if (requiresSSL) {
			http.antMatcher("/**").requiresChannel().anyRequest().requiresSecure();
		}

	}
}

@@ -677,16 +677,77 @@
 Secure()
+.and().csrf().disable();;%0A%09%09%7D else %7B%0A%09%09%09http.csrf().disable()
 ;%0A%09%09%7D%0A%0A%09

Disable CSRF