/*
 * SystemConfig.java
 *
 * Copyright (C) 2018 [ A Legge Up ]
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

package com.aleggeup.confagrid.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SystemConfig {

    protected static final String CORS_MAPPING = "/**";
    protected static final String CORS_ALLOWED_ORIGINS = "http://localhost:4200";

    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(final CorsRegistry registry) {
                registry.addMapping(CORS_MAPPING).allowedOrigins(CORS_ALLOWED_ORIGINS);
            }
        };
    }
}

@@ -488,16 +488,65 @@
 gurer;%0A%0A
+import com.aleggeup.confagrid.filter.JwtFilter;%0A%0A
 @Configu
@@ -959,16 +959,37 @@
 MAPPING)
+%0A                    
 .allowed
@@ -1017,16 +1017,151 @@
 ORIGINS)
+%0A                    .allowedHeaders(%22*%22)%0A                    .exposedHeaders(JwtFilter.HEADER_CLAIMS, JwtFilter.HEADER_CLAIMS_SUBJECT)
 ;%0A      

Add allowed and exposed headers to response headers for CORS