You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by is...@apache.org on 2022/06/24 21:19:33 UTC
[airavata-custos] branch berametal updated: merge integration services
This is an automated email from the ASF dual-hosted git repository.
isjarana pushed a commit to branch berametal
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
The following commit(s) were added to refs/heads/berametal by this push:
new b4606ce5 merge integration services
new df485229 Merge pull request #287 from isururanawaka/berametalWithMerge
b4606ce5 is described below
commit b4606ce58b740c404a323d5a92d5fbbaf0e3234b
Author: Isuru Ranawaka <ir...@gmail.com>
AuthorDate: Fri Jun 24 17:18:31 2022 -0400
merge integration services
---
.../src/main/dist/bin/custos-daemon.sh | 4 +-
.../src/main/dist/bin/custos.sh | 2 +-
.../dist/conf/keycloak-client-truststore.pkcs12 | Bin 1687 -> 1687 bytes
.../main/dist/conf/vault-client-truststore.pkcs12 | Bin 1626 -> 1687 bytes
.../services/api/CoreServicesServer.java | 6 +-
.../resources/keycloak-client-truststore.pkcs12 | Bin 0 -> 1687 bytes
.../main/resources/vault-client-truststore.pkcs12 | Bin 0 -> 1687 bytes
.../profile/validator/AgentInputValidator.java | 4 +-
.../service/ClusterManagementService.java | 58 ++++++++------
.../validator/ClusterManagementInputValidator.java | 6 +-
.../store/service/CredentialStoreService.java | 34 ++++-----
.../validator/CredentialStoreInputValidator.java | 16 +---
.../{ => api}/commons/ServiceInterceptor.java | 14 ++--
.../services/{ => api}/commons/StatusUpdater.java | 19 +++--
.../core/services/{ => api}/commons/Validator.java | 12 +--
.../exceptions/MissingParameterException.java | 12 +--
.../commons/persistance/model/OperationStatus.java | 12 +--
.../commons/persistance/model/StatusEntity.java | 12 +--
.../repository/StatusUpdaterRepository.java | 14 ++--
.../services/{ => api}/commons/util/Constants.java | 12 +--
.../api/commons/util/MethodNameExtractor.java | 28 +++++++
.../services/commons/util/MethodNameExtractor.java | 9 ---
.../validator/CustosLoggingInputValidator.java | 12 +--
.../service/FederatedAuthenticationService.java | 6 +-
.../FederatedAuthenticationInputValidator.java | 14 +---
.../apache/custos/iam/service/IamAdminService.java | 8 +-
.../custos/iam/validator/IAMInputValidator.java | 60 +--------------
.../identity/validator/IdentityInputValidator.java | 27 +------
.../secret/service/ResourceSecretService.java | 4 +-
.../validator/ResourceSecretInputValidator.java | 14 +---
.../sharing/validator/SharingInputValidator.java | 28 +------
.../validator/TenantProfileInputValidator.java | 2 +-
.../validators/UserProfileInputValidator.java | 28 +------
.../services/clients/keycloak/KeycloakClient.java | 12 +--
.../services/clients/keycloak/KeycloakUtils.java | 54 +++++++-------
.../AgentManagementUserAuthInterceptorImpl.java | 83 ++++++++++++++++-----
.../commons/interceptors/LoggingInterceptor.java | 12 ++-
.../service/IdentityManagementService.java | 1 -
custos-rest-proxy/src/main/resources/envoy.yaml | 6 +-
39 files changed, 270 insertions(+), 375 deletions(-)
diff --git a/custos-core-services-server/src/main/dist/bin/custos-daemon.sh b/custos-core-services-server/src/main/dist/bin/custos-daemon.sh
index 838cfad3..a7233c05 100644
--- a/custos-core-services-server/src/main/dist/bin/custos-daemon.sh
+++ b/custos-core-services-server/src/main/dist/bin/custos-daemon.sh
@@ -33,7 +33,7 @@ SUBSET=""
DEFAULT_LOG_FILE="${AIRAVATA_HOME}/logs/custos-daemon.out"
LOG_FILE=$DEFAULT_LOG_FILE
-SERVICE_NAME="DRMS"
+SERVICE_NAME="Custos"
PID_PATH_NAME="${AIRAVATA_HOME}/bin/service-pid"
case $1 in
@@ -98,7 +98,7 @@ case $1 in
fi
;;
-h)
- echo "Usage: orch-api-server-daemon.sh"
+ echo "Usage: custos-daemon.sh"
echo "command options:"
echo " start Start server in daemon mode"
diff --git a/custos-core-services-server/src/main/dist/bin/custos.sh b/custos-core-services-server/src/main/dist/bin/custos.sh
index af09d68c..2c780ede 100644
--- a/custos-core-services-server/src/main/dist/bin/custos.sh
+++ b/custos-core-services-server/src/main/dist/bin/custos.sh
@@ -51,7 +51,7 @@ do
fi
;;
-h)
- echo "Usage: drms.sh"
+ echo "Usage: custos.sh"
echo "command options:"
echo " -xdebug Start DRMS Server under JPDA debugger"
diff --git a/custos-core-services-server/src/main/dist/conf/keycloak-client-truststore.pkcs12 b/custos-core-services-server/src/main/dist/conf/keycloak-client-truststore.pkcs12
index 47016448..7b45d5e2 100644
Binary files a/custos-core-services-server/src/main/dist/conf/keycloak-client-truststore.pkcs12 and b/custos-core-services-server/src/main/dist/conf/keycloak-client-truststore.pkcs12 differ
diff --git a/custos-core-services-server/src/main/dist/conf/vault-client-truststore.pkcs12 b/custos-core-services-server/src/main/dist/conf/vault-client-truststore.pkcs12
index ebd754fc..95cb1b2c 100644
Binary files a/custos-core-services-server/src/main/dist/conf/vault-client-truststore.pkcs12 and b/custos-core-services-server/src/main/dist/conf/vault-client-truststore.pkcs12 differ
diff --git a/custos-core-services-server/src/main/java/org/apache/custos/integration/services/api/CoreServicesServer.java b/custos-core-services-server/src/main/java/org/apache/custos/core/services/api/CoreServicesServer.java
similarity index 96%
rename from custos-core-services-server/src/main/java/org/apache/custos/integration/services/api/CoreServicesServer.java
rename to custos-core-services-server/src/main/java/org/apache/custos/core/services/api/CoreServicesServer.java
index 9624f17f..7bc4723b 100644
--- a/custos-core-services-server/src/main/java/org/apache/custos/integration/services/api/CoreServicesServer.java
+++ b/custos-core-services-server/src/main/java/org/apache/custos/core/services/api/CoreServicesServer.java
@@ -17,12 +17,12 @@
* under the License.
*/
-package org.apache.custos.integration.services.api;
+package org.apache.custos.core.services.api;
import io.grpc.ServerInterceptor;
import org.apache.custos.agent.profile.validator.AgentInputValidator;
import org.apache.custos.cluster.management.validator.ClusterManagementInputValidator;
-import org.apache.custos.core.services.commons.ServiceInterceptor;
-import org.apache.custos.core.services.commons.Validator;
+import org.apache.custos.core.services.api.commons.ServiceInterceptor;
+import org.apache.custos.core.services.api.commons.Validator;
import org.apache.custos.credential.store.validator.CredentialStoreInputValidator;
import org.apache.custos.federated.authentication.validator.FederatedAuthenticationInputValidator;
import org.apache.custos.iam.validator.IAMInputValidator;
diff --git a/custos-core-services-server/src/main/resources/keycloak-client-truststore.pkcs12 b/custos-core-services-server/src/main/resources/keycloak-client-truststore.pkcs12
new file mode 100644
index 00000000..7b45d5e2
Binary files /dev/null and b/custos-core-services-server/src/main/resources/keycloak-client-truststore.pkcs12 differ
diff --git a/custos-core-services-server/src/main/resources/vault-client-truststore.pkcs12 b/custos-core-services-server/src/main/resources/vault-client-truststore.pkcs12
new file mode 100644
index 00000000..95cb1b2c
Binary files /dev/null and b/custos-core-services-server/src/main/resources/vault-client-truststore.pkcs12 differ
diff --git a/custos-core-services/agent-profile-core-service/src/main/java/org/apache/custos/agent/profile/validator/AgentInputValidator.java b/custos-core-services/agent-profile-core-service/src/main/java/org/apache/custos/agent/profile/validator/AgentInputValidator.java
index 16039044..2a10cd39 100644
--- a/custos-core-services/agent-profile-core-service/src/main/java/org/apache/custos/agent/profile/validator/AgentInputValidator.java
+++ b/custos-core-services/agent-profile-core-service/src/main/java/org/apache/custos/agent/profile/validator/AgentInputValidator.java
@@ -20,8 +20,8 @@
package org.apache.custos.agent.profile.validator;
import org.apache.custos.agent.profile.service.AgentRequest;
-import org.apache.custos.core.services.commons.Validator;
-import org.apache.custos.core.services.commons.exceptions.MissingParameterException;
+import org.apache.custos.core.services.api.commons.Validator;
+import org.apache.custos.core.services.api.commons.exceptions.MissingParameterException;
import org.springframework.stereotype.Component;
/**
diff --git a/custos-core-services/cluster-management-core-service/src/main/java/org/apache/custos/cluster/management/service/ClusterManagementService.java b/custos-core-services/cluster-management-core-service/src/main/java/org/apache/custos/cluster/management/service/ClusterManagementService.java
index e620928f..d4899f9a 100644
--- a/custos-core-services/cluster-management-core-service/src/main/java/org/apache/custos/cluster/management/service/ClusterManagementService.java
+++ b/custos-core-services/cluster-management-core-service/src/main/java/org/apache/custos/cluster/management/service/ClusterManagementService.java
@@ -27,13 +27,18 @@ import io.kubernetes.client.apis.CoreV1Api;
import io.kubernetes.client.models.V1Secret;
import io.kubernetes.client.util.ClientBuilder;
import org.apache.custos.cluster.management.service.ClusterManagementServiceGrpc.ClusterManagementServiceImplBase;
-import org.apache.custos.core.services.commons.StatusUpdater;
+import org.apache.custos.core.services.api.commons.StatusUpdater;
import org.lognet.springboot.grpc.GRpcService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSocketFactory;
+import java.security.PublicKey;
+import java.security.cert.Certificate;
import java.util.Map;
@GRpcService
@@ -44,39 +49,44 @@ public class ClusterManagementService extends ClusterManagementServiceImplBase {
@Autowired
private StatusUpdater statusUpdater;
- @Value("${custos.server.secret.name:tls-services-secret}")
- private String custosServerSecretName;
-
- @Value("${custos.server.kube.namespace:custos}")
- private String custosNameSpace;
+ @Value("${custos.server.host:dev.services.usecustos.org}")
+ private String custosServerHostName;
@Override
public void getCustosServerCertificate(org.apache.custos.cluster.management.service.GetServerCertificateRequest request,
StreamObserver<org.apache.custos.cluster.management.service.GetServerCertificateResponse> responseObserver) {
try {
- ApiClient client = ClientBuilder.cluster().build();
-
- // set the global default api-client to the in-cluster one from above
- Configuration.setDefaultApiClient(client);
-
- // the CoreV1Api loads default api-client from global configuration.
- CoreV1Api api = new CoreV1Api();
-
- String namespace = request.getNamespace();
- String secretName = request.getSecretName();
-
-
- V1Secret secret = api.readNamespacedSecret(secretName.isEmpty() ? custosServerSecretName : secretName,
- namespace.isEmpty() ? custosNameSpace : namespace, null, null, null);
- Map<String, byte[]> map = secret.getData();
- byte[] cert = map.get("tls.crt");
- if (cert == null || cert.length == 0) {
+// ApiClient client = ClientBuilder.cluster().build();
+//
+// // set the global default api-client to the in-cluster one from above
+// Configuration.setDefaultApiClient(client);
+//
+// // the CoreV1Api loads default api-client from global configuration.
+// CoreV1Api api = new CoreV1Api();
+//
+// String namespace = request.getNamespace();
+// String secretName = request.getSecretName();
+//
+//
+// V1Secret secret = api.readNamespacedSecret(secretName.isEmpty() ? custosServerSecretName : secretName,
+// namespace.isEmpty() ? custosNameSpace : namespace, null, null, null);
+// Map<String, byte[]> map = secret.getData();
+// byte[] cert = map.get("tls.crt");
+
+ SSLSocketFactory factory = HttpsURLConnection.getDefaultSSLSocketFactory();
+ SSLSocket socket = (SSLSocket) factory.createSocket(custosServerHostName, 443);
+ socket.startHandshake();
+ Certificate[] certs = socket.getSession().getPeerCertificates();
+ Certificate cert = certs[0];
+ PublicKey key = cert.getPublicKey();
+
+ if (cert == null || cert.getEncoded().length == 0) {
GetServerCertificateResponse response = GetServerCertificateResponse.newBuilder().build();
responseObserver.onNext(response);
responseObserver.onCompleted();
} else {
- String certificate = new String(cert);
+ String certificate = new String(cert.getEncoded());
GetServerCertificateResponse response = GetServerCertificateResponse
.newBuilder()
.setCertificate(certificate)
diff --git a/custos-core-services/cluster-management-core-service/src/main/java/org/apache/custos/cluster/management/validator/ClusterManagementInputValidator.java b/custos-core-services/cluster-management-core-service/src/main/java/org/apache/custos/cluster/management/validator/ClusterManagementInputValidator.java
index d6f794bd..de162458 100644
--- a/custos-core-services/cluster-management-core-service/src/main/java/org/apache/custos/cluster/management/validator/ClusterManagementInputValidator.java
+++ b/custos-core-services/cluster-management-core-service/src/main/java/org/apache/custos/cluster/management/validator/ClusterManagementInputValidator.java
@@ -21,8 +21,7 @@ package org.apache.custos.cluster.management.validator;
import org.apache.commons.lang.NotImplementedException;
import org.apache.custos.cluster.management.service.GetServerCertificateRequest;
-import org.apache.custos.core.services.commons.Validator;
-import org.apache.custos.core.services.commons.exceptions.MissingParameterException;
+import org.apache.custos.core.services.api.commons.Validator;
import org.springframework.stereotype.Component;
/**
@@ -44,9 +43,6 @@ public class ClusterManagementInputValidator implements Validator {
case "getCustosServerCertificate":
validateGetCustosServerCertificate(obj, methodName);
break;
- default:
- throw new NotImplementedException("UnImplemented method");
-
}
return obj;
diff --git a/custos-core-services/credential-store-core-service/src/main/java/org/apache/custos/credential/store/service/CredentialStoreService.java b/custos-core-services/credential-store-core-service/src/main/java/org/apache/custos/credential/store/service/CredentialStoreService.java
index 683e6a9d..df03e022 100644
--- a/custos-core-services/credential-store-core-service/src/main/java/org/apache/custos/credential/store/service/CredentialStoreService.java
+++ b/custos-core-services/credential-store-core-service/src/main/java/org/apache/custos/credential/store/service/CredentialStoreService.java
@@ -21,8 +21,8 @@ package org.apache.custos.credential.store.service;
import io.grpc.Status;
import io.grpc.stub.StreamObserver;
-import org.apache.custos.core.services.commons.StatusUpdater;
-import org.apache.custos.core.services.commons.persistance.model.StatusEntity;
+import org.apache.custos.core.services.api.commons.StatusUpdater;
+import org.apache.custos.core.services.api.commons.persistance.model.StatusEntity;
import org.apache.custos.credential.store.credential.CredentialManager;
import org.apache.custos.credential.store.model.Credential;
import org.apache.custos.credential.store.model.CredentialTypes;
@@ -82,7 +82,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
OperationStatus secretStatus = OperationStatus.newBuilder().setState(true).build();
statusUpdater.updateStatus(Operations.PUT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.SUCCESS,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.SUCCESS,
request.getOwnerId(),
null);
@@ -97,7 +97,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.PUT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -110,7 +110,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.PUT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -220,7 +220,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
OperationStatus secretStatus = OperationStatus.newBuilder().setState(true).build();
statusUpdater.updateStatus(Operations.DELETE_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.SUCCESS,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.SUCCESS,
request.getOwnerId(),
null);
responseObserver.onNext(secretStatus);
@@ -230,7 +230,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
String msg = " operation failed for " + request.getOwnerId();
statusUpdater.updateStatus(Operations.DELETE_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -285,7 +285,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
+ request.getOwnerId();
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.GENERATE_CUSTOS_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -295,7 +295,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
statusUpdater.updateStatus(Operations.GENERATE_CUSTOS_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.SUCCESS,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.SUCCESS,
request.getOwnerId(),
null);
@@ -306,7 +306,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
+ request.getOwnerId();
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.GENERATE_CUSTOS_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -728,7 +728,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
+ request.getOwnerId();
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.GENERATE_AGENT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -741,7 +741,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
String msg = "Prohibited agent Id " + request.getId();
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.GENERATE_AGENT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -763,7 +763,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
+ request.getOwnerId();
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.GENERATE_AGENT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -780,7 +780,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
+ request.getId() + "at tenant " + request.getOwnerId();
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.GENERATE_AGENT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
@@ -790,7 +790,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
statusUpdater.updateStatus(Operations.GENERATE_AGENT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.SUCCESS,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.SUCCESS,
request.getOwnerId(),
null);
@@ -841,7 +841,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
OperationStatus secretStatus = OperationStatus.newBuilder().setState(true).build();
statusUpdater.updateStatus(Operations.DELETE_AGENT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.SUCCESS,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.SUCCESS,
request.getOwnerId(),
null);
responseObserver.onNext(secretStatus);
@@ -852,7 +852,7 @@ public class CredentialStoreService extends CredentialStoreServiceImplBase {
String msg = " Delete agent credential failed " + ex;
LOGGER.error(msg);
statusUpdater.updateStatus(Operations.DELETE_AGENT_CREDENTIAL.name(),
- org.apache.custos.core.services.commons.persistance.model.OperationStatus.FAILED,
+ org.apache.custos.core.services.api.commons.persistance.model.OperationStatus.FAILED,
request.getOwnerId(),
null);
responseObserver.onError(Status.INTERNAL.withDescription(msg).asRuntimeException());
diff --git a/custos-core-services/credential-store-core-service/src/main/java/org/apache/custos/credential/store/validator/CredentialStoreInputValidator.java b/custos-core-services/credential-store-core-service/src/main/java/org/apache/custos/credential/store/validator/CredentialStoreInputValidator.java
index 8dde5ca8..62ecf55c 100644
--- a/custos-core-services/credential-store-core-service/src/main/java/org/apache/custos/credential/store/validator/CredentialStoreInputValidator.java
+++ b/custos-core-services/credential-store-core-service/src/main/java/org/apache/custos/credential/store/validator/CredentialStoreInputValidator.java
@@ -20,7 +20,7 @@
package org.apache.custos.credential.store.validator;
-import org.apache.custos.core.services.commons.Validator;
+import org.apache.custos.core.services.api.commons.Validator;
import org.apache.custos.credential.store.exceptions.MissingParameterException;
import org.apache.custos.credential.store.service.*;
import org.springframework.stereotype.Component;
@@ -92,8 +92,6 @@ public class CredentialStoreInputValidator implements Validator {
throw new MissingParameterException("Type cannot be null at " + method, null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
}
@@ -111,8 +109,6 @@ public class CredentialStoreInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
}
@@ -128,8 +124,6 @@ public class CredentialStoreInputValidator implements Validator {
throw new MissingParameterException("Type cannot be null at " + method, null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
@@ -142,8 +136,6 @@ public class CredentialStoreInputValidator implements Validator {
throw new MissingParameterException("OwnerId cannot be null at " + method, null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
@@ -156,8 +148,6 @@ public class CredentialStoreInputValidator implements Validator {
throw new MissingParameterException("Token cannot be null at " + method, null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
@@ -170,8 +160,6 @@ public class CredentialStoreInputValidator implements Validator {
throw new MissingParameterException("OwnerId cannot be null at " + method, null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
@@ -183,8 +171,6 @@ public class CredentialStoreInputValidator implements Validator {
if (request.getId() == null || request.getId().equals("")) {
throw new MissingParameterException("Client Id cannot be null at " + method, null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
}
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/ServiceInterceptor.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/ServiceInterceptor.java
similarity index 87%
rename from custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/ServiceInterceptor.java
rename to custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/ServiceInterceptor.java
index f1b7d8fd..af6c8b30 100644
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/ServiceInterceptor.java
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/ServiceInterceptor.java
@@ -7,20 +7,20 @@
* "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
+ * 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
+ * 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.apache.custos.core.services.commons;
+package org.apache.custos.core.services.api.commons;
import io.grpc.*;
-import org.apache.custos.core.services.commons.exceptions.MissingParameterException;
+import org.apache.custos.core.services.api.commons.exceptions.MissingParameterException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/StatusUpdater.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/StatusUpdater.java
similarity index 70%
rename from custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/StatusUpdater.java
rename to custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/StatusUpdater.java
index a0ecf4ae..a4e17c57 100644
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/StatusUpdater.java
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/StatusUpdater.java
@@ -7,25 +7,24 @@
* "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
+ * 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
+ * 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.apache.custos.core.services.commons;
+package org.apache.custos.core.services.api.commons;
-import org.apache.custos.core.services.commons.persistance.model.OperationStatus;
-import org.apache.custos.core.services.commons.persistance.model.StatusEntity;
-import org.apache.custos.core.services.commons.persistance.repository.StatusUpdaterRepository;
+import org.apache.custos.core.services.api.commons.persistance.model.OperationStatus;
+import org.apache.custos.core.services.api.commons.persistance.model.StatusEntity;
+import org.apache.custos.core.services.api.commons.persistance.repository.StatusUpdaterRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
import java.util.List;
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/Validator.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/Validator.java
similarity index 63%
rename from custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/Validator.java
rename to custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/Validator.java
index 612c5d5b..9c0a4599 100644
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/Validator.java
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/Validator.java
@@ -7,17 +7,17 @@
* "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
+ * 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
+ * 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.apache.custos.core.services.commons;
+package org.apache.custos.core.services.api.commons;
public interface Validator {
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/exceptions/MissingParameterException.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/exceptions/MissingParameterException.java
similarity index 66%
rename from custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/exceptions/MissingParameterException.java
rename to custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/exceptions/MissingParameterException.java
index 5424abf4..df0dddc5 100644
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/exceptions/MissingParameterException.java
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/exceptions/MissingParameterException.java
@@ -7,17 +7,17 @@
* "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
+ * 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
+ * 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.apache.custos.core.services.commons.exceptions;
+package org.apache.custos.core.services.api.commons.exceptions;
/**
* Missing Parameter
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/model/OperationStatus.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/model/OperationStatus.java
similarity index 61%
rename from custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/model/OperationStatus.java
rename to custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/model/OperationStatus.java
index 8342c87c..4fafedeb 100644
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/model/OperationStatus.java
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/model/OperationStatus.java
@@ -7,17 +7,17 @@
* "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
+ * 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
+ * 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.apache.custos.core.services.commons.persistance.model;
+package org.apache.custos.core.services.api.commons.persistance.model;
public enum OperationStatus {
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/model/StatusEntity.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/model/StatusEntity.java
similarity index 85%
rename from custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/model/StatusEntity.java
rename to custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/model/StatusEntity.java
index fb268c69..b8543379 100644
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/model/StatusEntity.java
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/model/StatusEntity.java
@@ -7,17 +7,17 @@
* "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
+ * 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
+ * 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.apache.custos.core.services.commons.persistance.model;
+package org.apache.custos.core.services.api.commons.persistance.model;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/repository/StatusUpdaterRepository.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/repository/StatusUpdaterRepository.java
similarity index 64%
rename from custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/repository/StatusUpdaterRepository.java
rename to custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/repository/StatusUpdaterRepository.java
index fc96854f..bb7eae5f 100644
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/persistance/repository/StatusUpdaterRepository.java
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/persistance/repository/StatusUpdaterRepository.java
@@ -7,19 +7,19 @@
* "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
+ * 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
+ * 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.apache.custos.core.services.commons.persistance.repository;
+package org.apache.custos.core.services.api.commons.persistance.repository;
-import org.apache.custos.core.services.commons.persistance.model.StatusEntity;
+import org.apache.custos.core.services.api.commons.persistance.model.StatusEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/util/Constants.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/util/Constants.java
similarity index 72%
rename from custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/util/Constants.java
rename to custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/util/Constants.java
index de0daad8..67817c63 100644
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/util/Constants.java
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/util/Constants.java
@@ -7,17 +7,17 @@
* "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
+ * 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
+ * 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.apache.custos.core.services.commons.util;
+package org.apache.custos.core.services.api.commons.util;
public final class Constants {
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/util/MethodNameExtractor.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/util/MethodNameExtractor.java
new file mode 100644
index 00000000..31b7387d
--- /dev/null
+++ b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/api/commons/util/MethodNameExtractor.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.custos.core.services.api.commons.util;
+
+public class MethodNameExtractor {
+
+ public static String getMethodName (String methodName) {
+ String[] names = methodName.split("/");
+ return names[names.length - 1];
+ }
+}
diff --git a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/util/MethodNameExtractor.java b/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/util/MethodNameExtractor.java
deleted file mode 100644
index 53ba4037..00000000
--- a/custos-core-services/custos-core-services-commons/src/main/java/org/apache/custos/core/services/commons/util/MethodNameExtractor.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.apache.custos.core.services.commons.util;
-
-public class MethodNameExtractor {
-
- public static String getMethodName (String methodName) {
- String[] names = methodName.split("/");
- return names[names.length - 1];
- }
-}
diff --git a/custos-core-services/custos-logging/src/main/java/org/apache/custos/logging/validator/CustosLoggingInputValidator.java b/custos-core-services/custos-logging/src/main/java/org/apache/custos/logging/validator/CustosLoggingInputValidator.java
index 21f7455e..fb10aede 100644
--- a/custos-core-services/custos-logging/src/main/java/org/apache/custos/logging/validator/CustosLoggingInputValidator.java
+++ b/custos-core-services/custos-logging/src/main/java/org/apache/custos/logging/validator/CustosLoggingInputValidator.java
@@ -19,8 +19,8 @@
package org.apache.custos.logging.validator;
-import org.apache.custos.core.services.commons.Validator;
-import org.apache.custos.core.services.commons.exceptions.MissingParameterException;
+import org.apache.custos.core.services.api.commons.Validator;
+import org.apache.custos.core.services.api.commons.exceptions.MissingParameterException;
import org.apache.custos.logging.service.LogEvent;
import org.apache.custos.logging.service.LogEventRequest;
import org.apache.custos.logging.service.LoggingConfigurationRequest;
@@ -81,8 +81,6 @@ public class CustosLoggingInputValidator implements Validator {
if (entityTypeRequest.getExternalIp() == null || entityTypeRequest.getExternalIp().equals("")) {
throw new MissingParameterException("External Ip not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -93,8 +91,6 @@ public class CustosLoggingInputValidator implements Validator {
if (entityTypeRequest.getTenantId() == 0) {
throw new MissingParameterException("Tenant Id not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -105,8 +101,6 @@ public class CustosLoggingInputValidator implements Validator {
if (entityTypeRequest.getTenantId() == 0) {
throw new MissingParameterException("Tenant Id not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -117,8 +111,6 @@ public class CustosLoggingInputValidator implements Validator {
if (entityTypeRequest.getTenantId() == 0) {
throw new MissingParameterException("Tenant Id not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
diff --git a/custos-core-services/federated-authentication-core-service/src/main/java/org/apache/custos/federated/authentication/service/FederatedAuthenticationService.java b/custos-core-services/federated-authentication-core-service/src/main/java/org/apache/custos/federated/authentication/service/FederatedAuthenticationService.java
index 8b5754c2..4159e4a9 100644
--- a/custos-core-services/federated-authentication-core-service/src/main/java/org/apache/custos/federated/authentication/service/FederatedAuthenticationService.java
+++ b/custos-core-services/federated-authentication-core-service/src/main/java/org/apache/custos/federated/authentication/service/FederatedAuthenticationService.java
@@ -20,9 +20,9 @@
package org.apache.custos.federated.authentication.service;
import io.grpc.stub.StreamObserver;
-import org.apache.custos.core.services.commons.StatusUpdater;
-import org.apache.custos.core.services.commons.persistance.model.OperationStatus;
-import org.apache.custos.core.services.commons.persistance.model.StatusEntity;
+import org.apache.custos.core.services.api.commons.StatusUpdater;
+import org.apache.custos.core.services.api.commons.persistance.model.OperationStatus;
+import org.apache.custos.core.services.api.commons.persistance.model.StatusEntity;
import org.apache.custos.federated.authentication.exceptions.FederatedAuthenticationServiceException;
import org.apache.custos.federated.authentication.mapper.ModelMapper;
import org.apache.custos.federated.authentication.persistance.model.CILogonInstitution;
diff --git a/custos-core-services/federated-authentication-core-service/src/main/java/org/apache/custos/federated/authentication/validator/FederatedAuthenticationInputValidator.java b/custos-core-services/federated-authentication-core-service/src/main/java/org/apache/custos/federated/authentication/validator/FederatedAuthenticationInputValidator.java
index 8b31dd99..7acc12b5 100644
--- a/custos-core-services/federated-authentication-core-service/src/main/java/org/apache/custos/federated/authentication/validator/FederatedAuthenticationInputValidator.java
+++ b/custos-core-services/federated-authentication-core-service/src/main/java/org/apache/custos/federated/authentication/validator/FederatedAuthenticationInputValidator.java
@@ -20,7 +20,7 @@
package org.apache.custos.federated.authentication.validator;
-import org.apache.custos.core.services.commons.Validator;
+import org.apache.custos.core.services.api.commons.Validator;
import org.apache.custos.federated.authentication.exceptions.MissingParameterException;
import org.apache.custos.federated.authentication.service.CacheManipulationRequest;
import org.apache.custos.federated.authentication.service.ClientMetadata;
@@ -93,8 +93,6 @@ public class FederatedAuthenticationInputValidator implements Validator {
throw new MissingParameterException("Performed by should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
}
@@ -112,8 +110,6 @@ public class FederatedAuthenticationInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method getClient");
}
return true;
}
@@ -133,8 +129,6 @@ public class FederatedAuthenticationInputValidator implements Validator {
if (request.getPerformedBy() == null || request.getPerformedBy().trim().equals("")) {
throw new MissingParameterException("Performed By should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method deleteClient");
}
return true;
}
@@ -155,8 +149,6 @@ public class FederatedAuthenticationInputValidator implements Validator {
if (request.getType() == null) {
throw new MissingParameterException("Type should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method addToCache");
}
return true;
@@ -176,8 +168,6 @@ public class FederatedAuthenticationInputValidator implements Validator {
throw new MissingParameterException("Institutional id list is empty", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
@@ -196,8 +186,6 @@ public class FederatedAuthenticationInputValidator implements Validator {
throw new MissingParameterException("Type cannot be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
diff --git a/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/service/IamAdminService.java b/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/service/IamAdminService.java
index e1fa8798..5fb2ccb6 100644
--- a/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/service/IamAdminService.java
+++ b/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/service/IamAdminService.java
@@ -21,10 +21,10 @@ package org.apache.custos.iam.service;
import com.google.protobuf.Empty;
import io.grpc.stub.StreamObserver;
-import org.apache.custos.core.services.commons.StatusUpdater;
-import org.apache.custos.core.services.commons.persistance.model.OperationStatus;
-import org.apache.custos.core.services.commons.persistance.model.StatusEntity;
-import org.apache.custos.core.services.commons.util.Constants;
+import org.apache.custos.core.services.api.commons.StatusUpdater;
+import org.apache.custos.core.services.api.commons.persistance.model.OperationStatus;
+import org.apache.custos.core.services.api.commons.persistance.model.StatusEntity;
+import org.apache.custos.core.services.api.commons.util.Constants;
import org.apache.custos.federated.services.clients.keycloak.KeycloakClient;
import org.apache.custos.federated.services.clients.keycloak.KeycloakClientSecret;
import org.apache.custos.federated.services.clients.keycloak.UnauthorizedException;
diff --git a/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/validator/IAMInputValidator.java b/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/validator/IAMInputValidator.java
index 6b458b59..5a17a982 100644
--- a/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/validator/IAMInputValidator.java
+++ b/custos-core-services/iam-admin-core-service/src/main/java/org/apache/custos/iam/validator/IAMInputValidator.java
@@ -20,7 +20,7 @@
package org.apache.custos.iam.validator;
-import org.apache.custos.core.services.commons.Validator;
+import org.apache.custos.core.services.api.commons.Validator;
import org.apache.custos.iam.exceptions.MissingParameterException;
import org.apache.custos.iam.service.*;
import org.springframework.stereotype.Component;
@@ -187,8 +187,6 @@ public class IAMInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method setUPTenant");
}
return true;
}
@@ -223,8 +221,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Email should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method registerUser");
}
return true;
}
@@ -272,8 +268,6 @@ public class IAMInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method registerUsers");
}
return true;
}
@@ -293,8 +287,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Username should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method userAccess");
}
return true;
}
@@ -320,8 +312,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Password should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method resetPassword");
}
return true;
}
@@ -341,8 +331,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Atleast one user search string is required", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method findUsers");
}
return true;
}
@@ -374,8 +362,6 @@ public class IAMInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method updateUserProfile");
}
return true;
}
@@ -409,8 +395,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Performed By should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method roleOperationsRequest");
}
return true;
}
@@ -438,8 +422,6 @@ public class IAMInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method configureFederatedIDP");
}
return true;
}
@@ -459,8 +441,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("There should be at least one role", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateAddRoleToTenant");
}
return true;
}
@@ -501,8 +481,6 @@ public class IAMInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateAddRoleToTenant");
}
return true;
}
@@ -537,8 +515,6 @@ public class IAMInputValidator implements Validator {
}
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateAddRoleToTenant");
}
return true;
}
@@ -565,8 +541,6 @@ public class IAMInputValidator implements Validator {
}
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateCreateGroups");
}
return true;
@@ -589,8 +563,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Group id and name should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateAddRoleToTenant");
}
return true;
}
@@ -611,8 +583,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Group id should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateAddRoleToTenant");
}
return true;
}
@@ -634,8 +604,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Group id or name should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateAddRoleToTenant");
}
return true;
@@ -649,8 +617,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Tenant Id should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateAddRoleToTenant");
}
return true;
@@ -673,8 +639,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Username should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateUserGroupMapping");
}
return true;
@@ -696,8 +660,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Client name should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateUserGroupMapping");
}
return true;
}
@@ -713,8 +675,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Client name should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateUserGroupMapping");
}
return true;
}
@@ -736,8 +696,6 @@ public class IAMInputValidator implements Validator {
if (request.getUser().getId() == null || request.getUser().getId().equals("")) {
throw new MissingParameterException("Agent Id should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for request UserSearchRequest");
}
return true;
}
@@ -762,8 +720,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Agent password should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateRegisterAndEnableAgent");
}
return true;
}
@@ -797,8 +753,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Attribute value should not be null", null);
}
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateUserGroupMapping");
}
return true;
}
@@ -832,8 +786,6 @@ public class IAMInputValidator implements Validator {
}
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateUserGroupMapping");
}
return true;
}
@@ -864,8 +816,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Performed By should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method roleOperationsRequest");
}
return true;
@@ -896,8 +846,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Performed By should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method roleOperationsRequest");
}
return true;
}
@@ -920,8 +868,6 @@ public class IAMInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method getAllResources");
}
return true;
}
@@ -934,8 +880,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("Tenant Id should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method deleteExternalIDPLinks");
}
return true;
}
@@ -951,8 +895,6 @@ public class IAMInputValidator implements Validator {
throw new MissingParameterException("User Id should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method getExternalIDPLinks");
}
return true;
}
diff --git a/custos-core-services/identity-core-service/src/main/java/org/apache/custos/identity/validator/IdentityInputValidator.java b/custos-core-services/identity-core-service/src/main/java/org/apache/custos/identity/validator/IdentityInputValidator.java
index d49dfd6f..4f9cd96c 100644
--- a/custos-core-services/identity-core-service/src/main/java/org/apache/custos/identity/validator/IdentityInputValidator.java
+++ b/custos-core-services/identity-core-service/src/main/java/org/apache/custos/identity/validator/IdentityInputValidator.java
@@ -20,8 +20,8 @@
package org.apache.custos.identity.validator;
-import org.apache.custos.core.services.commons.Validator;
-import org.apache.custos.core.services.commons.exceptions.MissingParameterException;
+import org.apache.custos.core.services.api.commons.Validator;
+import org.apache.custos.core.services.api.commons.exceptions.MissingParameterException;
import org.apache.custos.identity.service.*;
import org.apache.custos.identity.utils.Constants;
import org.slf4j.Logger;
@@ -78,9 +78,8 @@ public class IdentityInputValidator implements Validator {
case "endSession":
validateEndSessionRequest(obj);
break;
-
default:
- throw new RuntimeException("Method not implemented");
+
}
return obj;
}
@@ -105,8 +104,6 @@ public class IdentityInputValidator implements Validator {
throw new MissingParameterException(" password should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method setUPTenant");
}
return true;
}
@@ -139,8 +136,6 @@ public class IdentityInputValidator implements Validator {
throw new MissingParameterException("TenantId should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method isUsernameAvailable");
}
return true;
}
@@ -161,8 +156,6 @@ public class IdentityInputValidator implements Validator {
throw new MissingParameterException("Client secret should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method userAccess");
}
return true;
}
@@ -208,8 +201,6 @@ public class IdentityInputValidator implements Validator {
}
}
- } else {
- throw new RuntimeException("Unexpected input type for method userAccess");
}
return true;
}
@@ -237,8 +228,6 @@ public class IdentityInputValidator implements Validator {
throw new MissingParameterException("Password should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method getTokenByPasswordGrantType");
}
return true;
}
@@ -263,8 +252,6 @@ public class IdentityInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method getTokenByRefreshTokenGrantType");
}
return true;
}
@@ -276,8 +263,6 @@ public class IdentityInputValidator implements Validator {
throw new MissingParameterException("Tenant Id should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateGetAuthorizationEndpoint");
}
return true;
}
@@ -289,8 +274,6 @@ public class IdentityInputValidator implements Validator {
throw new MissingParameterException("Tenant Id should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method validateGetOIDCConfiguration");
}
return true;
}
@@ -309,8 +292,6 @@ public class IdentityInputValidator implements Validator {
if (request.getClientSecret() == null || request.getClientSecret().trim().equals("")) {
throw new MissingParameterException("Client secret should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method getTokenByRefreshTokenGrantType");
}
return true;
}
@@ -334,8 +315,6 @@ public class IdentityInputValidator implements Validator {
if (request.getRefreshToken() == null || request.getRefreshToken().trim().equals("")) {
throw new MissingParameterException("Refresh token should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method getTokenByRefreshTokenGrantType");
}
return true;
}
diff --git a/custos-core-services/resource-secret-core-service/src/main/java/org/apache/custos/resource/secret/service/ResourceSecretService.java b/custos-core-services/resource-secret-core-service/src/main/java/org/apache/custos/resource/secret/service/ResourceSecretService.java
index f1899350..47892aa0 100644
--- a/custos-core-services/resource-secret-core-service/src/main/java/org/apache/custos/resource/secret/service/ResourceSecretService.java
+++ b/custos-core-services/resource-secret-core-service/src/main/java/org/apache/custos/resource/secret/service/ResourceSecretService.java
@@ -21,8 +21,8 @@ package org.apache.custos.resource.secret.service;
import io.grpc.Status;
import io.grpc.stub.StreamObserver;
-import org.apache.custos.core.services.commons.StatusUpdater;
-import org.apache.custos.core.services.commons.persistance.model.OperationStatus;
+import org.apache.custos.core.services.api.commons.StatusUpdater;
+import org.apache.custos.core.services.api.commons.persistance.model.OperationStatus;
import org.apache.custos.resource.secret.manager.Credential;
import org.apache.custos.resource.secret.manager.CredentialGeneratorFactory;
import org.apache.custos.resource.secret.manager.adaptor.inbound.CredentialReader;
diff --git a/custos-core-services/resource-secret-core-service/src/main/java/org/apache/custos/resource/secret/validator/ResourceSecretInputValidator.java b/custos-core-services/resource-secret-core-service/src/main/java/org/apache/custos/resource/secret/validator/ResourceSecretInputValidator.java
index 06b48c85..fb5b6578 100644
--- a/custos-core-services/resource-secret-core-service/src/main/java/org/apache/custos/resource/secret/validator/ResourceSecretInputValidator.java
+++ b/custos-core-services/resource-secret-core-service/src/main/java/org/apache/custos/resource/secret/validator/ResourceSecretInputValidator.java
@@ -20,8 +20,8 @@
package org.apache.custos.resource.secret.validator;
-import org.apache.custos.core.services.commons.Validator;
-import org.apache.custos.core.services.commons.exceptions.MissingParameterException;
+import org.apache.custos.core.services.api.commons.Validator;
+import org.apache.custos.core.services.api.commons.exceptions.MissingParameterException;
import org.apache.custos.resource.secret.service.*;
import org.springframework.stereotype.Component;
@@ -80,8 +80,6 @@ public class ResourceSecretInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
@@ -96,8 +94,6 @@ public class ResourceSecretInputValidator implements Validator {
throw new MissingParameterException("TenantId should be set", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -108,8 +104,6 @@ public class ResourceSecretInputValidator implements Validator {
validateSecretMetadata(request.getMetadata());
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -125,8 +119,6 @@ public class ResourceSecretInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -141,8 +133,6 @@ public class ResourceSecretInputValidator implements Validator {
throw new MissingParameterException("Certificate should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
diff --git a/custos-core-services/sharing-core-service/src/main/java/org/apache/custos/sharing/validator/SharingInputValidator.java b/custos-core-services/sharing-core-service/src/main/java/org/apache/custos/sharing/validator/SharingInputValidator.java
index e9d87803..0313484e 100644
--- a/custos-core-services/sharing-core-service/src/main/java/org/apache/custos/sharing/validator/SharingInputValidator.java
+++ b/custos-core-services/sharing-core-service/src/main/java/org/apache/custos/sharing/validator/SharingInputValidator.java
@@ -20,8 +20,8 @@
package org.apache.custos.sharing.validator;
-import org.apache.custos.core.services.commons.Validator;
-import org.apache.custos.core.services.commons.exceptions.MissingParameterException;
+import org.apache.custos.core.services.api.commons.Validator;
+import org.apache.custos.core.services.api.commons.exceptions.MissingParameterException;
import org.apache.custos.sharing.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -100,7 +100,7 @@ public class SharingInputValidator implements Validator {
validateGetAllDirectSharings(obj, methodName);
break;
default:
- throw new RuntimeException("Method not implemented");
+
}
return obj;
}
@@ -122,8 +122,6 @@ public class SharingInputValidator implements Validator {
getEntityType().getName().trim().equals("")) {
throw new MissingParameterException("Entity type name not found", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -141,8 +139,6 @@ public class SharingInputValidator implements Validator {
getEntityType().getId().equals("")) {
throw new MissingParameterException("Entity type id not found", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -154,8 +150,6 @@ public class SharingInputValidator implements Validator {
if (entityTypeRequest.getTenantId() == 0) {
throw new MissingParameterException("Tenant Id not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -173,8 +167,6 @@ public class SharingInputValidator implements Validator {
getPermissionType().getId().equals("")) {
throw new MissingParameterException("Permission type id not found", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -206,8 +198,6 @@ public class SharingInputValidator implements Validator {
throw new MissingParameterException("Owner Id not found", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
@@ -228,8 +218,6 @@ public class SharingInputValidator implements Validator {
if (entityRequest.getEntity().getId() == null || entityRequest.getEntity().getId().equals("")) {
throw new MissingParameterException("Entity Id not found", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
@@ -242,8 +230,6 @@ public class SharingInputValidator implements Validator {
if (entityRequest.getTenantId() == 0) {
throw new MissingParameterException("Tenant Id not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -273,8 +259,6 @@ public class SharingInputValidator implements Validator {
// }
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -306,8 +290,6 @@ public class SharingInputValidator implements Validator {
throw new MissingParameterException("Owner Id list not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -339,8 +321,6 @@ public class SharingInputValidator implements Validator {
throw new MissingParameterException("Owner Id list not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
@@ -352,8 +332,6 @@ public class SharingInputValidator implements Validator {
throw new MissingParameterException("Tenant Id not found ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + methodName);
}
return true;
}
diff --git a/custos-core-services/tenant-profile-core-service/src/main/java/org/apache/custos/tenant/profile/validator/TenantProfileInputValidator.java b/custos-core-services/tenant-profile-core-service/src/main/java/org/apache/custos/tenant/profile/validator/TenantProfileInputValidator.java
index 30bd8e4e..3b876d1d 100644
--- a/custos-core-services/tenant-profile-core-service/src/main/java/org/apache/custos/tenant/profile/validator/TenantProfileInputValidator.java
+++ b/custos-core-services/tenant-profile-core-service/src/main/java/org/apache/custos/tenant/profile/validator/TenantProfileInputValidator.java
@@ -19,7 +19,7 @@
package org.apache.custos.tenant.profile.validator;
-import org.apache.custos.core.services.commons.Validator;
+import org.apache.custos.core.services.api.commons.Validator;
import org.apache.custos.tenant.profile.exceptions.MissingParameterException;
import org.apache.custos.tenant.profile.service.*;
import org.springframework.stereotype.Component;
diff --git a/custos-core-services/user-profile-core-service/src/main/java/org/apache/custos/user/profile/validators/UserProfileInputValidator.java b/custos-core-services/user-profile-core-service/src/main/java/org/apache/custos/user/profile/validators/UserProfileInputValidator.java
index 1a1ef777..aa918156 100644
--- a/custos-core-services/user-profile-core-service/src/main/java/org/apache/custos/user/profile/validators/UserProfileInputValidator.java
+++ b/custos-core-services/user-profile-core-service/src/main/java/org/apache/custos/user/profile/validators/UserProfileInputValidator.java
@@ -19,8 +19,8 @@
package org.apache.custos.user.profile.validators;
-import org.apache.custos.core.services.commons.Validator;
-import org.apache.custos.core.services.commons.exceptions.MissingParameterException;
+import org.apache.custos.core.services.api.commons.Validator;
+import org.apache.custos.core.services.api.commons.exceptions.MissingParameterException;
import org.apache.custos.user.profile.service.*;
import org.springframework.stereotype.Component;
@@ -118,8 +118,6 @@ public class UserProfileInputValidator implements Validator {
!profile.getProfile().getType().equals(UserTypes.COMMUNITY)) {
throw new MissingParameterException("emailAddress should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
}
@@ -181,8 +179,6 @@ public class UserProfileInputValidator implements Validator {
throw new MissingParameterException("Name should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
@@ -206,8 +202,6 @@ public class UserProfileInputValidator implements Validator {
throw new MissingParameterException("Id should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
@@ -227,8 +221,6 @@ public class UserProfileInputValidator implements Validator {
if (profile.getGroup().getId() == null) {
throw new MissingParameterException("Group Id be valid ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
}
@@ -250,8 +242,6 @@ public class UserProfileInputValidator implements Validator {
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
@@ -275,8 +265,6 @@ public class UserProfileInputValidator implements Validator {
throw new MissingParameterException("Username should not be null", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method " + method);
}
return true;
@@ -289,8 +277,6 @@ public class UserProfileInputValidator implements Validator {
if (profileReq.getTenantId() == 0) {
throw new MissingParameterException("tenantId should be valid ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method" + method);
}
return true;
@@ -310,8 +296,6 @@ public class UserProfileInputValidator implements Validator {
if (profileReq.getParentId() == null || profileReq.getParentId().trim().equals("")) {
throw new MissingParameterException("ParentId should not be null ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method" + method);
}
return true;
@@ -329,8 +313,6 @@ public class UserProfileInputValidator implements Validator {
throw new MissingParameterException("Username should not be null ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method" + method);
}
return true;
@@ -346,8 +328,6 @@ public class UserProfileInputValidator implements Validator {
|| profileReq.getGroup().getId().equals("")) {
throw new MissingParameterException("groupId should not be null ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method" + method);
}
return true;
}
@@ -360,8 +340,6 @@ public class UserProfileInputValidator implements Validator {
|| profileReq.getType().equals("")) {
throw new MissingParameterException("Membership type is null ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method" + method);
}
return true;
@@ -378,8 +356,6 @@ public class UserProfileInputValidator implements Validator {
|| profileReq.getGroup().getId().equals("")) {
throw new MissingParameterException("groupId should not be null ", null);
}
- } else {
- throw new RuntimeException("Unexpected input type for method" + method);
}
return true;
}
diff --git a/custos-federated-services-clients/src/main/java/org/apache/custos/federated/services/clients/keycloak/KeycloakClient.java b/custos-federated-services-clients/src/main/java/org/apache/custos/federated/services/clients/keycloak/KeycloakClient.java
index 8598d684..7fa07ab9 100644
--- a/custos-federated-services-clients/src/main/java/org/apache/custos/federated/services/clients/keycloak/KeycloakClient.java
+++ b/custos-federated-services-clients/src/main/java/org/apache/custos/federated/services/clients/keycloak/KeycloakClient.java
@@ -20,7 +20,7 @@
package org.apache.custos.federated.services.clients.keycloak;
import org.apache.custos.cluster.management.client.ClusterManagementClient;
-import org.apache.custos.core.services.commons.util.Constants;
+import org.apache.custos.core.services.api.commons.util.Constants;
import org.apache.custos.federated.services.clients.keycloak.auth.KeycloakAuthClient;
import org.apache.http.HttpStatus;
import org.keycloak.admin.client.Keycloak;
@@ -94,9 +94,6 @@ public class KeycloakClient {
@Value("${spring.profiles.active}")
private String activeProfile;
- @Autowired
- private ClusterManagementClient clusterManagementClient;
-
public void createRealm(String realmId, String displayName) {
Keycloak client = null;
try {
@@ -639,7 +636,7 @@ public class KeycloakClient {
String email, String search) {
Keycloak client = null;
try {
- client = getClient(iamServerURL, realmId, accessToken);
+ client = getClient(iamServerURL,superAdminRealmID, superAdminUserName, superAdminPassword);
return searchUsers(client, realmId, username, firstName, lastName, email, search, offset, limit);
} catch (Exception ex) {
@@ -1944,13 +1941,12 @@ public class KeycloakClient {
private Keycloak getClient(String adminUrl, String realm, String loginUsername, String password) {
return KeycloakUtils.getClient(adminUrl, realm, loginUsername,
- password, clientId, trustStorePath, truststorePassword, activeProfile, clusterManagementClient);
+ password, clientId, trustStorePath, truststorePassword);
}
private Keycloak getClient(String adminUrl, String realm, String accessToken) {
- return KeycloakUtils.getClient(adminUrl, realm, accessToken, trustStorePath, truststorePassword,
- activeProfile, clusterManagementClient);
+ return KeycloakUtils.getClient(adminUrl, realm, accessToken, trustStorePath, truststorePassword);
}
diff --git a/custos-federated-services-clients/src/main/java/org/apache/custos/federated/services/clients/keycloak/KeycloakUtils.java b/custos-federated-services-clients/src/main/java/org/apache/custos/federated/services/clients/keycloak/KeycloakUtils.java
index 026267be..f79fdb6c 100644
--- a/custos-federated-services-clients/src/main/java/org/apache/custos/federated/services/clients/keycloak/KeycloakUtils.java
+++ b/custos-federated-services-clients/src/main/java/org/apache/custos/federated/services/clients/keycloak/KeycloakUtils.java
@@ -51,21 +51,19 @@ public class KeycloakUtils {
public static Keycloak getClient(String serverURL, String realm, String accessToken,
- String trustStorePath, String trustorePassword, String profile,
- ClusterManagementClient clusterManagementClient) {
+ String trustStorePath, String trustorePassword) {
return KeycloakBuilder.builder()
.serverUrl(serverURL)
.realm(realm)
.authorization(accessToken)
- .resteasyClient(getRestClient(trustStorePath, trustorePassword, profile, clusterManagementClient))
+ .resteasyClient(getRestClient(trustStorePath, trustorePassword))
.build();
}
public static Keycloak getClient(String serverURL, String realm, String loginUsername,
- String password, String clientId, String trustStorePath, String trustorePassword, String profile,
- ClusterManagementClient clusterManagementClient) {
+ String password, String clientId, String trustStorePath, String trustorePassword) {
return KeycloakBuilder.builder()
.serverUrl(serverURL)
@@ -73,46 +71,44 @@ public class KeycloakUtils {
.username(loginUsername)
.password(password)
.clientId(clientId)
- .resteasyClient(getRestClient(trustStorePath, trustorePassword, profile, clusterManagementClient))
+ .resteasyClient(getRestClient(trustStorePath, trustorePassword))
.build();
}
- private static ResteasyClient getRestClient(String trustorePath, String trustorePassword, String profile,
- ClusterManagementClient clusterManagementClient) {
+ private static ResteasyClient getRestClient(String trustorePath, String trustorePassword) {
return new ResteasyClientBuilder()
.establishConnectionTimeout(100, TimeUnit.SECONDS)
.socketTimeout(10, TimeUnit.SECONDS)
.connectionPoolSize(POOL_SIZE)
- .trustStore(loadKeyStore(trustorePath, trustorePassword, profile, clusterManagementClient))
+ .trustStore(loadKeyStore(trustorePath, trustorePassword))
.build();
}
- private static KeyStore loadKeyStore(String trustStorePath, String trustorePassword,
- String profile, ClusterManagementClient clusterManagementClient) {
+ private static KeyStore loadKeyStore(String trustStorePath, String trustorePassword) {
InputStream is = null;
try {
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
- if (profile.equals("staging") || profile.equals("production")) {
- LOGGER.info("Profile inside " + profile);
- GetServerCertificateRequest getServerCertificateRequest = GetServerCertificateRequest
- .newBuilder()
- .setNamespace("keycloak")
- .setSecretName("tls-keycloak-secret")
- .build();
- GetServerCertificateResponse response = clusterManagementClient.getCustosServerCertificate(getServerCertificateRequest);
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- LOGGER.info(response.getCertificate());
- InputStream targetStream = new ByteArrayInputStream(response.getCertificate().getBytes());
- Certificate certs = cf.generateCertificate(targetStream);
- // Add the certificate
- ks.load(null, null);
- ks.setCertificateEntry("custos", certs);
-
- } else {
+// if (profile.equals("staging") || profile.equals("production")) {
+// LOGGER.info("Profile inside " + profile);
+// GetServerCertificateRequest getServerCertificateRequest = GetServerCertificateRequest
+// .newBuilder()
+// .setNamespace("keycloak")
+// .setSecretName("tls-keycloak-secret")
+// .build();
+// GetServerCertificateResponse response = clusterManagementClient.getCustosServerCertificate(getServerCertificateRequest);
+// CertificateFactory cf = CertificateFactory.getInstance("X.509");
+// LOGGER.info(response.getCertificate());
+// InputStream targetStream = new ByteArrayInputStream(response.getCertificate().getBytes());
+// Certificate certs = cf.generateCertificate(targetStream);
+// // Add the certificate
+// ks.load(null, null);
+// ks.setCertificateEntry("custos", certs);
+//
+// } else {
File trustStoreFile = new File(trustStorePath);
@@ -133,7 +129,7 @@ public class KeycloakUtils {
ks.load(is, trustorePassword.toCharArray());
- }
+// }
return ks;
} catch (Exception e) {
throw new RuntimeException("Failed to load trust store KeyStore instance", e);
diff --git a/custos-integration-services/agent-management-service-parent/agent-management-service/src/main/java/org/apache/custos/agent/management/interceptors/AgentManagementUserAuthInterceptorImpl.java b/custos-integration-services/agent-management-service-parent/agent-management-service/src/main/java/org/apache/custos/agent/management/interceptors/AgentManagementUserAuthInterceptorImpl.java
index bdcfe17e..6b187553 100644
--- a/custos-integration-services/agent-management-service-parent/agent-management-service/src/main/java/org/apache/custos/agent/management/interceptors/AgentManagementUserAuthInterceptorImpl.java
+++ b/custos-integration-services/agent-management-service-parent/agent-management-service/src/main/java/org/apache/custos/agent/management/interceptors/AgentManagementUserAuthInterceptorImpl.java
@@ -56,30 +56,18 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
@Override
public <ReqT> ReqT intercept(String method, Metadata headers, ReqT msg) {
- String token = getToken(headers);
- Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
- if (claim.isEmpty()) {
- throw new UnAuthorizedException("Request is not authorized", null);
- }
- long tenantId = claim.get().getTenantId();
- if (!method.equals("enableAgents")) {
- GetCredentialRequest request = GetCredentialRequest
- .newBuilder()
- .setType(Type.AGENT_CLIENT)
- .setOwnerId(tenantId)
- .build();
+ if (method.equals("enableAgents") || method.equals("configureAgentClient")) {
- CredentialMetadata metadata = this.credentialStoreServiceClient.getCredential(request);
- if (metadata == null || metadata.getId().equals("")) {
- throw new UnAuthorizedException("Agent creation is not enabled", null);
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
}
+ long tenantId = claim.get().getTenantId();
- }
-
- if (method.equals("enableAgents") || method.equals("configureAgentClient")) {
return (ReqT) ((AgentClientMetadata) msg).toBuilder()
.setTenantId(tenantId)
@@ -88,6 +76,13 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
.build();
} else if (method.equals("registerAndEnableAgent")) {
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
+
return (ReqT) ((RegisterUserRequest) msg).toBuilder()
.setTenantId(tenantId)
@@ -98,7 +93,12 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
} else if (method.equals("getAgent") || method.equals("deleteAgent") || method.equals("disableAgent") ||
method.equals("enableAgent")) {
-
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
return (ReqT) ((AgentSearchRequest) msg).toBuilder()
.setTenantId(tenantId)
@@ -107,6 +107,12 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
.build();
} else if (method.equals("addAgentAttributes")) {
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
return (ReqT) ((AddUserAttributesRequest) msg).toBuilder()
.setTenantId(tenantId)
@@ -115,6 +121,12 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
.build();
} else if (method.equals("deleteAgentAttributes")) {
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
return (ReqT) ((DeleteUserAttributeRequest) msg).toBuilder()
.setTenantId(tenantId)
@@ -123,6 +135,12 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
.build();
} else if (method.equals("addRolesToAgent")) {
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
return (ReqT) ((AddUserRolesRequest) msg).toBuilder()
.setTenantId(tenantId)
@@ -131,6 +149,12 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
.build();
} else if (method.equals("deleteRolesFromAgent")) {
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
return (ReqT) ((DeleteUserRolesRequest) msg).toBuilder()
.setTenantId(tenantId)
@@ -139,6 +163,12 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
.build();
} else if (method.equals("addProtocolMapper")) {
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
GetCredentialRequest request = GetCredentialRequest
.newBuilder()
@@ -157,6 +187,12 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
.build();
} else if (method.equals("addRolesToClient")) {
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
GetCredentialRequest request = GetCredentialRequest
.newBuilder()
.setType(Type.AGENT_CLIENT)
@@ -173,6 +209,12 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
.build();
} else if (method.equals("getAllAgents")) {
+ String token = getToken(headers);
+ Optional<AuthClaim> claim = authorizeUsingUserToken(headers);
+ if (claim.isEmpty()) {
+ throw new UnAuthorizedException("Request is not authorized", null);
+ }
+ long tenantId = claim.get().getTenantId();
GetCredentialRequest request = GetCredentialRequest
.newBuilder()
.setType(Type.AGENT_CLIENT)
@@ -195,4 +237,5 @@ public class AgentManagementUserAuthInterceptorImpl extends AuthInterceptor {
}
-}
+
+}
\ No newline at end of file
diff --git a/custos-integration-services/custos-integration-services-commons/src/main/java/org/apache/custos/integration/services/commons/interceptors/LoggingInterceptor.java b/custos-integration-services/custos-integration-services-commons/src/main/java/org/apache/custos/integration/services/commons/interceptors/LoggingInterceptor.java
index 9a5eb7a5..23c03305 100644
--- a/custos-integration-services/custos-integration-services-commons/src/main/java/org/apache/custos/integration/services/commons/interceptors/LoggingInterceptor.java
+++ b/custos-integration-services/custos-integration-services-commons/src/main/java/org/apache/custos/integration/services/commons/interceptors/LoggingInterceptor.java
@@ -80,9 +80,15 @@ public class LoggingInterceptor implements IntegrationServiceInterceptor {
get(Metadata.Key.of(Constants.SERVICE_NAME, Metadata.ASCII_STRING_MARSHALLER));
String externaIP = headers.
get(Metadata.Key.of(Constants.X_FORWARDED_FOR, Metadata.ASCII_STRING_MARSHALLER));
- logEventBuilder.setServiceName(servicename);
- logEventBuilder.setEventType(method);
- logEventBuilder.setExternalIp(externaIP);
+ if (servicename != null){
+ logEventBuilder.setServiceName(servicename);
+ }
+ if (method!= null){
+ logEventBuilder.setEventType(method);
+ }
+ if (externaIP!= null){
+ logEventBuilder.setEventType(externaIP);
+ }
logEventBuilder.setCreatedTime(System.currentTimeMillis());
}
diff --git a/custos-integration-services/identity-management-service-parent/identity-management-service/src/main/java/org/apache/custos/identity/management/service/IdentityManagementService.java b/custos-integration-services/identity-management-service-parent/identity-management-service/src/main/java/org/apache/custos/identity/management/service/IdentityManagementService.java
index 78b6e97c..fb25a20b 100644
--- a/custos-integration-services/identity-management-service-parent/identity-management-service/src/main/java/org/apache/custos/identity/management/service/IdentityManagementService.java
+++ b/custos-integration-services/identity-management-service-parent/identity-management-service/src/main/java/org/apache/custos/identity/management/service/IdentityManagementService.java
@@ -236,7 +236,6 @@ public class IdentityManagementService extends IdentityManagementServiceGrpc.Ide
.setProfile(userProfile)
.build();
- UserProfile exsistingProfile = userProfileClient.getUser(req);
Map<String, String> values = new HashMap<>();
values.put("param:username", user.getUsername());
values.put("param:first_name", user.getFirstName());
diff --git a/custos-rest-proxy/src/main/resources/envoy.yaml b/custos-rest-proxy/src/main/resources/envoy.yaml
index 5747de95..969e4609 100644
--- a/custos-rest-proxy/src/main/resources/envoy.yaml
+++ b/custos-rest-proxy/src/main/resources/envoy.yaml
@@ -20,7 +20,7 @@ static_resources:
- name: local_service
domains: ["*"]
routes:
- - match: { prefix: "/" }
+ - match: { prefix: "/", grpc: {}}
route: { cluster: grpc-custos-service, timeout: { seconds: 60 } }
access_log:
- name: envoy.file_access_log
@@ -29,7 +29,7 @@ static_resources:
http_filters:
- name: envoy.grpc_json_transcoder
config:
- proto_descriptor: "/data/drms.pb"
+ proto_descriptor: "/data/custos.pb"
services: ["org.apache.custos.agent.management.service.AgentManagementService",
"org.apache.custos.group.management.service.GroupManagementService",
"org.apache.custos.identity.management.service.IdentityManagementService",
@@ -43,7 +43,7 @@ static_resources:
add_whitespace: true
always_print_primitive_fields: true
always_print_enums_as_ints: false
- preserve_proto_field_names: false
+ preserve_proto_field_names: true
- name: envoy.router
clusters:
- name: grpc-custos-service