package no.kdrs.grouse.spring;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class CorsConfiguration {

    @Bean
    public WebMvcConfigurer corsConfigurer() {
        // TODO: Should this be configred to only accept requests from localhost
        // behind apache or similar??
        return new WebMvcConfigurerAdapter() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/**")
                        .allowedMethods("*")
                        .allowedHeaders("*");
            }
        };
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}

@@ -429,90 +429,8 @@
 rer;
-%0Aimport org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 %0A%0A@C
@@ -691,15 +691,8 @@
 urer
-Adapter
 () %7B

Deal with deprecated WebMvcConfigurerAdapter