Commit 30d3d0fb 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 e1a45747
......@@ -19,24 +19,39 @@ package org.opengroup.osdu.notification.auth;
import org.opengroup.osdu.core.common.entitlements.EntitlementsAPIConfig;
import org.opengroup.osdu.core.common.entitlements.EntitlementsFactory;
import org.opengroup.osdu.core.common.entitlements.IEntitlementsFactory;
import org.opengroup.osdu.core.common.http.json.HttpResponseBodyMapper;
import org.opengroup.osdu.notification.provider.interfaces.IAppProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.stereotype.Component;
import javax.inject.Inject;
@Component
public class EntitlementsClientFactory extends AbstractFactoryBean<IEntitlementsFactory> {
@Autowired
private IAppProperties config;
@Value("${AUTHORIZE_API}")
public String AUTHORIZE_API;
@Value("${AUTHORIZE_API_KEY:}")
public String AUTHORIZE_API_KEY;
@Inject
private HttpResponseBodyMapper httpResponseBodyMapper;
@Override
protected IEntitlementsFactory createInstance() {
return new EntitlementsFactory(EntitlementsAPIConfig.builder().rootUrl(config.getAuthorizeAPI()).build());
protected IEntitlementsFactory createInstance() {
return new EntitlementsFactory(EntitlementsAPIConfig
.builder()
.rootUrl(AUTHORIZE_API)
.apiKey(AUTHORIZE_API_KEY)
.build(), httpResponseBodyMapper);
}
@Override
public Class<?> getObjectType() {
return IEntitlementsFactory.class;
}
}
\ No newline at end of file
}
// 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() {
}
}
......@@ -25,7 +25,7 @@
<java.version>8</java.version>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source>
<os-core-common.version>0.3.6</os-core-common.version>
<os-core-common.version>0.3.27</os-core-common.version>
</properties>
<licenses>
......
......@@ -48,7 +48,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>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-secretsmanager -->
......
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