Commit 7a3d222d authored by Spencer Sutton's avatar Spencer Sutton Committed by Sutton
Browse files

CORS fix

commit 161bcddf
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com>
Date: Fri Feb 05 2021 16:08:01 GMT-0600 (Central Standard Time)

    Latest core lib aws

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

    Incrementing to latest core lib aws

commit 119ee593
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com>
Date: Fri Feb 05 2021 12:37:02 GMT-0600 (Central Standard Time)

    Entitlments factory needed to inject HttpResponseBodyMapper

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

    core lib update

commit 7423ad56
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com>
Date: Wed Feb 03 2021 14:58:45 GMT-0600 (Central Standard Time)

    Had it in wrong spot

commit 06a734b1
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com>
Date: Wed Feb 03 2021 14:43:34 GMT-0600 (Central Standard Time)

    Merge branch 'dev' of codecommit::us-east-1://default@os-notification into bug/CORS

commit 2a38d6b8
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com>
Date: Wed Feb 03 2021 14:43:22 GMT-0600 (Central Standard Time)

    Merge branch 'feat/TLS' of codecommit::us-east-1://default@os-notification into bug/CORS

commit 0096382d
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com>
Date: Thu Jan 21 2021 09:46:56 GMT-0600 (Central Standard Time)

    Added filter class

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

    Formatting

commit 9538c071
Author: Bill Wang <wanzhiji@amazon.com>
Date: Mon Jan 04 2021 16:27:35 GMT-0600 (Central Standard Time)

    Squashed commit of the following

commit 04e49a0d
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 28 2020 19:10:30 GMT-0800 (Pacific Standard Time)

    fix Cognito region services

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

commit eaf5dcc4
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 28 2020 13:35:25 GMT-0800 (Pacific Standard Time)

    fix cognito client

commit 9ceee335
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 28 2020 13:20:15 GMT-0800 (Pacific Standard Time)

    bump core service version

commit 30d44fe4
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 21 2020 15:03:10 GMT-0800 (Pacific Standard Time)

    fix pom version

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

    Cors fix

commit d5afc1b8
Author: wanzhiji <wanzhiji@amazon.com>
Date: Tue Dec 22 2020 10:29:39 GMT-0600 (Central Standard Time)

    Squashed commit of the following

commit 30d44fe4
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 21 2020 15:03:10 GMT-0800 (Pacific Standard Time)

    fix pom version

commit 197fe901
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com>
Date: Fri Jan 29 2021 12:48:17 GMT-0600 (Central Standard Time)

    Updating paths

commit f1511504
Author: Sutton <suttonsp@147dda3a90de.ant.amazon.com>
Date: Fri Jan 29 2021 12:43:23 GMT-0600 (Central Standard Time)

    Adding ssl

commit 9bd86a9d
Author: Bill Wang <wanzhiji@amazon.com>
Date: Mon Jan 04 2021 16:27:35 GMT-0600 (Central Standard Time)

    Squashed commit of the following

commit 04e49a0d
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 28 2020 19:10:30 GMT-0800 (Pacific Standard Time)

    fix Cognito region services

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

commit eaf5dcc4
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 28 2020 13:35:25 GMT-0800 (Pacific Standard Time)

    fix cognito client

commit 9ceee335
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 28 2020 13:20:15 GMT-0800 (Pacific Standard Time)

    bump core service version

commit 30d44fe4
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 21 2020 15:03:10 GMT-0800 (Pacific Standard Time)

    fix pom version

commit f0066a25
Author: wanzhiji <wanzhiji@amazon.com>
Date: Tue Dec 22 2020 10:29:39 GMT-0600 (Central Standard Time)

    Squashed commit of the following

commit 30d44fe4
Author: zhijie wang <wanzhiji@amazon.com>
Date: Mon Dec 21 2020 15:03:10 GMT-0800 (Pacific Standard Time)

    fix pom version
parent 2bb268f5
// Copyright © 2020 Amazon Web Services
// Copyright 2017-2019, Schlumberger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.opengroup.osdu.notification.utils;
import org.opengroup.osdu.core.common.http.ResponseHeadersFactory;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.inject.Inject;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
@Component
public class NotificationFilter implements Filter {
@Inject
private DpsHeaders dpsHeaders;
private ResponseHeadersFactory responseHeadersFactory = new ResponseHeadersFactory();
// 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;
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
chain.doFilter(request, response);
HttpServletResponse httpResponse = (HttpServletResponse) response;
this.dpsHeaders.addCorrelationIdIfMissing();
Map<String, String> responseHeaders = responseHeadersFactory.getResponseHeaders(ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS);
for (Map.Entry<String, String> header : responseHeaders.entrySet()) {
httpResponse.setHeader(header.getKey(), header.getValue());
}
httpResponse.addHeader(DpsHeaders.CORRELATION_ID, this.dpsHeaders.getCorrelationId());
}
@Override
public void destroy() {
}
}
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