SecurityConfig.java

  1. package no.nav.data.common.security;

  2. import org.springframework.context.annotation.Bean;
  3. import org.springframework.context.annotation.Configuration;
  4. import org.springframework.web.servlet.config.annotation.CorsRegistry;
  5. import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

  6. @Configuration
  7. public class SecurityConfig {

  8.     @Bean
  9.     public Encryptor encryptor(SecurityProperties securityProperties) {
  10.         return new Encryptor(securityProperties.getEncKey());
  11.     }

  12.     @Bean
  13.     public WebMvcConfigurer corsConfigurer() {
  14.         return new WebMvcConfigurer() {
  15.             @Override
  16.             public void addCorsMappings(CorsRegistry registry) {
  17.                 registry.addMapping("/oauth2/callback")
  18.                         .allowedOrigins("*");
  19.             }
  20.         };
  21.     }
  22. }