Commits (10)
include:
- project: 'osdu/platform/ci-cd-pipelines'
ref: 'master'
ref: 'v0.7.0'
file: 'standard-setup.yml'
- project: 'osdu/platform/ci-cd-pipelines'
ref: 'master'
ref: 'v0.7.0'
file: 'build/maven.yml'
- project: 'osdu/platform/ci-cd-pipelines'
ref: 'master'
ref: 'v0.7.0'
file: 'scanners/gitlab-ultimate.yml'
- project: 'osdu/platform/ci-cd-pipelines'
ref: 'master'
file: 'scanners/fossa.yml'
ref: 'v0.7.0'
file: 'scanners/fossa-maven.yml'
- project: 'osdu/platform/ci-cd-pipelines'
ref: 'master'
ref: 'v0.7.0'
file: 'publishing/pages.yml'
......@@ -20,6 +20,7 @@ The following software have components provided under the terms of this license:
- Apache Groovy (from http://groovy-lang.org)
- Apache HttpAsyncClient (from http://hc.apache.org/httpcomponents-asyncclient)
- Apache HttpClient (from http://hc.apache.org/httpcomponents-client)
- Apache HttpClient Cache (from http://hc.apache.org/httpcomponents-client)
- Apache HttpCore (from http://hc.apache.org/httpcomponents-core-ga)
- Apache HttpCore NIO (from http://hc.apache.org/httpcomponents-core-ga)
- Apache Log4j API (from )
......@@ -175,7 +176,7 @@ The following software have components provided under the terms of this license:
- Spring Core (from https://github.com/spring-projects/spring-framework)
========================================================================
CC-BY-3.0
CC-BY-2.5
========================================================================
The following software have components provided under the terms of this license:
......@@ -196,11 +197,17 @@ The following software have components provided under the terms of this license:
- tomcat-embed-core (from http://tomcat.apache.org/)
========================================================================
EPL-1.0
CPL-1.0
========================================================================
The following software have components provided under the terms of this license:
- JUnit (from http://junit.org)
========================================================================
EPL-1.0
========================================================================
The following software have components provided under the terms of this license:
- Logback Classic Module (from )
- Logback Core Module (from )
- SnakeYAML (from http://www.snakeyaml.org)
......@@ -331,5 +338,6 @@ unknown
The following software have components provided under the terms of this license:
- Byte Buddy (without dependencies) (from )
- JUnit (from http://junit.org)
......@@ -7,20 +7,18 @@
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-lib-ibm</artifactId>
<version>${os-core-lib-ibm.version}</version>
<version>0.7.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/>
<relativePath />
</parent>
<name>os-core-lib-ibm</name>
......@@ -30,8 +28,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<os-core-common.version>0.3.6</os-core-common.version>
<os-core-lib-ibm.version>0.3.6-SNAPSHOT</os-core-lib-ibm.version>
<os-core-common.version>0.3.8</os-core-common.version>
<os-core-lib-ibm.version>0.6.0-SNAPSHOT</os-core-lib-ibm.version>
</properties>
<licenses>
......
// Copyright 2020 IBM Corp. All Rights Reserved.
//
// 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.core.ibm.middleware;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.google.api.client.util.Strings;
@Component
public class PartitionIdFilter implements Filter {
private static final Logger logger = LoggerFactory.getLogger(PartitionIdFilter.class);
@Autowired
private DpsHeaders dpsHeaders;
@Value("${ibm.health-check-uri}")
private String healthCheckURIs;
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
this.dpsHeaders.addCorrelationIdIfMissing();
logger.info("In Parttion ID Filte, the uris from config"+healthCheckURIs);
HttpServletRequest httpServletRequest = (HttpServletRequest)request;
logger.info("Actual Request URI:"+httpServletRequest.getRequestURI());
String currentUrl = httpServletRequest.getRequestURI();
String[] redirectBypassUrlsList = healthCheckURIs.split(",");
boolean isCurrentUrlBypassedForRedirect = false;
for (int i = 0; i < redirectBypassUrlsList.length; i++) {
if (currentUrl.equalsIgnoreCase(redirectBypassUrlsList[i])) {
isCurrentUrlBypassedForRedirect = true;
break;
}
}
if (Strings.isNullOrEmpty(this.dpsHeaders.getPartitionIdWithFallbackToAccountId()) && !isCurrentUrlBypassedForRedirect) {
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
httpServletResponse.setStatus(HttpStatus.SC_UNAUTHORIZED);
} else {
chain.doFilter(request, response);
}
}
@Override
public void destroy() {
}
}
\ No newline at end of file
......@@ -43,4 +43,27 @@ public class IdentityClient {
return null;
}
}
//Role - users.datalake.editors
public static String getTokenForUserWithEditorsAccess() {
try {
String user = Config.getEnvironmentVariable("AUTH_USER_EDITORS_ACCESS");
String pass = Config.getEnvironmentVariable("AUTH_USER_EDITORS_ACCESS_PASSWORD");
return KeyCloakProvider.getToken(user, pass);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
//Role - users.datalake.admins
public static String getTokenForUserWithAdminsAccess() {
try {
String user = Config.getEnvironmentVariable("AUTH_USER_ADMINS_ACCESS");
String pass = Config.getEnvironmentVariable("AUTH_USER_ADMINS_ACCESS_PASSWORD");
return KeyCloakProvider.getToken(user, pass);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}