diff --git a/src/test/java/com/isaacandrade/blog/Auth/TestSecurityConfig.java b/src/test/java/com/isaacandrade/blog/Auth/TestSecurityConfig.java new file mode 100644 index 0000000..c8cf96d --- /dev/null +++ b/src/test/java/com/isaacandrade/blog/Auth/TestSecurityConfig.java @@ -0,0 +1,25 @@ +package com.isaacandrade.blog.Auth; + + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +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.configurers.AbstractHttpConfigurer; + +import org.springframework.security.web.SecurityFilterChain; + +@Configuration +@Profile("test") +@EnableWebSecurity +public class TestSecurityConfig{ + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{ + http.csrf(AbstractHttpConfigurer::disable) + .authorizeHttpRequests(auth -> auth.anyRequest().permitAll()); + return http.build(); + } + +}