Commit 39b4cef8 authored by Gokul Nagare's avatar Gokul Nagare
Browse files

tenant validation added

parent 2d465ab3
Pipeline #31436 canceled with stages
in 28 minutes and 51 seconds
......@@ -12,10 +12,12 @@ import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.core.common.model.storage.DatastoreQueryResult;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.core.ibm.auth.ServiceCredentials;
import org.opengroup.osdu.core.ibm.cloudant.IBMCloudantClientFactory;
import org.opengroup.osdu.storage.provider.interfaces.IQueryRepository;
......@@ -47,6 +49,9 @@ public class QueryRepositoryImpl implements IQueryRepository {
private Database dbSchema;
private Database dbRecords;
@Inject
private TenantInfo tenant;
@PostConstruct
public void init() throws MalformedURLException{
......@@ -62,6 +67,12 @@ public class QueryRepositoryImpl implements IQueryRepository {
@Override
public DatastoreQueryResult getAllKinds(Integer limit, String cursor) {
try {
tenant.getName();
} catch (Exception e) {
throw new AppException(HttpStatus.SC_UNAUTHORIZED, "not authorized", "not authorized");
}
DatastoreQueryResult result = new DatastoreQueryResult();
String initialId = validateCursor(cursor, dbSchema);
......
Supports Markdown
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