Commit 1a369a0b authored by Spencer Sutton's avatar Spencer Sutton Committed by Sutton
Browse files

CORS fix

commit 7f366c4b 
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com> 
Date: Fri Feb 05 2021 15:48:39 GMT-0600 (Central Standard Time) 

    Incrementing to latest core lib aws


commit 9e50b015 
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com> 
Date: Wed Feb 03 2021 16:25:59 GMT-0600 (Central Standard Time) 

    core lib update


commit 95deb9f9 
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com> 
Date: Wed Feb 03 2021 14:49:05 GMT-0600 (Central Standard Time) 

    Merge


commit 338fbf04 
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com> 
Date: Wed Feb 03 2021 14:46:05 GMT-0600 (Central Standard Time) 

    Cors fix


commit 6186bb72 
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com> 
Date: Thu Jan 21 2021 09:52:18 GMT-0600 (Central Standard Time) 

    Added response headers factory


commit f347fdce 
Author: Bill Wang <wanzhiji@amazon.com> 
Date: Mon Jan 04 2021 16:21:51 GMT-0600 (Central Standard Time) 

    Squashed commit of the following 

commit 93d433a6 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 28 2020 13:30:27 GMT-0800 (Pacific Standard Time) 

    fix Cognito client


commit 56a2c109 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 28 2020 12:15:56 GMT-0800 (Pacific Standard Time) 

    bump core lib version


commit 5a6fc50d 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 28 2020 09:57:31 GMT-0800 (Pacific Standard Time) 

    fix os core lib version


commit 90406044 
Author: zhijie wang <wanzhiji@amazon.com> 
Date: Mon Dec 28 2020 09:56:12 GMT-0800 (Pacific Standard Time) 

    supress maven log
parent 30ad28f7
Pipeline #27286 failed with stages
in 103 minutes and 9 seconds
......@@ -30,7 +30,7 @@
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springfox-version>2.7.0</springfox-version>
<osdu.oscorecommon.version>0.3.23</osdu.oscorecommon.version>
<osdu.oscorecommon.version>0.3.27</osdu.oscorecommon.version>
</properties>
<licenses>
......
......@@ -64,7 +64,7 @@
<dependency>
<groupId>org.opengroup.osdu.core.aws</groupId>
<artifactId>os-core-lib-aws</artifactId>
<version>0.3.16</version>
<version>0.3.17</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
......
package org.opengroup.osdu.register.middleware;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.http.ResponseHeaders;
import org.opengroup.osdu.core.common.http.ResponseHeadersFactory;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.register.utils.AppServiceConfig;
import org.opengroup.osdu.register.utils.ServiceRequestInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.*;
......@@ -14,6 +15,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
@Component
public class RegisterFilter implements Filter {
......@@ -27,6 +29,12 @@ public class RegisterFilter implements Filter {
@Autowired
private AppServiceConfig serviceConfig;
// defaults to * for any front-end, string must be comma-delimited if more than one domain
@Value("${ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS:*}")
String ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS;
private ResponseHeadersFactory responseHeadersFactory = new ResponseHeadersFactory();
@Override
public void init(FilterConfig filterConfig) {
//do nothing
......@@ -41,8 +49,8 @@ public class RegisterFilter implements Filter {
this.headers.addCorrelationIdIfMissing();
Map<String, List<Object>> standardHeaders = ResponseHeaders.STANDARD_RESPONSE_HEADERS;
for (Map.Entry<String, List<Object>> header : standardHeaders.entrySet()) {
Map<String, String> responseHeaders = responseHeadersFactory.getResponseHeaders(ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS);
for(Map.Entry<String, String> header : responseHeaders.entrySet()){
httpResponse.addHeader(header.getKey(), header.getValue().toString());
}
httpResponse.addHeader(DpsHeaders.CORRELATION_ID, this.headers.getCorrelationId());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment