You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2019/09/09 19:17:14 UTC
[airavata-custos] 10/48: added custos authentication server
This is an automated email from the ASF dual-hosted git repository.
smarru pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
commit d71d2010a4a80129a9d7400550e3461e33328a62
Author: Aarushi <aa...@gmail.com>
AuthorDate: Mon Jul 8 18:37:09 2019 -0400
added custos authentication server
---
.gitignore | 2 +-
.../CustosAuthenticationService.java | 3198 ---
.../cpi/CustosAuthenticationService.java | 556 +-
.../handler/CustosAuthenticationHandler.java | 11 +-
.../service/AuthenticationServiceClient.java | 2 +-
.../service/CustosProfileServiceClientFactory.java | 89 -
.../model/error/AuthenticationException.java | 385 -
.../model/error/AuthorizationException.java | 385 -
.../custos/commons/utils/ApplicationSettings.java | 22 -
.../org/apache/custos/commons/utils/Constants.java | 4 -
.../apache/custos/commons/utils/DBInitConfig.java | 33 -
.../apache/custos/commons/utils/DBInitializer.java | 71 -
.../org/apache/custos/commons/utils/DBUtil.java | 307 -
.../custos/commons/utils/DatabaseCreator.java | 378 -
.../apache/custos/commons/utils/JDBCConfig.java | 29 -
.../org/apache/custos/commons/utils/JPAUtils.java | 67 -
.../custos/commons/utils/ServerSettings.java | 24 +-
.../interceptor/SecurityCheck.java | 36 -
.../interceptor/SecurityInterceptor.java | 82 -
.../interceptor/SecurityModule.java | 42 -
.../manager/CustosSecurityManager.java | 2 +-
.../manager/KeyCloakSecurityManager.java | 197 +-
.../iam-admin-services-core/pom.xml | 89 -
.../core/impl/TenantManagementKeycloakImpl.java | 821 -
.../core/interfaces/TenantManagementInterface.java | 206 -
.../admin/services/core/tests/SetupNewGateway.java | 141 -
custos-profile-service/pom.xml | 24 -
.../profile-service-commons/pom.xml | 124 -
.../commons/repositories/AbstractRepository.java | 124 -
.../commons/tenant/entities/GatewayEntity.java | 285 -
.../user/entities/CustomizedDashboardEntity.java | 325 -
.../user/entities/NSFDemographicsEntity.java | 108 -
.../commons/user/entities/UserProfileEntity.java | 345 -
.../custos/profile/commons/utils/Committer.java | 27 -
.../custos/profile/commons/utils/JPAConstants.java | 34 -
.../custos/profile/commons/utils/JPAUtils.java | 53 -
.../commons/utils/ObjectMapperSingleton.java | 39 -
.../commons/utils/ProfileServiceJDBCConfig.java | 51 -
.../profile/commons/utils/QueryConstants.java | 36 -
.../apache/custos/profile/commons/utils/Utils.java | 122 -
.../src/main/resources/META-INF/persistence.xml | 36 -
.../profile-service-model/pom.xml | 14 -
.../profile/model/tenant/PasswordCredential.java | 996 -
.../apache/custos/profile/model/tenant/Tenant.java | 1543 --
.../profile/model/tenant/TenantApprovalStatus.java | 78 -
.../custos/profile/model/tenant/TenantConfig.java | 699 -
.../profile/model/tenant/TenantPreferences.java | 594 -
.../custos/profile/model/user/CustomDashboard.java | 2912 ---
.../custos/profile/model/user/NSFDemographics.java | 1085 -
.../apache/custos/profile/model/user/Status.java | 96 -
.../custos/profile/model/user/USCitizenship.java | 67 -
.../custos/profile/model/user/UserProfile.java | 3221 ---
.../custos/profile/model/user/disability.java | 66 -
.../custos/profile/model/user/ethnicity.java | 65 -
.../org/apache/custos/profile/model/user/race.java | 84 -
.../model/user/user_profile_modelConstants.java | 31 -
.../custos/profile/model/workspace/Gateway.java | 2383 ---
.../model/workspace/GatewayApprovalStatus.java | 78 -
.../profile-service-server/pom.xml | 50 -
.../profile/handlers/IamAdminServicesHandler.java | 312 -
.../handlers/TenantProfileServiceHandler.java | 259 -
.../handlers/UserProfileServiceHandler.java | 239 -
.../profile/server/ProfileServiceServer.java | 198 -
.../src/main/resources/log4j.properties | 41 -
.../client/ProfileServiceClientFactory.java | 78 -
.../iam.admin.services.cpi/IamAdminServices.java | 19580 -------------------
.../exception/IamAdminServicesException.java | 381 -
.../iam_admin_services_cpiConstants.java | 16 -
.../profile/tenant.cpi/TenantProfileService.java | 10869 ----------
.../exception/TenantProfileServiceException.java | 370 -
.../tenant.cpi/profile_tenant_cpiConstants.java | 16 -
.../profile/user.cpi/UserProfileService.java | 10003 ----------
.../exception/UserProfileServiceException.java | 370 -
.../user.cpi/profile_user_cpiConstants.java | 16 -
custos-profile-service/profile-tenant-core/pom.xml | 43 -
.../core/repositories/TenantProfileRepository.java | 121 -
custos-profile-service/profile-user-core/pom.xml | 90 -
.../exceptions/UserProfileRegistryException.java | 28 -
.../core/repositories/UserProfileRepository.java | 129 -
.../core/utils/UserProfileCatalogDBInitConfig.java | 42 -
.../core/utils/UserProfileCatalogJDBCConfig.java | 52 -
.../user-profile-catalog-derby.sql | 163 -
.../user-profile-catalog-mysql.sql | 163 -
.../core/repositories/WorkspaceRepositoryTest.java | 176 -
.../pom.xml | 13 +-
.../src/main/java/CustosAPIServerStarted.java | 8 +
.../src/main/resources/custos-server.properties | 32 +
.../src/main/resources/docker-compose.yml | 15 +
.../main/resources/keycloak/Default-export.json | 1508 ++
.../main/resources/keycloak/Default-export.json.bk | 1507 ++
.../src/main/resources/keycloak/standalone.xml | 521 +
pom.xml | 1 -
.../authentication-service-cpi.thrift | 6 +-
.../security_model.thrift | 0
.../userInfo_model.thrift | 0
thrift-interfaces/custos-apis/custos_errors.thrift | 47 -
.../tenant_profile_model.thrift | 73 -
.../user_profile_model.thrift | 229 -
.../workspace_model.thrift | 60 -
.../iam-admin-services-cpi.thrift | 133 -
.../iam_admin_services_cpi_errors.thrift | 33 -
.../profile-service/profile-service-cpi.thrift | 29 -
.../profile-tenant/profile-tenant-cpi.thrift | 85 -
.../profile_tenant_cpi_errors.thrift | 33 -
.../profile-user/profile-user-cpi.thrift | 86 -
.../profile-user/profile_user_cpi_errors.thrift | 33 -
106 files changed, 4001 insertions(+), 67180 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1864f17..c732a73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,4 +36,4 @@ com_crashlytics_export_strings.xml
.classpath
.factorypath
-.database_data
+database_data
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/CustosAuthenticationService.java b/custos-authentication/src/main/java/org/apache/custos/authentication/CustosAuthenticationService.java
deleted file mode 100644
index 115c3e3..0000000
--- a/custos-authentication/src/main/java/org/apache/custos/authentication/CustosAuthenticationService.java
+++ /dev/null
@@ -1,3198 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.12.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.custos.authentication;
-
-@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-08")
-public class CustosAuthenticationService {
-
- public interface Iface {
-
- public boolean isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
-
- public org.apache.custos.commons.model.security.UserInfo getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
-
- public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
-
- }
-
- public interface AsyncIface {
-
- public void isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException;
-
- public void getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException;
-
- public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException;
-
- }
-
- public static class Client extends org.apache.thrift.TServiceClient implements Iface {
- public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
- public Factory() {}
- public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
- return new Client(prot);
- }
- public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- return new Client(iprot, oprot);
- }
- }
-
- public Client(org.apache.thrift.protocol.TProtocol prot)
- {
- super(prot, prot);
- }
-
- public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
- super(iprot, oprot);
- }
-
- public boolean isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
- {
- send_isUserAuthenticated(authzToken);
- return recv_isUserAuthenticated();
- }
-
- public void send_isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.thrift.TException
- {
- isUserAuthenticated_args args = new isUserAuthenticated_args();
- args.setAuthzToken(authzToken);
- sendBase("isUserAuthenticated", args);
- }
-
- public boolean recv_isUserAuthenticated() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
- {
- isUserAuthenticated_result result = new isUserAuthenticated_result();
- receiveBase(result, "isUserAuthenticated");
- if (result.isSetSuccess()) {
- return result.success;
- }
- if (result.ae != null) {
- throw result.ae;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isUserAuthenticated failed: unknown result");
- }
-
- public org.apache.custos.commons.model.security.UserInfo getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
- {
- send_getUserInfoFromAuthzToken(authzToken);
- return recv_getUserInfoFromAuthzToken();
- }
-
- public void send_getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.thrift.TException
- {
- getUserInfoFromAuthzToken_args args = new getUserInfoFromAuthzToken_args();
- args.setAuthzToken(authzToken);
- sendBase("getUserInfoFromAuthzToken", args);
- }
-
- public org.apache.custos.commons.model.security.UserInfo recv_getUserInfoFromAuthzToken() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
- {
- getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
- receiveBase(result, "getUserInfoFromAuthzToken");
- if (result.isSetSuccess()) {
- return result.success;
- }
- if (result.ae != null) {
- throw result.ae;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserInfoFromAuthzToken failed: unknown result");
- }
-
- public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
- {
- send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
- return recv_getUserManagementServiceAccountAuthzToken();
- }
-
- public void send_getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.thrift.TException
- {
- getUserManagementServiceAccountAuthzToken_args args = new getUserManagementServiceAccountAuthzToken_args();
- args.setAuthzToken(authzToken);
- args.setGatewayId(gatewayId);
- sendBase("getUserManagementServiceAccountAuthzToken", args);
- }
-
- public org.apache.custos.commons.model.security.AuthzToken recv_getUserManagementServiceAccountAuthzToken() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
- {
- getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
- receiveBase(result, "getUserManagementServiceAccountAuthzToken");
- if (result.isSetSuccess()) {
- return result.success;
- }
- if (result.ae != null) {
- throw result.ae;
- }
- throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserManagementServiceAccountAuthzToken failed: unknown result");
- }
-
- }
- public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
- public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
- private org.apache.thrift.async.TAsyncClientManager clientManager;
- private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
- public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
- this.clientManager = clientManager;
- this.protocolFactory = protocolFactory;
- }
- public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
- return new AsyncClient(protocolFactory, clientManager, transport);
- }
- }
-
- public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
- super(protocolFactory, clientManager, transport);
- }
-
- public void isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- isUserAuthenticated_call method_call = new isUserAuthenticated_call(authzToken, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class isUserAuthenticated_call extends org.apache.thrift.async.TAsyncMethodCall<Boolean> {
- private org.apache.custos.commons.model.security.AuthzToken authzToken;
- public isUserAuthenticated_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.authzToken = authzToken;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isUserAuthenticated", org.apache.thrift.protocol.TMessageType.CALL, 0));
- isUserAuthenticated_args args = new isUserAuthenticated_args();
- args.setAuthzToken(authzToken);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public Boolean getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
- if (getState() != State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_isUserAuthenticated();
- }
- }
-
- public void getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- getUserInfoFromAuthzToken_call method_call = new getUserInfoFromAuthzToken_call(authzToken, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class getUserInfoFromAuthzToken_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.commons.model.security.UserInfo> {
- private org.apache.custos.commons.model.security.AuthzToken authzToken;
- public getUserInfoFromAuthzToken_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.authzToken = authzToken;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserInfoFromAuthzToken", org.apache.thrift.protocol.TMessageType.CALL, 0));
- getUserInfoFromAuthzToken_args args = new getUserInfoFromAuthzToken_args();
- args.setAuthzToken(authzToken);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public org.apache.custos.commons.model.security.UserInfo getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
- if (getState() != State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_getUserInfoFromAuthzToken();
- }
- }
-
- public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
- checkReady();
- getUserManagementServiceAccountAuthzToken_call method_call = new getUserManagementServiceAccountAuthzToken_call(authzToken, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
- this.___currentMethod = method_call;
- ___manager.call(method_call);
- }
-
- public static class getUserManagementServiceAccountAuthzToken_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.commons.model.security.AuthzToken> {
- private org.apache.custos.commons.model.security.AuthzToken authzToken;
- private String gatewayId;
- public getUserManagementServiceAccountAuthzToken_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
- super(client, protocolFactory, transport, resultHandler, false);
- this.authzToken = authzToken;
- this.gatewayId = gatewayId;
- }
-
- public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
- prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserManagementServiceAccountAuthzToken", org.apache.thrift.protocol.TMessageType.CALL, 0));
- getUserManagementServiceAccountAuthzToken_args args = new getUserManagementServiceAccountAuthzToken_args();
- args.setAuthzToken(authzToken);
- args.setGatewayId(gatewayId);
- args.write(prot);
- prot.writeMessageEnd();
- }
-
- public org.apache.custos.commons.model.security.AuthzToken getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
- if (getState() != State.RESPONSE_READ) {
- throw new IllegalStateException("Method call not finished!");
- }
- org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
- org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
- return (new Client(prot)).recv_getUserManagementServiceAccountAuthzToken();
- }
- }
-
- }
-
- public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
- private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
- public Processor(I iface) {
- super(iface, getProcessMap(new java.util.HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
- }
-
- protected Processor(I iface, java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static <I extends Iface> java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
- processMap.put("isUserAuthenticated", new isUserAuthenticated());
- processMap.put("getUserInfoFromAuthzToken", new getUserInfoFromAuthzToken());
- processMap.put("getUserManagementServiceAccountAuthzToken", new getUserManagementServiceAccountAuthzToken());
- return processMap;
- }
-
- public static class isUserAuthenticated<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isUserAuthenticated_args> {
- public isUserAuthenticated() {
- super("isUserAuthenticated");
- }
-
- public isUserAuthenticated_args getEmptyArgsInstance() {
- return new isUserAuthenticated_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- @Override
- protected boolean rethrowUnhandledExceptions() {
- return false;
- }
-
- public isUserAuthenticated_result getResult(I iface, isUserAuthenticated_args args) throws org.apache.thrift.TException {
- isUserAuthenticated_result result = new isUserAuthenticated_result();
- try {
- result.success = iface.isUserAuthenticated(args.authzToken);
- result.setSuccessIsSet(true);
- } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
- result.ae = ae;
- }
- return result;
- }
- }
-
- public static class getUserInfoFromAuthzToken<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserInfoFromAuthzToken_args> {
- public getUserInfoFromAuthzToken() {
- super("getUserInfoFromAuthzToken");
- }
-
- public getUserInfoFromAuthzToken_args getEmptyArgsInstance() {
- return new getUserInfoFromAuthzToken_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- @Override
- protected boolean rethrowUnhandledExceptions() {
- return false;
- }
-
- public getUserInfoFromAuthzToken_result getResult(I iface, getUserInfoFromAuthzToken_args args) throws org.apache.thrift.TException {
- getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
- try {
- result.success = iface.getUserInfoFromAuthzToken(args.authzToken);
- } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
- result.ae = ae;
- }
- return result;
- }
- }
-
- public static class getUserManagementServiceAccountAuthzToken<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserManagementServiceAccountAuthzToken_args> {
- public getUserManagementServiceAccountAuthzToken() {
- super("getUserManagementServiceAccountAuthzToken");
- }
-
- public getUserManagementServiceAccountAuthzToken_args getEmptyArgsInstance() {
- return new getUserManagementServiceAccountAuthzToken_args();
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- @Override
- protected boolean rethrowUnhandledExceptions() {
- return false;
- }
-
- public getUserManagementServiceAccountAuthzToken_result getResult(I iface, getUserManagementServiceAccountAuthzToken_args args) throws org.apache.thrift.TException {
- getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
- try {
- result.success = iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId);
- } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
- result.ae = ae;
- }
- return result;
- }
- }
-
- }
-
- public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
- private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());
- public AsyncProcessor(I iface) {
- super(iface, getProcessMap(new java.util.HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
- }
-
- protected AsyncProcessor(I iface, java.util.Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
- super(iface, getProcessMap(processMap));
- }
-
- private static <I extends AsyncIface> java.util.Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase,?>> getProcessMap(java.util.Map<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
- processMap.put("isUserAuthenticated", new isUserAuthenticated());
- processMap.put("getUserInfoFromAuthzToken", new getUserInfoFromAuthzToken());
- processMap.put("getUserManagementServiceAccountAuthzToken", new getUserManagementServiceAccountAuthzToken());
- return processMap;
- }
-
- public static class isUserAuthenticated<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, isUserAuthenticated_args, Boolean> {
- public isUserAuthenticated() {
- super("isUserAuthenticated");
- }
-
- public isUserAuthenticated_args getEmptyArgsInstance() {
- return new isUserAuthenticated_args();
- }
-
- public org.apache.thrift.async.AsyncMethodCallback<Boolean> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new org.apache.thrift.async.AsyncMethodCallback<Boolean>() {
- public void onComplete(Boolean o) {
- isUserAuthenticated_result result = new isUserAuthenticated_result();
- result.success = o;
- result.setSuccessIsSet(true);
- try {
- fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- } catch (org.apache.thrift.transport.TTransportException e) {
- _LOGGER.error("TTransportException writing to internal frame buffer", e);
- fb.close();
- } catch (Exception e) {
- _LOGGER.error("Exception writing to internal frame buffer", e);
- onError(e);
- }
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TSerializable msg;
- isUserAuthenticated_result result = new isUserAuthenticated_result();
- if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
- result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
- result.setAeIsSet(true);
- msg = result;
- } else if (e instanceof org.apache.thrift.transport.TTransportException) {
- _LOGGER.error("TTransportException inside handler", e);
- fb.close();
- return;
- } else if (e instanceof org.apache.thrift.TApplicationException) {
- _LOGGER.error("TApplicationException inside handler", e);
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TApplicationException)e;
- } else {
- _LOGGER.error("Exception inside handler", e);
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- } catch (Exception ex) {
- _LOGGER.error("Exception writing to internal frame buffer", ex);
- fb.close();
- }
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, isUserAuthenticated_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
- iface.isUserAuthenticated(args.authzToken,resultHandler);
- }
- }
-
- public static class getUserInfoFromAuthzToken<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserInfoFromAuthzToken_args, org.apache.custos.commons.model.security.UserInfo> {
- public getUserInfoFromAuthzToken() {
- super("getUserInfoFromAuthzToken");
- }
-
- public getUserInfoFromAuthzToken_args getEmptyArgsInstance() {
- return new getUserInfoFromAuthzToken_args();
- }
-
- public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo>() {
- public void onComplete(org.apache.custos.commons.model.security.UserInfo o) {
- getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
- result.success = o;
- try {
- fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- } catch (org.apache.thrift.transport.TTransportException e) {
- _LOGGER.error("TTransportException writing to internal frame buffer", e);
- fb.close();
- } catch (Exception e) {
- _LOGGER.error("Exception writing to internal frame buffer", e);
- onError(e);
- }
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TSerializable msg;
- getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
- if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
- result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
- result.setAeIsSet(true);
- msg = result;
- } else if (e instanceof org.apache.thrift.transport.TTransportException) {
- _LOGGER.error("TTransportException inside handler", e);
- fb.close();
- return;
- } else if (e instanceof org.apache.thrift.TApplicationException) {
- _LOGGER.error("TApplicationException inside handler", e);
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TApplicationException)e;
- } else {
- _LOGGER.error("Exception inside handler", e);
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- } catch (Exception ex) {
- _LOGGER.error("Exception writing to internal frame buffer", ex);
- fb.close();
- }
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, getUserInfoFromAuthzToken_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException {
- iface.getUserInfoFromAuthzToken(args.authzToken,resultHandler);
- }
- }
-
- public static class getUserManagementServiceAccountAuthzToken<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserManagementServiceAccountAuthzToken_args, org.apache.custos.commons.model.security.AuthzToken> {
- public getUserManagementServiceAccountAuthzToken() {
- super("getUserManagementServiceAccountAuthzToken");
- }
-
- public getUserManagementServiceAccountAuthzToken_args getEmptyArgsInstance() {
- return new getUserManagementServiceAccountAuthzToken_args();
- }
-
- public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
- final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken>() {
- public void onComplete(org.apache.custos.commons.model.security.AuthzToken o) {
- getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
- result.success = o;
- try {
- fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
- } catch (org.apache.thrift.transport.TTransportException e) {
- _LOGGER.error("TTransportException writing to internal frame buffer", e);
- fb.close();
- } catch (Exception e) {
- _LOGGER.error("Exception writing to internal frame buffer", e);
- onError(e);
- }
- }
- public void onError(Exception e) {
- byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
- org.apache.thrift.TSerializable msg;
- getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
- if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
- result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
- result.setAeIsSet(true);
- msg = result;
- } else if (e instanceof org.apache.thrift.transport.TTransportException) {
- _LOGGER.error("TTransportException inside handler", e);
- fb.close();
- return;
- } else if (e instanceof org.apache.thrift.TApplicationException) {
- _LOGGER.error("TApplicationException inside handler", e);
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = (org.apache.thrift.TApplicationException)e;
- } else {
- _LOGGER.error("Exception inside handler", e);
- msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
- msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
- }
- try {
- fcall.sendResponse(fb,msg,msgType,seqid);
- } catch (Exception ex) {
- _LOGGER.error("Exception writing to internal frame buffer", ex);
- fb.close();
- }
- }
- };
- }
-
- protected boolean isOneway() {
- return false;
- }
-
- public void start(I iface, getUserManagementServiceAccountAuthzToken_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
- iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId,resultHandler);
- }
- }
-
- }
-
- public static class isUserAuthenticated_args implements org.apache.thrift.TBase<isUserAuthenticated_args, isUserAuthenticated_args._Fields>, java.io.Serializable, Cloneable, Comparable<isUserAuthenticated_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isUserAuthenticated_args");
-
- private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new isUserAuthenticated_argsStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new isUserAuthenticated_argsTupleSchemeFactory();
-
- public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- AUTHZ_TOKEN((short)1, "authzToken");
-
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
-
- static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // AUTHZ_TOKEN
- return AUTHZ_TOKEN;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isUserAuthenticated_args.class, metaDataMap);
- }
-
- public isUserAuthenticated_args() {
- }
-
- public isUserAuthenticated_args(
- org.apache.custos.commons.model.security.AuthzToken authzToken)
- {
- this();
- this.authzToken = authzToken;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public isUserAuthenticated_args(isUserAuthenticated_args other) {
- if (other.isSetAuthzToken()) {
- this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
- }
- }
-
- public isUserAuthenticated_args deepCopy() {
- return new isUserAuthenticated_args(this);
- }
-
- @Override
- public void clear() {
- this.authzToken = null;
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
- return this.authzToken;
- }
-
- public isUserAuthenticated_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
- this.authzToken = authzToken;
- return this;
- }
-
- public void unsetAuthzToken() {
- this.authzToken = null;
- }
-
- /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthzToken() {
- return this.authzToken != null;
- }
-
- public void setAuthzTokenIsSet(boolean value) {
- if (!value) {
- this.authzToken = null;
- }
- }
-
- public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
- switch (field) {
- case AUTHZ_TOKEN:
- if (value == null) {
- unsetAuthzToken();
- } else {
- setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
- }
- break;
-
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case AUTHZ_TOKEN:
- return getAuthzToken();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case AUTHZ_TOKEN:
- return isSetAuthzToken();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof isUserAuthenticated_args)
- return this.equals((isUserAuthenticated_args)that);
- return false;
- }
-
- public boolean equals(isUserAuthenticated_args that) {
- if (that == null)
- return false;
- if (this == that)
- return true;
-
- boolean this_present_authzToken = true && this.isSetAuthzToken();
- boolean that_present_authzToken = true && that.isSetAuthzToken();
- if (this_present_authzToken || that_present_authzToken) {
- if (!(this_present_authzToken && that_present_authzToken))
- return false;
- if (!this.authzToken.equals(that.authzToken))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 1;
-
- hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
- if (isSetAuthzToken())
- hashCode = hashCode * 8191 + authzToken.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(isUserAuthenticated_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthzToken()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- @org.apache.thrift.annotation.Nullable
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- scheme(oprot).write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("isUserAuthenticated_args(");
- boolean first = true;
-
- sb.append("authzToken:");
- if (this.authzToken == null) {
- sb.append("null");
- } else {
- sb.append(this.authzToken);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (authzToken == null) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
- }
- // check for sub-struct validity
- if (authzToken != null) {
- authzToken.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class isUserAuthenticated_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public isUserAuthenticated_argsStandardScheme getScheme() {
- return new isUserAuthenticated_argsStandardScheme();
- }
- }
-
- private static class isUserAuthenticated_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<isUserAuthenticated_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // AUTHZ_TOKEN
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
- struct.authzToken.read(iprot);
- struct.setAuthzTokenIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.authzToken != null) {
- oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
- struct.authzToken.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class isUserAuthenticated_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public isUserAuthenticated_argsTupleScheme getScheme() {
- return new isUserAuthenticated_argsTupleScheme();
- }
- }
-
- private static class isUserAuthenticated_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<isUserAuthenticated_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- struct.authzToken.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
- struct.authzToken.read(iprot);
- struct.setAuthzTokenIsSet(true);
- }
- }
-
- private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
- return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
- }
- }
-
- public static class isUserAuthenticated_result implements org.apache.thrift.TBase<isUserAuthenticated_result, isUserAuthenticated_result._Fields>, java.io.Serializable, Cloneable, Comparable<isUserAuthenticated_result> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isUserAuthenticated_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
- private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new isUserAuthenticated_resultStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new isUserAuthenticated_resultTupleSchemeFactory();
-
- public boolean success; // required
- public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success"),
- AE((short)1, "ae");
-
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
-
- static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 0: // SUCCESS
- return SUCCESS;
- case 1: // AE
- return AE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- private static final int __SUCCESS_ISSET_ID = 0;
- private byte __isset_bitfield = 0;
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
- tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isUserAuthenticated_result.class, metaDataMap);
- }
-
- public isUserAuthenticated_result() {
- }
-
- public isUserAuthenticated_result(
- boolean success,
- org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
- {
- this();
- this.success = success;
- setSuccessIsSet(true);
- this.ae = ae;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public isUserAuthenticated_result(isUserAuthenticated_result other) {
- __isset_bitfield = other.__isset_bitfield;
- this.success = other.success;
- if (other.isSetAe()) {
- this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
- }
- }
-
- public isUserAuthenticated_result deepCopy() {
- return new isUserAuthenticated_result(this);
- }
-
- @Override
- public void clear() {
- setSuccessIsSet(false);
- this.success = false;
- this.ae = null;
- }
-
- public boolean isSuccess() {
- return this.success;
- }
-
- public isUserAuthenticated_result setSuccess(boolean success) {
- this.success = success;
- setSuccessIsSet(true);
- return this;
- }
-
- public void unsetSuccess() {
- __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
- }
-
- public void setSuccessIsSet(boolean value) {
- __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
- return this.ae;
- }
-
- public isUserAuthenticated_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
- this.ae = ae;
- return this;
- }
-
- public void unsetAe() {
- this.ae = null;
- }
-
- /** Returns true if field ae is set (has been assigned a value) and false otherwise */
- public boolean isSetAe() {
- return this.ae != null;
- }
-
- public void setAeIsSet(boolean value) {
- if (!value) {
- this.ae = null;
- }
- }
-
- public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((Boolean)value);
- }
- break;
-
- case AE:
- if (value == null) {
- unsetAe();
- } else {
- setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
- }
- break;
-
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return isSuccess();
-
- case AE:
- return getAe();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- case AE:
- return isSetAe();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof isUserAuthenticated_result)
- return this.equals((isUserAuthenticated_result)that);
- return false;
- }
-
- public boolean equals(isUserAuthenticated_result that) {
- if (that == null)
- return false;
- if (this == that)
- return true;
-
- boolean this_present_success = true;
- boolean that_present_success = true;
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (this.success != that.success)
- return false;
- }
-
- boolean this_present_ae = true && this.isSetAe();
- boolean that_present_ae = true && that.isSetAe();
- if (this_present_ae || that_present_ae) {
- if (!(this_present_ae && that_present_ae))
- return false;
- if (!this.ae.equals(that.ae))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 1;
-
- hashCode = hashCode * 8191 + ((success) ? 131071 : 524287);
-
- hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
- if (isSetAe())
- hashCode = hashCode * 8191 + ae.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(isUserAuthenticated_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAe()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- @org.apache.thrift.annotation.Nullable
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- scheme(oprot).write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("isUserAuthenticated_result(");
- boolean first = true;
-
- sb.append("success:");
- sb.append(this.success);
- first = false;
- if (!first) sb.append(", ");
- sb.append("ae:");
- if (this.ae == null) {
- sb.append("null");
- } else {
- sb.append(this.ae);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
- __isset_bitfield = 0;
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class isUserAuthenticated_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public isUserAuthenticated_resultStandardScheme getScheme() {
- return new isUserAuthenticated_resultStandardScheme();
- }
- }
-
- private static class isUserAuthenticated_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<isUserAuthenticated_result> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
- struct.success = iprot.readBool();
- struct.setSuccessIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 1: // AE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
- struct.ae.read(iprot);
- struct.setAeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.isSetSuccess()) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- oprot.writeBool(struct.success);
- oprot.writeFieldEnd();
- }
- if (struct.ae != null) {
- oprot.writeFieldBegin(AE_FIELD_DESC);
- struct.ae.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class isUserAuthenticated_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public isUserAuthenticated_resultTupleScheme getScheme() {
- return new isUserAuthenticated_resultTupleScheme();
- }
- }
-
- private static class isUserAuthenticated_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<isUserAuthenticated_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- java.util.BitSet optionals = new java.util.BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- if (struct.isSetAe()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetSuccess()) {
- oprot.writeBool(struct.success);
- }
- if (struct.isSetAe()) {
- struct.ae.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- java.util.BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.success = iprot.readBool();
- struct.setSuccessIsSet(true);
- }
- if (incoming.get(1)) {
- struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
- struct.ae.read(iprot);
- struct.setAeIsSet(true);
- }
- }
- }
-
- private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
- return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
- }
- }
-
- public static class getUserInfoFromAuthzToken_args implements org.apache.thrift.TBase<getUserInfoFromAuthzToken_args, getUserInfoFromAuthzToken_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUserInfoFromAuthzToken_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserInfoFromAuthzToken_args");
-
- private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserInfoFromAuthzToken_argsStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserInfoFromAuthzToken_argsTupleSchemeFactory();
-
- public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- AUTHZ_TOKEN((short)1, "authzToken");
-
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
-
- static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // AUTHZ_TOKEN
- return AUTHZ_TOKEN;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserInfoFromAuthzToken_args.class, metaDataMap);
- }
-
- public getUserInfoFromAuthzToken_args() {
- }
-
- public getUserInfoFromAuthzToken_args(
- org.apache.custos.commons.model.security.AuthzToken authzToken)
- {
- this();
- this.authzToken = authzToken;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public getUserInfoFromAuthzToken_args(getUserInfoFromAuthzToken_args other) {
- if (other.isSetAuthzToken()) {
- this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
- }
- }
-
- public getUserInfoFromAuthzToken_args deepCopy() {
- return new getUserInfoFromAuthzToken_args(this);
- }
-
- @Override
- public void clear() {
- this.authzToken = null;
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
- return this.authzToken;
- }
-
- public getUserInfoFromAuthzToken_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
- this.authzToken = authzToken;
- return this;
- }
-
- public void unsetAuthzToken() {
- this.authzToken = null;
- }
-
- /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthzToken() {
- return this.authzToken != null;
- }
-
- public void setAuthzTokenIsSet(boolean value) {
- if (!value) {
- this.authzToken = null;
- }
- }
-
- public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
- switch (field) {
- case AUTHZ_TOKEN:
- if (value == null) {
- unsetAuthzToken();
- } else {
- setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
- }
- break;
-
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case AUTHZ_TOKEN:
- return getAuthzToken();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case AUTHZ_TOKEN:
- return isSetAuthzToken();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof getUserInfoFromAuthzToken_args)
- return this.equals((getUserInfoFromAuthzToken_args)that);
- return false;
- }
-
- public boolean equals(getUserInfoFromAuthzToken_args that) {
- if (that == null)
- return false;
- if (this == that)
- return true;
-
- boolean this_present_authzToken = true && this.isSetAuthzToken();
- boolean that_present_authzToken = true && that.isSetAuthzToken();
- if (this_present_authzToken || that_present_authzToken) {
- if (!(this_present_authzToken && that_present_authzToken))
- return false;
- if (!this.authzToken.equals(that.authzToken))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 1;
-
- hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
- if (isSetAuthzToken())
- hashCode = hashCode * 8191 + authzToken.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(getUserInfoFromAuthzToken_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthzToken()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- @org.apache.thrift.annotation.Nullable
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- scheme(oprot).write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("getUserInfoFromAuthzToken_args(");
- boolean first = true;
-
- sb.append("authzToken:");
- if (this.authzToken == null) {
- sb.append("null");
- } else {
- sb.append(this.authzToken);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (authzToken == null) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
- }
- // check for sub-struct validity
- if (authzToken != null) {
- authzToken.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class getUserInfoFromAuthzToken_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public getUserInfoFromAuthzToken_argsStandardScheme getScheme() {
- return new getUserInfoFromAuthzToken_argsStandardScheme();
- }
- }
-
- private static class getUserInfoFromAuthzToken_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserInfoFromAuthzToken_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // AUTHZ_TOKEN
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
- struct.authzToken.read(iprot);
- struct.setAuthzTokenIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.authzToken != null) {
- oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
- struct.authzToken.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class getUserInfoFromAuthzToken_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public getUserInfoFromAuthzToken_argsTupleScheme getScheme() {
- return new getUserInfoFromAuthzToken_argsTupleScheme();
- }
- }
-
- private static class getUserInfoFromAuthzToken_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserInfoFromAuthzToken_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- struct.authzToken.write(oprot);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
- struct.authzToken.read(iprot);
- struct.setAuthzTokenIsSet(true);
- }
- }
-
- private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
- return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
- }
- }
-
- public static class getUserInfoFromAuthzToken_result implements org.apache.thrift.TBase<getUserInfoFromAuthzToken_result, getUserInfoFromAuthzToken_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUserInfoFromAuthzToken_result> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserInfoFromAuthzToken_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
- private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserInfoFromAuthzToken_resultStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserInfoFromAuthzToken_resultTupleSchemeFactory();
-
- public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.UserInfo success; // required
- public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success"),
- AE((short)1, "ae");
-
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
-
- static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 0: // SUCCESS
- return SUCCESS;
- case 1: // AE
- return AE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.UserInfo.class)));
- tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserInfoFromAuthzToken_result.class, metaDataMap);
- }
-
- public getUserInfoFromAuthzToken_result() {
- }
-
- public getUserInfoFromAuthzToken_result(
- org.apache.custos.commons.model.security.UserInfo success,
- org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
- {
- this();
- this.success = success;
- this.ae = ae;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public getUserInfoFromAuthzToken_result(getUserInfoFromAuthzToken_result other) {
- if (other.isSetSuccess()) {
- this.success = new org.apache.custos.commons.model.security.UserInfo(other.success);
- }
- if (other.isSetAe()) {
- this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
- }
- }
-
- public getUserInfoFromAuthzToken_result deepCopy() {
- return new getUserInfoFromAuthzToken_result(this);
- }
-
- @Override
- public void clear() {
- this.success = null;
- this.ae = null;
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.custos.commons.model.security.UserInfo getSuccess() {
- return this.success;
- }
-
- public getUserInfoFromAuthzToken_result setSuccess(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.UserInfo success) {
- this.success = success;
- return this;
- }
-
- public void unsetSuccess() {
- this.success = null;
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return this.success != null;
- }
-
- public void setSuccessIsSet(boolean value) {
- if (!value) {
- this.success = null;
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
- return this.ae;
- }
-
- public getUserInfoFromAuthzToken_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
- this.ae = ae;
- return this;
- }
-
- public void unsetAe() {
- this.ae = null;
- }
-
- /** Returns true if field ae is set (has been assigned a value) and false otherwise */
- public boolean isSetAe() {
- return this.ae != null;
- }
-
- public void setAeIsSet(boolean value) {
- if (!value) {
- this.ae = null;
- }
- }
-
- public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((org.apache.custos.commons.model.security.UserInfo)value);
- }
- break;
-
- case AE:
- if (value == null) {
- unsetAe();
- } else {
- setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
- }
- break;
-
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return getSuccess();
-
- case AE:
- return getAe();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- case AE:
- return isSetAe();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof getUserInfoFromAuthzToken_result)
- return this.equals((getUserInfoFromAuthzToken_result)that);
- return false;
- }
-
- public boolean equals(getUserInfoFromAuthzToken_result that) {
- if (that == null)
- return false;
- if (this == that)
- return true;
-
- boolean this_present_success = true && this.isSetSuccess();
- boolean that_present_success = true && that.isSetSuccess();
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (!this.success.equals(that.success))
- return false;
- }
-
- boolean this_present_ae = true && this.isSetAe();
- boolean that_present_ae = true && that.isSetAe();
- if (this_present_ae || that_present_ae) {
- if (!(this_present_ae && that_present_ae))
- return false;
- if (!this.ae.equals(that.ae))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 1;
-
- hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
- if (isSetSuccess())
- hashCode = hashCode * 8191 + success.hashCode();
-
- hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
- if (isSetAe())
- hashCode = hashCode * 8191 + ae.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(getUserInfoFromAuthzToken_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAe()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- @org.apache.thrift.annotation.Nullable
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- scheme(oprot).write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("getUserInfoFromAuthzToken_result(");
- boolean first = true;
-
- sb.append("success:");
- if (this.success == null) {
- sb.append("null");
- } else {
- sb.append(this.success);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("ae:");
- if (this.ae == null) {
- sb.append("null");
- } else {
- sb.append(this.ae);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- if (success != null) {
- success.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class getUserInfoFromAuthzToken_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public getUserInfoFromAuthzToken_resultStandardScheme getScheme() {
- return new getUserInfoFromAuthzToken_resultStandardScheme();
- }
- }
-
- private static class getUserInfoFromAuthzToken_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserInfoFromAuthzToken_result> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.success = new org.apache.custos.commons.model.security.UserInfo();
- struct.success.read(iprot);
- struct.setSuccessIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 1: // AE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
- struct.ae.read(iprot);
- struct.setAeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- struct.success.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.ae != null) {
- oprot.writeFieldBegin(AE_FIELD_DESC);
- struct.ae.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class getUserInfoFromAuthzToken_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public getUserInfoFromAuthzToken_resultTupleScheme getScheme() {
- return new getUserInfoFromAuthzToken_resultTupleScheme();
- }
- }
-
- private static class getUserInfoFromAuthzToken_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserInfoFromAuthzToken_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- java.util.BitSet optionals = new java.util.BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- if (struct.isSetAe()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetSuccess()) {
- struct.success.write(oprot);
- }
- if (struct.isSetAe()) {
- struct.ae.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- java.util.BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.success = new org.apache.custos.commons.model.security.UserInfo();
- struct.success.read(iprot);
- struct.setSuccessIsSet(true);
- }
- if (incoming.get(1)) {
- struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
- struct.ae.read(iprot);
- struct.setAeIsSet(true);
- }
- }
- }
-
- private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
- return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
- }
- }
-
- public static class getUserManagementServiceAccountAuthzToken_args implements org.apache.thrift.TBase<getUserManagementServiceAccountAuthzToken_args, getUserManagementServiceAccountAuthzToken_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUserManagementServiceAccountAuthzToken_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserManagementServiceAccountAuthzToken_args");
-
- private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)2);
-
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_argsStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_argsTupleSchemeFactory();
-
- public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
- public @org.apache.thrift.annotation.Nullable String gatewayId; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- AUTHZ_TOKEN((short)1, "authzToken"),
- GATEWAY_ID((short)2, "gatewayId");
-
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
-
- static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // AUTHZ_TOKEN
- return AUTHZ_TOKEN;
- case 2: // GATEWAY_ID
- return GATEWAY_ID;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
- tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserManagementServiceAccountAuthzToken_args.class, metaDataMap);
- }
-
- public getUserManagementServiceAccountAuthzToken_args() {
- }
-
- public getUserManagementServiceAccountAuthzToken_args(
- org.apache.custos.commons.model.security.AuthzToken authzToken,
- String gatewayId)
- {
- this();
- this.authzToken = authzToken;
- this.gatewayId = gatewayId;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public getUserManagementServiceAccountAuthzToken_args(getUserManagementServiceAccountAuthzToken_args other) {
- if (other.isSetAuthzToken()) {
- this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
- }
- if (other.isSetGatewayId()) {
- this.gatewayId = other.gatewayId;
- }
- }
-
- public getUserManagementServiceAccountAuthzToken_args deepCopy() {
- return new getUserManagementServiceAccountAuthzToken_args(this);
- }
-
- @Override
- public void clear() {
- this.authzToken = null;
- this.gatewayId = null;
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
- return this.authzToken;
- }
-
- public getUserManagementServiceAccountAuthzToken_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
- this.authzToken = authzToken;
- return this;
- }
-
- public void unsetAuthzToken() {
- this.authzToken = null;
- }
-
- /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
- public boolean isSetAuthzToken() {
- return this.authzToken != null;
- }
-
- public void setAuthzTokenIsSet(boolean value) {
- if (!value) {
- this.authzToken = null;
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public String getGatewayId() {
- return this.gatewayId;
- }
-
- public getUserManagementServiceAccountAuthzToken_args setGatewayId(@org.apache.thrift.annotation.Nullable String gatewayId) {
- this.gatewayId = gatewayId;
- return this;
- }
-
- public void unsetGatewayId() {
- this.gatewayId = null;
- }
-
- /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */
- public boolean isSetGatewayId() {
- return this.gatewayId != null;
- }
-
- public void setGatewayIdIsSet(boolean value) {
- if (!value) {
- this.gatewayId = null;
- }
- }
-
- public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
- switch (field) {
- case AUTHZ_TOKEN:
- if (value == null) {
- unsetAuthzToken();
- } else {
- setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
- }
- break;
-
- case GATEWAY_ID:
- if (value == null) {
- unsetGatewayId();
- } else {
- setGatewayId((String)value);
- }
- break;
-
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case AUTHZ_TOKEN:
- return getAuthzToken();
-
- case GATEWAY_ID:
- return getGatewayId();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case AUTHZ_TOKEN:
- return isSetAuthzToken();
- case GATEWAY_ID:
- return isSetGatewayId();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof getUserManagementServiceAccountAuthzToken_args)
- return this.equals((getUserManagementServiceAccountAuthzToken_args)that);
- return false;
- }
-
- public boolean equals(getUserManagementServiceAccountAuthzToken_args that) {
- if (that == null)
- return false;
- if (this == that)
- return true;
-
- boolean this_present_authzToken = true && this.isSetAuthzToken();
- boolean that_present_authzToken = true && that.isSetAuthzToken();
- if (this_present_authzToken || that_present_authzToken) {
- if (!(this_present_authzToken && that_present_authzToken))
- return false;
- if (!this.authzToken.equals(that.authzToken))
- return false;
- }
-
- boolean this_present_gatewayId = true && this.isSetGatewayId();
- boolean that_present_gatewayId = true && that.isSetGatewayId();
- if (this_present_gatewayId || that_present_gatewayId) {
- if (!(this_present_gatewayId && that_present_gatewayId))
- return false;
- if (!this.gatewayId.equals(that.gatewayId))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 1;
-
- hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
- if (isSetAuthzToken())
- hashCode = hashCode * 8191 + authzToken.hashCode();
-
- hashCode = hashCode * 8191 + ((isSetGatewayId()) ? 131071 : 524287);
- if (isSetGatewayId())
- hashCode = hashCode * 8191 + gatewayId.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(getUserManagementServiceAccountAuthzToken_args other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAuthzToken()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetGatewayId()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- @org.apache.thrift.annotation.Nullable
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- scheme(oprot).write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("getUserManagementServiceAccountAuthzToken_args(");
- boolean first = true;
-
- sb.append("authzToken:");
- if (this.authzToken == null) {
- sb.append("null");
- } else {
- sb.append(this.authzToken);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("gatewayId:");
- if (this.gatewayId == null) {
- sb.append("null");
- } else {
- sb.append(this.gatewayId);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (authzToken == null) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
- }
- if (gatewayId == null) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString());
- }
- // check for sub-struct validity
- if (authzToken != null) {
- authzToken.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class getUserManagementServiceAccountAuthzToken_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public getUserManagementServiceAccountAuthzToken_argsStandardScheme getScheme() {
- return new getUserManagementServiceAccountAuthzToken_argsStandardScheme();
- }
- }
-
- private static class getUserManagementServiceAccountAuthzToken_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserManagementServiceAccountAuthzToken_args> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // AUTHZ_TOKEN
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
- struct.authzToken.read(iprot);
- struct.setAuthzTokenIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 2: // GATEWAY_ID
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.gatewayId = iprot.readString();
- struct.setGatewayIdIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.authzToken != null) {
- oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
- struct.authzToken.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.gatewayId != null) {
- oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
- oprot.writeString(struct.gatewayId);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class getUserManagementServiceAccountAuthzToken_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public getUserManagementServiceAccountAuthzToken_argsTupleScheme getScheme() {
- return new getUserManagementServiceAccountAuthzToken_argsTupleScheme();
- }
- }
-
- private static class getUserManagementServiceAccountAuthzToken_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserManagementServiceAccountAuthzToken_args> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- struct.authzToken.write(oprot);
- oprot.writeString(struct.gatewayId);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
- struct.authzToken.read(iprot);
- struct.setAuthzTokenIsSet(true);
- struct.gatewayId = iprot.readString();
- struct.setGatewayIdIsSet(true);
- }
- }
-
- private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
- return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
- }
- }
-
- public static class getUserManagementServiceAccountAuthzToken_result implements org.apache.thrift.TBase<getUserManagementServiceAccountAuthzToken_result, getUserManagementServiceAccountAuthzToken_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUserManagementServiceAccountAuthzToken_result> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserManagementServiceAccountAuthzToken_result");
-
- private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
- private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
-
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_resultStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_resultTupleSchemeFactory();
-
- public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken success; // required
- public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- SUCCESS((short)0, "success"),
- AE((short)1, "ae");
-
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
-
- static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 0: // SUCCESS
- return SUCCESS;
- case 1: // AE
- return AE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- @org.apache.thrift.annotation.Nullable
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
- tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserManagementServiceAccountAuthzToken_result.class, metaDataMap);
- }
-
- public getUserManagementServiceAccountAuthzToken_result() {
- }
-
- public getUserManagementServiceAccountAuthzToken_result(
- org.apache.custos.commons.model.security.AuthzToken success,
- org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
- {
- this();
- this.success = success;
- this.ae = ae;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public getUserManagementServiceAccountAuthzToken_result(getUserManagementServiceAccountAuthzToken_result other) {
- if (other.isSetSuccess()) {
- this.success = new org.apache.custos.commons.model.security.AuthzToken(other.success);
- }
- if (other.isSetAe()) {
- this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
- }
- }
-
- public getUserManagementServiceAccountAuthzToken_result deepCopy() {
- return new getUserManagementServiceAccountAuthzToken_result(this);
- }
-
- @Override
- public void clear() {
- this.success = null;
- this.ae = null;
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.custos.commons.model.security.AuthzToken getSuccess() {
- return this.success;
- }
-
- public getUserManagementServiceAccountAuthzToken_result setSuccess(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken success) {
- this.success = success;
- return this;
- }
-
- public void unsetSuccess() {
- this.success = null;
- }
-
- /** Returns true if field success is set (has been assigned a value) and false otherwise */
- public boolean isSetSuccess() {
- return this.success != null;
- }
-
- public void setSuccessIsSet(boolean value) {
- if (!value) {
- this.success = null;
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
- return this.ae;
- }
-
- public getUserManagementServiceAccountAuthzToken_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
- this.ae = ae;
- return this;
- }
-
- public void unsetAe() {
- this.ae = null;
- }
-
- /** Returns true if field ae is set (has been assigned a value) and false otherwise */
- public boolean isSetAe() {
- return this.ae != null;
- }
-
- public void setAeIsSet(boolean value) {
- if (!value) {
- this.ae = null;
- }
- }
-
- public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
- switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((org.apache.custos.commons.model.security.AuthzToken)value);
- }
- break;
-
- case AE:
- if (value == null) {
- unsetAe();
- } else {
- setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
- }
- break;
-
- }
- }
-
- @org.apache.thrift.annotation.Nullable
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case SUCCESS:
- return getSuccess();
-
- case AE:
- return getAe();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case SUCCESS:
- return isSetSuccess();
- case AE:
- return isSetAe();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof getUserManagementServiceAccountAuthzToken_result)
- return this.equals((getUserManagementServiceAccountAuthzToken_result)that);
- return false;
- }
-
- public boolean equals(getUserManagementServiceAccountAuthzToken_result that) {
- if (that == null)
- return false;
- if (this == that)
- return true;
-
- boolean this_present_success = true && this.isSetSuccess();
- boolean that_present_success = true && that.isSetSuccess();
- if (this_present_success || that_present_success) {
- if (!(this_present_success && that_present_success))
- return false;
- if (!this.success.equals(that.success))
- return false;
- }
-
- boolean this_present_ae = true && this.isSetAe();
- boolean that_present_ae = true && that.isSetAe();
- if (this_present_ae || that_present_ae) {
- if (!(this_present_ae && that_present_ae))
- return false;
- if (!this.ae.equals(that.ae))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 1;
-
- hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
- if (isSetSuccess())
- hashCode = hashCode * 8191 + success.hashCode();
-
- hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
- if (isSetAe())
- hashCode = hashCode * 8191 + ae.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(getUserManagementServiceAccountAuthzToken_result other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetSuccess()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetAe()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- @org.apache.thrift.annotation.Nullable
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- scheme(oprot).write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("getUserManagementServiceAccountAuthzToken_result(");
- boolean first = true;
-
- sb.append("success:");
- if (this.success == null) {
- sb.append("null");
- } else {
- sb.append(this.success);
- }
- first = false;
- if (!first) sb.append(", ");
- sb.append("ae:");
- if (this.ae == null) {
- sb.append("null");
- } else {
- sb.append(this.ae);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- // check for sub-struct validity
- if (success != null) {
- success.validate();
- }
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class getUserManagementServiceAccountAuthzToken_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public getUserManagementServiceAccountAuthzToken_resultStandardScheme getScheme() {
- return new getUserManagementServiceAccountAuthzToken_resultStandardScheme();
- }
- }
-
- private static class getUserManagementServiceAccountAuthzToken_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserManagementServiceAccountAuthzToken_result> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 0: // SUCCESS
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.success = new org.apache.custos.commons.model.security.AuthzToken();
- struct.success.read(iprot);
- struct.setSuccessIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- case 1: // AE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
- struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
- struct.ae.read(iprot);
- struct.setAeIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
-
- // check for required fields of primitive type, which can't be checked in the validate method
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.success != null) {
- oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
- struct.success.write(oprot);
- oprot.writeFieldEnd();
- }
- if (struct.ae != null) {
- oprot.writeFieldBegin(AE_FIELD_DESC);
- struct.ae.write(oprot);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class getUserManagementServiceAccountAuthzToken_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public getUserManagementServiceAccountAuthzToken_resultTupleScheme getScheme() {
- return new getUserManagementServiceAccountAuthzToken_resultTupleScheme();
- }
- }
-
- private static class getUserManagementServiceAccountAuthzToken_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserManagementServiceAccountAuthzToken_result> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- java.util.BitSet optionals = new java.util.BitSet();
- if (struct.isSetSuccess()) {
- optionals.set(0);
- }
- if (struct.isSetAe()) {
- optionals.set(1);
- }
- oprot.writeBitSet(optionals, 2);
- if (struct.isSetSuccess()) {
- struct.success.write(oprot);
- }
- if (struct.isSetAe()) {
- struct.ae.write(oprot);
- }
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- java.util.BitSet incoming = iprot.readBitSet(2);
- if (incoming.get(0)) {
- struct.success = new org.apache.custos.commons.model.security.AuthzToken();
- struct.success.read(iprot);
- struct.setSuccessIsSet(true);
- }
- if (incoming.get(1)) {
- struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
- struct.ae.read(iprot);
- struct.setAeIsSet(true);
- }
- }
- }
-
- private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
- return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
- }
- }
-
-}
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java b/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java
index 9c4b981..551cead 100644
--- a/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java
@@ -16,7 +16,7 @@ public class CustosAuthenticationService {
public org.apache.custos.commons.model.security.UserInfo getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
- public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
+ public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
}
@@ -26,7 +26,7 @@ public class CustosAuthenticationService {
public void getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException;
- public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException;
+ public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException;
}
@@ -102,17 +102,19 @@ public class CustosAuthenticationService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserInfoFromAuthzToken failed: unknown result");
}
- public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+ public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
{
- send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
+ send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId, clientId, clientSecret);
return recv_getUserManagementServiceAccountAuthzToken();
}
- public void send_getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.thrift.TException
+ public void send_getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws org.apache.thrift.TException
{
getUserManagementServiceAccountAuthzToken_args args = new getUserManagementServiceAccountAuthzToken_args();
args.setAuthzToken(authzToken);
args.setGatewayId(gatewayId);
+ args.setClientId(clientId);
+ args.setClientSecret(clientSecret);
sendBase("getUserManagementServiceAccountAuthzToken", args);
}
@@ -211,9 +213,9 @@ public class CustosAuthenticationService {
}
}
- public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
+ public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
checkReady();
- getUserManagementServiceAccountAuthzToken_call method_call = new getUserManagementServiceAccountAuthzToken_call(authzToken, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+ getUserManagementServiceAccountAuthzToken_call method_call = new getUserManagementServiceAccountAuthzToken_call(authzToken, gatewayId, clientId, clientSecret, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -221,10 +223,14 @@ public class CustosAuthenticationService {
public static class getUserManagementServiceAccountAuthzToken_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.commons.model.security.AuthzToken> {
private org.apache.custos.commons.model.security.AuthzToken authzToken;
private String gatewayId;
- public getUserManagementServiceAccountAuthzToken_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+ private String clientId;
+ private String clientSecret;
+ public getUserManagementServiceAccountAuthzToken_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
this.authzToken = authzToken;
this.gatewayId = gatewayId;
+ this.clientId = clientId;
+ this.clientSecret = clientSecret;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -232,6 +238,8 @@ public class CustosAuthenticationService {
getUserManagementServiceAccountAuthzToken_args args = new getUserManagementServiceAccountAuthzToken_args();
args.setAuthzToken(authzToken);
args.setGatewayId(gatewayId);
+ args.setClientId(clientId);
+ args.setClientSecret(clientSecret);
args.write(prot);
prot.writeMessageEnd();
}
@@ -345,7 +353,7 @@ public class CustosAuthenticationService {
public getUserManagementServiceAccountAuthzToken_result getResult(I iface, getUserManagementServiceAccountAuthzToken_args args) throws org.apache.thrift.TException {
getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
try {
- result.success = iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId);
+ result.success = iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId, args.clientId, args.clientSecret);
} catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
result.ae = ae;
}
@@ -449,7 +457,7 @@ public class CustosAuthenticationService {
public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo>() {
+ return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo>() {
public void onComplete(org.apache.custos.commons.model.security.UserInfo o) {
getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
result.success = o;
@@ -514,7 +522,7 @@ public class CustosAuthenticationService {
public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
- return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken>() {
+ return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken>() {
public void onComplete(org.apache.custos.commons.model.security.AuthzToken o) {
getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
result.success = o;
@@ -564,7 +572,7 @@ public class CustosAuthenticationService {
}
public void start(I iface, getUserManagementServiceAccountAuthzToken_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
- iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId,resultHandler);
+ iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId, args.clientId, args.clientSecret,resultHandler);
}
}
@@ -644,8 +652,8 @@ public class CustosAuthenticationService {
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+ tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isUserAuthenticated_args.class, metaDataMap);
}
@@ -654,7 +662,7 @@ public class CustosAuthenticationService {
}
public isUserAuthenticated_args(
- org.apache.custos.commons.model.security.AuthzToken authzToken)
+ org.apache.custos.commons.model.security.AuthzToken authzToken)
{
this();
this.authzToken = authzToken;
@@ -705,13 +713,13 @@ public class CustosAuthenticationService {
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
switch (field) {
- case AUTHZ_TOKEN:
- if (value == null) {
- unsetAuthzToken();
- } else {
- setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
- }
- break;
+ case AUTHZ_TOKEN:
+ if (value == null) {
+ unsetAuthzToken();
+ } else {
+ setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+ }
+ break;
}
}
@@ -719,8 +727,8 @@ public class CustosAuthenticationService {
@org.apache.thrift.annotation.Nullable
public Object getFieldValue(_Fields field) {
switch (field) {
- case AUTHZ_TOKEN:
- return getAuthzToken();
+ case AUTHZ_TOKEN:
+ return getAuthzToken();
}
throw new IllegalStateException();
@@ -733,8 +741,8 @@ public class CustosAuthenticationService {
}
switch (field) {
- case AUTHZ_TOKEN:
- return isSetAuthzToken();
+ case AUTHZ_TOKEN:
+ return isSetAuthzToken();
}
throw new IllegalStateException();
}
@@ -868,7 +876,7 @@ public class CustosAuthenticationService {
while (true)
{
schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
@@ -877,7 +885,7 @@ public class CustosAuthenticationService {
struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
struct.authzToken.read(iprot);
struct.setAuthzTokenIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -1016,10 +1024,10 @@ public class CustosAuthenticationService {
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
- tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+ tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isUserAuthenticated_result.class, metaDataMap);
}
@@ -1028,8 +1036,8 @@ public class CustosAuthenticationService {
}
public isUserAuthenticated_result(
- boolean success,
- org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+ boolean success,
+ org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
{
this();
this.success = success;
@@ -1109,21 +1117,21 @@ public class CustosAuthenticationService {
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((Boolean)value);
- }
- break;
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((Boolean)value);
+ }
+ break;
- case AE:
- if (value == null) {
- unsetAe();
- } else {
- setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
- }
- break;
+ case AE:
+ if (value == null) {
+ unsetAe();
+ } else {
+ setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+ }
+ break;
}
}
@@ -1131,11 +1139,11 @@ public class CustosAuthenticationService {
@org.apache.thrift.annotation.Nullable
public Object getFieldValue(_Fields field) {
switch (field) {
- case SUCCESS:
- return isSuccess();
+ case SUCCESS:
+ return isSuccess();
- case AE:
- return getAe();
+ case AE:
+ return getAe();
}
throw new IllegalStateException();
@@ -1148,10 +1156,10 @@ public class CustosAuthenticationService {
}
switch (field) {
- case SUCCESS:
- return isSetSuccess();
- case AE:
- return isSetAe();
+ case SUCCESS:
+ return isSetSuccess();
+ case AE:
+ return isSetAe();
}
throw new IllegalStateException();
}
@@ -1247,7 +1255,7 @@ public class CustosAuthenticationService {
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
scheme(oprot).write(oprot, this);
- }
+ }
@Override
public String toString() {
@@ -1306,7 +1314,7 @@ public class CustosAuthenticationService {
while (true)
{
schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
@@ -1314,7 +1322,7 @@ public class CustosAuthenticationService {
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
struct.success = iprot.readBool();
struct.setSuccessIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -1323,7 +1331,7 @@ public class CustosAuthenticationService {
struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
struct.ae.read(iprot);
struct.setAeIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -1480,8 +1488,8 @@ public class CustosAuthenticationService {
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+ tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserInfoFromAuthzToken_args.class, metaDataMap);
}
@@ -1490,7 +1498,7 @@ public class CustosAuthenticationService {
}
public getUserInfoFromAuthzToken_args(
- org.apache.custos.commons.model.security.AuthzToken authzToken)
+ org.apache.custos.commons.model.security.AuthzToken authzToken)
{
this();
this.authzToken = authzToken;
@@ -1541,13 +1549,13 @@ public class CustosAuthenticationService {
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
switch (field) {
- case AUTHZ_TOKEN:
- if (value == null) {
- unsetAuthzToken();
- } else {
- setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
- }
- break;
+ case AUTHZ_TOKEN:
+ if (value == null) {
+ unsetAuthzToken();
+ } else {
+ setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+ }
+ break;
}
}
@@ -1555,8 +1563,8 @@ public class CustosAuthenticationService {
@org.apache.thrift.annotation.Nullable
public Object getFieldValue(_Fields field) {
switch (field) {
- case AUTHZ_TOKEN:
- return getAuthzToken();
+ case AUTHZ_TOKEN:
+ return getAuthzToken();
}
throw new IllegalStateException();
@@ -1569,8 +1577,8 @@ public class CustosAuthenticationService {
}
switch (field) {
- case AUTHZ_TOKEN:
- return isSetAuthzToken();
+ case AUTHZ_TOKEN:
+ return isSetAuthzToken();
}
throw new IllegalStateException();
}
@@ -1704,7 +1712,7 @@ public class CustosAuthenticationService {
while (true)
{
schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
@@ -1713,7 +1721,7 @@ public class CustosAuthenticationService {
struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
struct.authzToken.read(iprot);
struct.setAuthzTokenIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -1850,10 +1858,10 @@ public class CustosAuthenticationService {
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.UserInfo.class)));
- tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.UserInfo.class)));
+ tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserInfoFromAuthzToken_result.class, metaDataMap);
}
@@ -1862,8 +1870,8 @@ public class CustosAuthenticationService {
}
public getUserInfoFromAuthzToken_result(
- org.apache.custos.commons.model.security.UserInfo success,
- org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+ org.apache.custos.commons.model.security.UserInfo success,
+ org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
{
this();
this.success = success;
@@ -1944,21 +1952,21 @@ public class CustosAuthenticationService {
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((org.apache.custos.commons.model.security.UserInfo)value);
- }
- break;
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((org.apache.custos.commons.model.security.UserInfo)value);
+ }
+ break;
- case AE:
- if (value == null) {
- unsetAe();
- } else {
- setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
- }
- break;
+ case AE:
+ if (value == null) {
+ unsetAe();
+ } else {
+ setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+ }
+ break;
}
}
@@ -1966,11 +1974,11 @@ public class CustosAuthenticationService {
@org.apache.thrift.annotation.Nullable
public Object getFieldValue(_Fields field) {
switch (field) {
- case SUCCESS:
- return getSuccess();
+ case SUCCESS:
+ return getSuccess();
- case AE:
- return getAe();
+ case AE:
+ return getAe();
}
throw new IllegalStateException();
@@ -1983,10 +1991,10 @@ public class CustosAuthenticationService {
}
switch (field) {
- case SUCCESS:
- return isSetSuccess();
- case AE:
- return isSetAe();
+ case SUCCESS:
+ return isSetSuccess();
+ case AE:
+ return isSetAe();
}
throw new IllegalStateException();
}
@@ -2084,7 +2092,7 @@ public class CustosAuthenticationService {
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
scheme(oprot).write(oprot, this);
- }
+ }
@Override
public String toString() {
@@ -2148,7 +2156,7 @@ public class CustosAuthenticationService {
while (true)
{
schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
@@ -2157,7 +2165,7 @@ public class CustosAuthenticationService {
struct.success = new org.apache.custos.commons.model.security.UserInfo();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -2166,7 +2174,7 @@ public class CustosAuthenticationService {
struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
struct.ae.read(iprot);
struct.setAeIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -2255,17 +2263,23 @@ public class CustosAuthenticationService {
private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)2);
+ private static final org.apache.thrift.protocol.TField CLIENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("clientId", org.apache.thrift.protocol.TType.STRING, (short)3);
+ private static final org.apache.thrift.protocol.TField CLIENT_SECRET_FIELD_DESC = new org.apache.thrift.protocol.TField("clientSecret", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_argsStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_argsTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
public @org.apache.thrift.annotation.Nullable String gatewayId; // required
+ public @org.apache.thrift.annotation.Nullable String clientId; // required
+ public @org.apache.thrift.annotation.Nullable String clientSecret; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
AUTHZ_TOKEN((short)1, "authzToken"),
- GATEWAY_ID((short)2, "gatewayId");
+ GATEWAY_ID((short)2, "gatewayId"),
+ CLIENT_ID((short)3, "clientId"),
+ CLIENT_SECRET((short)4, "clientSecret");
private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
@@ -2285,6 +2299,10 @@ public class CustosAuthenticationService {
return AUTHZ_TOKEN;
case 2: // GATEWAY_ID
return GATEWAY_ID;
+ case 3: // CLIENT_ID
+ return CLIENT_ID;
+ case 4: // CLIENT_SECRET
+ return CLIENT_SECRET;
default:
return null;
}
@@ -2329,10 +2347,14 @@ public class CustosAuthenticationService {
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
- tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+ tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.CLIENT_ID, new org.apache.thrift.meta_data.FieldMetaData("clientId", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.CLIENT_SECRET, new org.apache.thrift.meta_data.FieldMetaData("clientSecret", org.apache.thrift.TFieldRequirementType.REQUIRED,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserManagementServiceAccountAuthzToken_args.class, metaDataMap);
}
@@ -2341,12 +2363,16 @@ public class CustosAuthenticationService {
}
public getUserManagementServiceAccountAuthzToken_args(
- org.apache.custos.commons.model.security.AuthzToken authzToken,
- String gatewayId)
+ org.apache.custos.commons.model.security.AuthzToken authzToken,
+ String gatewayId,
+ String clientId,
+ String clientSecret)
{
this();
this.authzToken = authzToken;
this.gatewayId = gatewayId;
+ this.clientId = clientId;
+ this.clientSecret = clientSecret;
}
/**
@@ -2359,6 +2385,12 @@ public class CustosAuthenticationService {
if (other.isSetGatewayId()) {
this.gatewayId = other.gatewayId;
}
+ if (other.isSetClientId()) {
+ this.clientId = other.clientId;
+ }
+ if (other.isSetClientSecret()) {
+ this.clientSecret = other.clientSecret;
+ }
}
public getUserManagementServiceAccountAuthzToken_args deepCopy() {
@@ -2369,6 +2401,8 @@ public class CustosAuthenticationService {
public void clear() {
this.authzToken = null;
this.gatewayId = null;
+ this.clientId = null;
+ this.clientSecret = null;
}
@org.apache.thrift.annotation.Nullable
@@ -2421,23 +2455,89 @@ public class CustosAuthenticationService {
}
}
+ @org.apache.thrift.annotation.Nullable
+ public String getClientId() {
+ return this.clientId;
+ }
+
+ public getUserManagementServiceAccountAuthzToken_args setClientId(@org.apache.thrift.annotation.Nullable String clientId) {
+ this.clientId = clientId;
+ return this;
+ }
+
+ public void unsetClientId() {
+ this.clientId = null;
+ }
+
+ /** Returns true if field clientId is set (has been assigned a value) and false otherwise */
+ public boolean isSetClientId() {
+ return this.clientId != null;
+ }
+
+ public void setClientIdIsSet(boolean value) {
+ if (!value) {
+ this.clientId = null;
+ }
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public String getClientSecret() {
+ return this.clientSecret;
+ }
+
+ public getUserManagementServiceAccountAuthzToken_args setClientSecret(@org.apache.thrift.annotation.Nullable String clientSecret) {
+ this.clientSecret = clientSecret;
+ return this;
+ }
+
+ public void unsetClientSecret() {
+ this.clientSecret = null;
+ }
+
+ /** Returns true if field clientSecret is set (has been assigned a value) and false otherwise */
+ public boolean isSetClientSecret() {
+ return this.clientSecret != null;
+ }
+
+ public void setClientSecretIsSet(boolean value) {
+ if (!value) {
+ this.clientSecret = null;
+ }
+ }
+
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
switch (field) {
- case AUTHZ_TOKEN:
- if (value == null) {
- unsetAuthzToken();
- } else {
- setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
- }
- break;
+ case AUTHZ_TOKEN:
+ if (value == null) {
+ unsetAuthzToken();
+ } else {
+ setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+ }
+ break;
- case GATEWAY_ID:
- if (value == null) {
- unsetGatewayId();
- } else {
- setGatewayId((String)value);
- }
- break;
+ case GATEWAY_ID:
+ if (value == null) {
+ unsetGatewayId();
+ } else {
+ setGatewayId((String)value);
+ }
+ break;
+
+ case CLIENT_ID:
+ if (value == null) {
+ unsetClientId();
+ } else {
+ setClientId((String)value);
+ }
+ break;
+
+ case CLIENT_SECRET:
+ if (value == null) {
+ unsetClientSecret();
+ } else {
+ setClientSecret((String)value);
+ }
+ break;
}
}
@@ -2445,11 +2545,17 @@ public class CustosAuthenticationService {
@org.apache.thrift.annotation.Nullable
public Object getFieldValue(_Fields field) {
switch (field) {
- case AUTHZ_TOKEN:
- return getAuthzToken();
+ case AUTHZ_TOKEN:
+ return getAuthzToken();
+
+ case GATEWAY_ID:
+ return getGatewayId();
- case GATEWAY_ID:
- return getGatewayId();
+ case CLIENT_ID:
+ return getClientId();
+
+ case CLIENT_SECRET:
+ return getClientSecret();
}
throw new IllegalStateException();
@@ -2462,10 +2568,14 @@ public class CustosAuthenticationService {
}
switch (field) {
- case AUTHZ_TOKEN:
- return isSetAuthzToken();
- case GATEWAY_ID:
- return isSetGatewayId();
+ case AUTHZ_TOKEN:
+ return isSetAuthzToken();
+ case GATEWAY_ID:
+ return isSetGatewayId();
+ case CLIENT_ID:
+ return isSetClientId();
+ case CLIENT_SECRET:
+ return isSetClientSecret();
}
throw new IllegalStateException();
}
@@ -2503,6 +2613,24 @@ public class CustosAuthenticationService {
return false;
}
+ boolean this_present_clientId = true && this.isSetClientId();
+ boolean that_present_clientId = true && that.isSetClientId();
+ if (this_present_clientId || that_present_clientId) {
+ if (!(this_present_clientId && that_present_clientId))
+ return false;
+ if (!this.clientId.equals(that.clientId))
+ return false;
+ }
+
+ boolean this_present_clientSecret = true && this.isSetClientSecret();
+ boolean that_present_clientSecret = true && that.isSetClientSecret();
+ if (this_present_clientSecret || that_present_clientSecret) {
+ if (!(this_present_clientSecret && that_present_clientSecret))
+ return false;
+ if (!this.clientSecret.equals(that.clientSecret))
+ return false;
+ }
+
return true;
}
@@ -2518,6 +2646,14 @@ public class CustosAuthenticationService {
if (isSetGatewayId())
hashCode = hashCode * 8191 + gatewayId.hashCode();
+ hashCode = hashCode * 8191 + ((isSetClientId()) ? 131071 : 524287);
+ if (isSetClientId())
+ hashCode = hashCode * 8191 + clientId.hashCode();
+
+ hashCode = hashCode * 8191 + ((isSetClientSecret()) ? 131071 : 524287);
+ if (isSetClientSecret())
+ hashCode = hashCode * 8191 + clientSecret.hashCode();
+
return hashCode;
}
@@ -2549,6 +2685,26 @@ public class CustosAuthenticationService {
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetClientId()).compareTo(other.isSetClientId());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetClientId()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.clientId, other.clientId);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = Boolean.valueOf(isSetClientSecret()).compareTo(other.isSetClientSecret());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetClientSecret()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.clientSecret, other.clientSecret);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -2585,6 +2741,22 @@ public class CustosAuthenticationService {
sb.append(this.gatewayId);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("clientId:");
+ if (this.clientId == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.clientId);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("clientSecret:");
+ if (this.clientSecret == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.clientSecret);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -2597,6 +2769,12 @@ public class CustosAuthenticationService {
if (gatewayId == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString());
}
+ if (clientId == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'clientId' was not present! Struct: " + toString());
+ }
+ if (clientSecret == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'clientSecret' was not present! Struct: " + toString());
+ }
// check for sub-struct validity
if (authzToken != null) {
authzToken.validate();
@@ -2633,7 +2811,7 @@ public class CustosAuthenticationService {
while (true)
{
schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
@@ -2642,7 +2820,7 @@ public class CustosAuthenticationService {
struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
struct.authzToken.read(iprot);
struct.setAuthzTokenIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -2650,7 +2828,23 @@ public class CustosAuthenticationService {
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.gatewayId = iprot.readString();
struct.setGatewayIdIsSet(true);
- } else {
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 3: // CLIENT_ID
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.clientId = iprot.readString();
+ struct.setClientIdIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 4: // CLIENT_SECRET
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.clientSecret = iprot.readString();
+ struct.setClientSecretIsSet(true);
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -2679,6 +2873,16 @@ public class CustosAuthenticationService {
oprot.writeString(struct.gatewayId);
oprot.writeFieldEnd();
}
+ if (struct.clientId != null) {
+ oprot.writeFieldBegin(CLIENT_ID_FIELD_DESC);
+ oprot.writeString(struct.clientId);
+ oprot.writeFieldEnd();
+ }
+ if (struct.clientSecret != null) {
+ oprot.writeFieldBegin(CLIENT_SECRET_FIELD_DESC);
+ oprot.writeString(struct.clientSecret);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -2698,6 +2902,8 @@ public class CustosAuthenticationService {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
struct.authzToken.write(oprot);
oprot.writeString(struct.gatewayId);
+ oprot.writeString(struct.clientId);
+ oprot.writeString(struct.clientSecret);
}
@Override
@@ -2708,6 +2914,10 @@ public class CustosAuthenticationService {
struct.setAuthzTokenIsSet(true);
struct.gatewayId = iprot.readString();
struct.setGatewayIdIsSet(true);
+ struct.clientId = iprot.readString();
+ struct.setClientIdIsSet(true);
+ struct.clientSecret = iprot.readString();
+ struct.setClientSecretIsSet(true);
}
}
@@ -2795,10 +3005,10 @@ public class CustosAuthenticationService {
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
- tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
- new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+ tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+ tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserManagementServiceAccountAuthzToken_result.class, metaDataMap);
}
@@ -2807,8 +3017,8 @@ public class CustosAuthenticationService {
}
public getUserManagementServiceAccountAuthzToken_result(
- org.apache.custos.commons.model.security.AuthzToken success,
- org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+ org.apache.custos.commons.model.security.AuthzToken success,
+ org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
{
this();
this.success = success;
@@ -2889,21 +3099,21 @@ public class CustosAuthenticationService {
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
switch (field) {
- case SUCCESS:
- if (value == null) {
- unsetSuccess();
- } else {
- setSuccess((org.apache.custos.commons.model.security.AuthzToken)value);
- }
- break;
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((org.apache.custos.commons.model.security.AuthzToken)value);
+ }
+ break;
- case AE:
- if (value == null) {
- unsetAe();
- } else {
- setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
- }
- break;
+ case AE:
+ if (value == null) {
+ unsetAe();
+ } else {
+ setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+ }
+ break;
}
}
@@ -2911,11 +3121,11 @@ public class CustosAuthenticationService {
@org.apache.thrift.annotation.Nullable
public Object getFieldValue(_Fields field) {
switch (field) {
- case SUCCESS:
- return getSuccess();
+ case SUCCESS:
+ return getSuccess();
- case AE:
- return getAe();
+ case AE:
+ return getAe();
}
throw new IllegalStateException();
@@ -2928,10 +3138,10 @@ public class CustosAuthenticationService {
}
switch (field) {
- case SUCCESS:
- return isSetSuccess();
- case AE:
- return isSetAe();
+ case SUCCESS:
+ return isSetSuccess();
+ case AE:
+ return isSetAe();
}
throw new IllegalStateException();
}
@@ -3029,7 +3239,7 @@ public class CustosAuthenticationService {
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
scheme(oprot).write(oprot, this);
- }
+ }
@Override
public String toString() {
@@ -3093,7 +3303,7 @@ public class CustosAuthenticationService {
while (true)
{
schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+ if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
@@ -3102,7 +3312,7 @@ public class CustosAuthenticationService {
struct.success = new org.apache.custos.commons.model.security.AuthzToken();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -3111,7 +3321,7 @@ public class CustosAuthenticationService {
struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
struct.ae.read(iprot);
struct.setAeIsSet(true);
- } else {
+ } else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
@@ -3195,4 +3405,4 @@ public class CustosAuthenticationService {
}
}
-}
+}
\ No newline at end of file
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java b/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java
index abb073a..1c078e0 100644
--- a/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java
@@ -4,7 +4,6 @@ import org.apache.custos.authentication.cpi.CustosAuthenticationService;
import org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException;
import org.apache.custos.commons.model.security.UserInfo;
import org.apache.custos.commons.exceptions.CustosSecurityException;
-import org.apache.custos.commons.model.error.AuthenticationException;
import org.apache.custos.commons.model.security.AuthzToken;
import org.apache.custos.commons.utils.Constants;
import org.apache.custos.security.manager.CustosSecurityManager;
@@ -16,7 +15,7 @@ public class CustosAuthenticationHandler implements CustosAuthenticationService.
private final static Logger logger = LoggerFactory.getLogger(CustosAuthenticationHandler.class);
@Override
- public boolean isUserAuthenticated(AuthzToken authzToken) throws AuthenticationException {
+ public boolean isUserAuthenticated(AuthzToken authzToken) throws CustosAuthenticationServiceException {
try {
CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
boolean isAuth = securityManager.isUserAuthenticated(authzToken);
@@ -25,11 +24,11 @@ public class CustosAuthenticationHandler implements CustosAuthenticationService.
return isAuth;
}
else{
- throw new AuthenticationException("User is not authenticated.");
+ throw new CustosAuthenticationServiceException("User is not authenticated.");
}
} catch (CustosSecurityException e) {
logger.error(e.getMessage(), e);
- throw new AuthenticationException("Error in authenticating.");
+ throw new CustosAuthenticationServiceException("Error in authenticating.");
}
}
@Override
@@ -44,10 +43,10 @@ public class CustosAuthenticationHandler implements CustosAuthenticationService.
}
}
@Override
- public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) throws CustosAuthenticationServiceException {
+ public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws CustosAuthenticationServiceException {
try{
CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
- AuthzToken managementServiceAccountAuthzToken = securityManager.getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
+ AuthzToken managementServiceAccountAuthzToken = securityManager.getUserManagementServiceAccountAuthzToken(authzToken, gatewayId, clientId, clientSecret);
return managementServiceAccountAuthzToken;
}catch (CustosSecurityException e){
logger.error(e.getMessage(), e);
diff --git a/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java b/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
index 34aa7f9..054a5c1 100644
--- a/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
+++ b/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
@@ -2,7 +2,6 @@ package org.apache.custos.client.authentication.service;
import org.apache.custos.authentication.cpi.CustosAuthenticationService;
import org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException;
-import org.apache.custos.commons.model.error.AuthenticationException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TMultiplexedProtocol;
import org.apache.thrift.protocol.TProtocol;
@@ -11,6 +10,7 @@ import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
public class AuthenticationServiceClient {
+
public static CustosAuthenticationService.Client createAuthenticationServiceClient(String serverHost, int serverPort) throws CustosAuthenticationServiceException {
try {
TTransport transport = new TSocket(serverHost, serverPort);
diff --git a/custos-client/src/main/java/org/apache/custos/client/profile/service/CustosProfileServiceClientFactory.java b/custos-client/src/main/java/org/apache/custos/client/profile/service/CustosProfileServiceClientFactory.java
deleted file mode 100644
index 593be32..0000000
--- a/custos-client/src/main/java/org/apache/custos/client/profile/service/CustosProfileServiceClientFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- *
- * 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.client.profile.service;
-
-import org.apache.custos.profile.iam.admin.services.cpi.IamAdminServices;
-import org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
-import org.apache.custos.profile.iam.admin.services.cpi.iam_admin_services_cpiConstants;
-import org.apache.custos.profile.tenant.cpi.TenantProfileService;
-import org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException;
-import org.apache.custos.profile.tenant.cpi.profile_tenant_cpiConstants;
-import org.apache.custos.profile.user.cpi.UserProfileService;
-import org.apache.custos.profile.user.cpi.exception.UserProfileServiceException;
-import org.apache.custos.profile.user.cpi.profile_user_cpiConstants;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TMultiplexedProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportException;
-
-/**
- * Created by goshenoy on 03/08/2017.
- */
-public class CustosProfileServiceClientFactory {
- public static UserProfileService.Client createCustosUserProfileServiceClient(String serverHost, int serverPort) throws UserProfileServiceException {
- try {
- TTransport transport = new TSocket(serverHost, serverPort);
- transport.open();
- TProtocol protocol = new TBinaryProtocol(transport);
- TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, profile_user_cpiConstants.USER_PROFILE_CPI_NAME);
- return new UserProfileService.Client(multiplexedProtocol);
- } catch (TTransportException e) {
- throw new UserProfileServiceException(e.getMessage());
- }
- }
-
- public static TenantProfileService.Client createCustosTenantProfileServiceClient(String serverHost, int serverPort) throws TenantProfileServiceException {
- try {
- TTransport transport = new TSocket(serverHost, serverPort);
- transport.open();
- TProtocol protocol = new TBinaryProtocol(transport);
- TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, profile_tenant_cpiConstants.TENANT_PROFILE_CPI_NAME);
- return new TenantProfileService.Client(multiplexedProtocol);
- } catch (TTransportException e) {
- throw new TenantProfileServiceException(e.getMessage());
- }
- }
-
- public static IamAdminServices.Client createCustosIamAdminServiceClient(String serverHost, int serverPort) throws IamAdminServicesException {
- try {
- TTransport transport = new TSocket(serverHost, serverPort);
- transport.open();
- TProtocol protocol = new TBinaryProtocol(transport);
- TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, iam_admin_services_cpiConstants.IAM_ADMIN_SERVICES_CPI_NAME);
- return new IamAdminServices.Client(multiplexedProtocol);
- } catch (TTransportException e) {
- throw new IamAdminServicesException(e.getMessage());
- }
- }
-
-// public static GroupManagerService.Client createGroupManagerServiceClient(String serverHost, int serverPort) throws GroupManagerServiceException {
-// try {
-// TTransport transport = new TSocket(serverHost, serverPort);
-// transport.open();
-// TProtocol protocol = new TBinaryProtocol(transport);
-// TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, group_manager_cpiConstants.GROUP_MANAGER_CPI_NAME);
-// return new GroupManagerService.Client(multiplexedProtocol);
-// } catch (TTransportException e) {
-// throw new GroupManagerServiceException(e.getMessage());
-// }
-// }
-}
\ No newline at end of file
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/model/error/AuthenticationException.java b/custos-commons/src/main/java/org/apache/custos/commons/model/error/AuthenticationException.java
deleted file mode 100644
index 07ca704..0000000
--- a/custos-commons/src/main/java/org/apache/custos/commons/model/error/AuthenticationException.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * Autogenerated by Thrift Compiler (0.10.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.custos.commons.model.error;
-
-@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-/**
- * This exception is thrown for invalid sshKeyAuthentication requests.
- *
- * message: contains the cause of the authorization failure.
- */
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)")
-public class AuthenticationException extends org.apache.thrift.TException implements org.apache.thrift.TBase<AuthenticationException, AuthenticationException._Fields>, java.io.Serializable, Cloneable, Comparable<AuthenticationException> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthenticationException");
-
- private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
-
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new AuthenticationExceptionStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new AuthenticationExceptionTupleSchemeFactory();
-
- private String message; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- MESSAGE((short)1, "message");
-
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
-
- static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // MESSAGE
- return MESSAGE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthenticationException.class, metaDataMap);
- }
-
- public AuthenticationException() {
- }
-
- public AuthenticationException(
- String message)
- {
- this();
- this.message = message;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public AuthenticationException(AuthenticationException other) {
- if (other.isSetMessage()) {
- this.message = other.message;
- }
- }
-
- public AuthenticationException deepCopy() {
- return new AuthenticationException(this);
- }
-
- @Override
- public void clear() {
- this.message = null;
- }
-
- public String getMessage() {
- return this.message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public void unsetMessage() {
- this.message = null;
- }
-
- /** Returns true if field message is set (has been assigned a value) and false otherwise */
- public boolean isSetMessage() {
- return this.message != null;
- }
-
- public void setMessageIsSet(boolean value) {
- if (!value) {
- this.message = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case MESSAGE:
- if (value == null) {
- unsetMessage();
- } else {
- setMessage((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case MESSAGE:
- return getMessage();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case MESSAGE:
- return isSetMessage();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof AuthenticationException)
- return this.equals((AuthenticationException)that);
- return false;
- }
-
- public boolean equals(AuthenticationException that) {
- if (that == null)
- return false;
- if (this == that)
- return true;
-
- boolean this_present_message = true && this.isSetMessage();
- boolean that_present_message = true && that.isSetMessage();
- if (this_present_message || that_present_message) {
- if (!(this_present_message && that_present_message))
- return false;
- if (!this.message.equals(that.message))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 1;
-
- hashCode = hashCode * 8191 + ((isSetMessage()) ? 131071 : 524287);
- if (isSetMessage())
- hashCode = hashCode * 8191 + message.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(AuthenticationException other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetMessage()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- scheme(oprot).write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("AuthenticationException(");
- boolean first = true;
-
- sb.append("message:");
- if (this.message == null) {
- sb.append("null");
- } else {
- sb.append(this.message);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetMessage()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class AuthenticationExceptionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public AuthenticationExceptionStandardScheme getScheme() {
- return new AuthenticationExceptionStandardScheme();
- }
- }
-
- private static class AuthenticationExceptionStandardScheme extends org.apache.thrift.scheme.StandardScheme<AuthenticationException> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, AuthenticationException struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // MESSAGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.message = iprot.readString();
- struct.setMessageIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, AuthenticationException struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.message != null) {
- oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
- oprot.writeString(struct.message);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class AuthenticationExceptionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public AuthenticationExceptionTupleScheme getScheme() {
- return new AuthenticationExceptionTupleScheme();
- }
- }
-
- private static class AuthenticationExceptionTupleScheme extends org.apache.thrift.scheme.TupleScheme<AuthenticationException> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- oprot.writeString(struct.message);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, AuthenticationException struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- struct.message = iprot.readString();
- struct.setMessageIsSet(true);
- }
- }
-
- private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
- return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
- }
-}
-
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/model/error/AuthorizationException.java b/custos-commons/src/main/java/org/apache/custos/commons/model/error/AuthorizationException.java
deleted file mode 100644
index dc84307..0000000
--- a/custos-commons/src/main/java/org/apache/custos/commons/model/error/AuthorizationException.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * Autogenerated by Thrift Compiler (0.10.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- * @generated
- */
-package org.apache.custos.commons.model.error;
-
-@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-/**
- * This exception is thrown for invalid authorization requests such user does not have acces to an aplication or resource.
- *
- * message: contains the authorization failure message
- */
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)")
-public class AuthorizationException extends org.apache.thrift.TException implements org.apache.thrift.TBase<AuthorizationException, AuthorizationException._Fields>, java.io.Serializable, Cloneable, Comparable<AuthorizationException> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AuthorizationException");
-
- private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
-
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new AuthorizationExceptionStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new AuthorizationExceptionTupleSchemeFactory();
-
- private String message; // required
-
- /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
- public enum _Fields implements org.apache.thrift.TFieldIdEnum {
- MESSAGE((short)1, "message");
-
- private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
-
- static {
- for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
- byName.put(field.getFieldName(), field);
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, or null if its not found.
- */
- public static _Fields findByThriftId(int fieldId) {
- switch(fieldId) {
- case 1: // MESSAGE
- return MESSAGE;
- default:
- return null;
- }
- }
-
- /**
- * Find the _Fields constant that matches fieldId, throwing an exception
- * if it is not found.
- */
- public static _Fields findByThriftIdOrThrow(int fieldId) {
- _Fields fields = findByThriftId(fieldId);
- if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
- return fields;
- }
-
- /**
- * Find the _Fields constant that matches name, or null if its not found.
- */
- public static _Fields findByName(String name) {
- return byName.get(name);
- }
-
- private final short _thriftId;
- private final String _fieldName;
-
- _Fields(short thriftId, String fieldName) {
- _thriftId = thriftId;
- _fieldName = fieldName;
- }
-
- public short getThriftFieldId() {
- return _thriftId;
- }
-
- public String getFieldName() {
- return _fieldName;
- }
- }
-
- // isset id assignments
- public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
- static {
- java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
- tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED,
- new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
- metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AuthorizationException.class, metaDataMap);
- }
-
- public AuthorizationException() {
- }
-
- public AuthorizationException(
- String message)
- {
- this();
- this.message = message;
- }
-
- /**
- * Performs a deep copy on <i>other</i>.
- */
- public AuthorizationException(AuthorizationException other) {
- if (other.isSetMessage()) {
- this.message = other.message;
- }
- }
-
- public AuthorizationException deepCopy() {
- return new AuthorizationException(this);
- }
-
- @Override
- public void clear() {
- this.message = null;
- }
-
- public String getMessage() {
- return this.message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public void unsetMessage() {
- this.message = null;
- }
-
- /** Returns true if field message is set (has been assigned a value) and false otherwise */
- public boolean isSetMessage() {
- return this.message != null;
- }
-
- public void setMessageIsSet(boolean value) {
- if (!value) {
- this.message = null;
- }
- }
-
- public void setFieldValue(_Fields field, Object value) {
- switch (field) {
- case MESSAGE:
- if (value == null) {
- unsetMessage();
- } else {
- setMessage((String)value);
- }
- break;
-
- }
- }
-
- public Object getFieldValue(_Fields field) {
- switch (field) {
- case MESSAGE:
- return getMessage();
-
- }
- throw new IllegalStateException();
- }
-
- /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
- public boolean isSet(_Fields field) {
- if (field == null) {
- throw new IllegalArgumentException();
- }
-
- switch (field) {
- case MESSAGE:
- return isSetMessage();
- }
- throw new IllegalStateException();
- }
-
- @Override
- public boolean equals(Object that) {
- if (that == null)
- return false;
- if (that instanceof AuthorizationException)
- return this.equals((AuthorizationException)that);
- return false;
- }
-
- public boolean equals(AuthorizationException that) {
- if (that == null)
- return false;
- if (this == that)
- return true;
-
- boolean this_present_message = true && this.isSetMessage();
- boolean that_present_message = true && that.isSetMessage();
- if (this_present_message || that_present_message) {
- if (!(this_present_message && that_present_message))
- return false;
- if (!this.message.equals(that.message))
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int hashCode = 1;
-
- hashCode = hashCode * 8191 + ((isSetMessage()) ? 131071 : 524287);
- if (isSetMessage())
- hashCode = hashCode * 8191 + message.hashCode();
-
- return hashCode;
- }
-
- @Override
- public int compareTo(AuthorizationException other) {
- if (!getClass().equals(other.getClass())) {
- return getClass().getName().compareTo(other.getClass().getName());
- }
-
- int lastComparison = 0;
-
- lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
- if (lastComparison != 0) {
- return lastComparison;
- }
- if (isSetMessage()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
- if (lastComparison != 0) {
- return lastComparison;
- }
- }
- return 0;
- }
-
- public _Fields fieldForId(int fieldId) {
- return _Fields.findByThriftId(fieldId);
- }
-
- public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
- scheme(iprot).read(iprot, this);
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
- scheme(oprot).write(oprot, this);
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("AuthorizationException(");
- boolean first = true;
-
- sb.append("message:");
- if (this.message == null) {
- sb.append("null");
- } else {
- sb.append(this.message);
- }
- first = false;
- sb.append(")");
- return sb.toString();
- }
-
- public void validate() throws org.apache.thrift.TException {
- // check for required fields
- if (!isSetMessage()) {
- throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' is unset! Struct:" + toString());
- }
-
- // check for sub-struct validity
- }
-
- private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
- try {
- write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- try {
- read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
- } catch (org.apache.thrift.TException te) {
- throw new java.io.IOException(te);
- }
- }
-
- private static class AuthorizationExceptionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public AuthorizationExceptionStandardScheme getScheme() {
- return new AuthorizationExceptionStandardScheme();
- }
- }
-
- private static class AuthorizationExceptionStandardScheme extends org.apache.thrift.scheme.StandardScheme<AuthorizationException> {
-
- public void read(org.apache.thrift.protocol.TProtocol iprot, AuthorizationException struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TField schemeField;
- iprot.readStructBegin();
- while (true)
- {
- schemeField = iprot.readFieldBegin();
- if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
- break;
- }
- switch (schemeField.id) {
- case 1: // MESSAGE
- if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
- struct.message = iprot.readString();
- struct.setMessageIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
- default:
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- iprot.readFieldEnd();
- }
- iprot.readStructEnd();
- struct.validate();
- }
-
- public void write(org.apache.thrift.protocol.TProtocol oprot, AuthorizationException struct) throws org.apache.thrift.TException {
- struct.validate();
-
- oprot.writeStructBegin(STRUCT_DESC);
- if (struct.message != null) {
- oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
- oprot.writeString(struct.message);
- oprot.writeFieldEnd();
- }
- oprot.writeFieldStop();
- oprot.writeStructEnd();
- }
-
- }
-
- private static class AuthorizationExceptionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public AuthorizationExceptionTupleScheme getScheme() {
- return new AuthorizationExceptionTupleScheme();
- }
- }
-
- private static class AuthorizationExceptionTupleScheme extends org.apache.thrift.scheme.TupleScheme<AuthorizationException> {
-
- @Override
- public void write(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- oprot.writeString(struct.message);
- }
-
- @Override
- public void read(org.apache.thrift.protocol.TProtocol prot, AuthorizationException struct) throws org.apache.thrift.TException {
- org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
- struct.message = iprot.readString();
- struct.setMessageIsSet(true);
- }
- }
-
- private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
- return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
- }
-}
-
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/ApplicationSettings.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/ApplicationSettings.java
index 9c28e25..2233478 100644
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/ApplicationSettings.java
+++ b/custos-commons/src/main/java/org/apache/custos/commons/utils/ApplicationSettings.java
@@ -23,18 +23,6 @@ public class ApplicationSettings {
protected static final String TRUST_STORE_PASSWORD="trust.store.password";
private final static Logger logger = LoggerFactory.getLogger(ApplicationSettings.class);
protected Properties properties = new Properties();
- // Profile Service Constants
- public static final String PROFILE_SERVICE_SERVER_HOST = "profile.service.server.host";
- public static final String PROFILE_SERVICE_SERVER_PORT = "profile.service.server.port";
-
- // Iam Server Constants
- public static final String IAM_SERVER_URL = "iam.server.url";
- public static final String IAM_SERVER_SUPER_ADMIN_USERNAME = "iam.server.super.admin.username";
- public static final String IAM_SERVER_SUPER_ADMIN_PASSWORD = "iam.server.super.admin.password";
-
- //User Profile constant
- public static final String USER_PROFILE_SERVER_HOST = "user.profile.server.host";
- public static final String USER_PROFILE_SERVER_PORT = "user.profile.server.port";
// Authentication service constants
public static final String AUTHENTICATION_SERVICE_SERVER_PORT = "custos.authentication.server.port";
@@ -180,14 +168,4 @@ public class ApplicationSettings {
public static String getTrustStorePassword() throws ApplicationSettingsException {
return getSetting(TRUST_STORE_PASSWORD);
}
- public static String getIamServerUrl() throws ApplicationSettingsException {
- return getSetting(ServerSettings.IAM_SERVER_URL);
- }
- public static String getProfileServiceServerHost() throws ApplicationSettingsException {
- return getSetting(ServerSettings.PROFILE_SERVICE_SERVER_HOST);
- }
-
- public static String getProfileServiceServerPort() throws ApplicationSettingsException {
- return getSetting(ServerSettings.PROFILE_SERVICE_SERVER_PORT);
- }
}
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/Constants.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/Constants.java
index 1325f46..306c6be 100644
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/Constants.java
+++ b/custos-commons/src/main/java/org/apache/custos/commons/utils/Constants.java
@@ -25,16 +25,12 @@ package org.apache.custos.commons.utils;
public final class Constants {
public static final String IN_MEMORY_CACHE_SIZE = "in.memory.cache.size";
public static final String AUTHZ_CACHE_MANAGER_CLASS = "authz.cache.manager.class";
- public static final String API_METHOD_NAME = "api.method.name";
- public static final String IS_API_SECURED = "api.secured";
- public static final String AUTHORIZATION_POLICY_NAME = "authorization.policy";
public static final String SECURITY_MANAGER_CLASS = "security.manager.class";
public static final String AUTHZ_CACHE_ENABLED = "authz.cache.enabled";
//Names of the attributes that could be passed in the AuthzToken's claims map.
public static final String USER_NAME = "userName";
public static final String GATEWAY_ID = "gatewayID";
- public static final String IDENTITY_SERVER_TENANT = "identityServerTenant";
//constants in XACML authorization response.
public static final String PERMIT = "Permit";
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/DBInitConfig.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/DBInitConfig.java
deleted file mode 100644
index 123541a..0000000
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/DBInitConfig.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.commons.utils;
-
-public interface DBInitConfig {
- JDBCConfig getJDBCConfig();
-
- String getDBInitScriptPrefix();
-
- String getCheckTableName();
-
- default void postInit() {
-
- }
-}
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/DBInitializer.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/DBInitializer.java
deleted file mode 100644
index 6e2038c..0000000
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/DBInitializer.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.commons.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.Connection;
-
-public class DBInitializer {
- private static final Logger logger = LoggerFactory.getLogger(DBInitializer.class);
-
- private JDBCConfig jdbcConfig;
- private String initScriptPrefix;
- private String checkTableName;
-
- public DBInitializer(JDBCConfig jdbcConfig, String initScriptPrefix, String checkTableName) {
- this.jdbcConfig = jdbcConfig;
- this.initScriptPrefix = initScriptPrefix;
- this.checkTableName = checkTableName;
- }
-
- public static void initializeDB(DBInitConfig dbInitConfig) {
-
- JDBCConfig jdbcConfig = dbInitConfig.getJDBCConfig();
- DBInitializer dbInitializer = new DBInitializer(jdbcConfig, dbInitConfig.getDBInitScriptPrefix(), dbInitConfig.getCheckTableName());
- dbInitializer.initializeDB();
- dbInitConfig.postInit();
- }
-
- public void initializeDB() {
- // Create connection
- Connection conn = null;
- try {
- DBUtil dbUtil = new DBUtil(jdbcConfig);
- conn = dbUtil.getConnection();
- if (!DatabaseCreator.isDatabaseStructureCreated(checkTableName, conn)) {
- DatabaseCreator.createRegistryDatabase(initScriptPrefix, conn);
- logger.info("New Database created from " + initScriptPrefix + " !!!");
- } else {
- logger.info("Table " + checkTableName + " already exists. Skipping database init script " + initScriptPrefix);
- }
-
- } catch (Exception e) {
- throw new RuntimeException("Failed to initialize database for " + initScriptPrefix, e);
- } finally {
- if (conn != null) {
- DBUtil.cleanup(conn);
- }
- }
-
- }
-}
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/DBUtil.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/DBUtil.java
deleted file mode 100644
index bfac5d7..0000000
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/DBUtil.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/**
- *
- * 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.commons.utils;
-
-import org.apache.commons.dbcp.BasicDataSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.sql.DataSource;
-import java.sql.*;
-import java.util.Properties;
-
-/**
- * Database lookup. Abstracts out JDBC operations.
- */
-public class DBUtil {
-
- private String jdbcUrl;
- private String databaseUserName;
- private String databasePassword;
- private String driverName;
-
- protected static Logger log = LoggerFactory.getLogger(DBUtil.class);
-
- private Properties properties;
-
- public DBUtil(String jdbcUrl, String userName, String password, String driver) throws InstantiationException,
- IllegalAccessException, ClassNotFoundException {
-
- this.jdbcUrl = jdbcUrl;
- this.databaseUserName = userName;
- this.databasePassword = password;
- this.driverName = driver;
-
- init();
- }
-
- public DBUtil(JDBCConfig jdbcConfig) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
- this(jdbcConfig.getURL(), jdbcConfig.getUser(), jdbcConfig.getPassword(), jdbcConfig.getDriver());
- }
-
- /**
- * Initializes and load driver. Must be called this before calling anyother method.
- *
- * @throws ClassNotFoundException
- * If DB driver is not found.
- * @throws InstantiationException
- * If unable to create driver class.
- * @throws IllegalAccessException
- * If security does not allow users to instantiate driver object.
- */
- private void init() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
- properties = new Properties();
-
- properties.put("user", databaseUserName);
- properties.put("password", databasePassword);
- properties.put("characterEncoding", "ISO-8859-1");
- properties.put("useUnicode", "true");
-
- loadDriver();
- }
-
- /**
- * Generic method to query values in the database.
- *
- * @param tableName
- * Table name to query
- * @param selectColumn
- * The column selecting
- * @param whereValue
- * The condition query
- * @return The value appropriate to the query.
- * @throws SQLException
- * If an error occurred while querying
- */
- public String getMatchingColumnValue(String tableName, String selectColumn, String whereValue) throws SQLException {
- return getMatchingColumnValue(tableName, selectColumn, selectColumn, whereValue);
- }
-
- /**
- * Generic method to query values in the database.
- *
- * @param tableName
- * Table name to query
- * @param selectColumn
- * The column selecting
- * @param whereColumn
- * The column which condition should apply
- * @param whereValue
- * The condition query
- * @return The value appropriate to the query.
- * @throws SQLException
- * If an error occurred while querying
- */
- public String getMatchingColumnValue(String tableName, String selectColumn, String whereColumn, String whereValue)
- throws SQLException {
-
- StringBuilder stringBuilder = new StringBuilder();
-
- stringBuilder.append("SELECT ").append(selectColumn).append(" FROM ").append(tableName).append(" WHERE ")
- .append(whereColumn).append(" = ?");
-
- String sql = stringBuilder.toString();
-
- Connection connection = getConnection();
-
- PreparedStatement ps = connection.prepareStatement(sql);
- ResultSet rs = null;
-
- try {
- ps.setString(1, whereValue);
- rs = ps.executeQuery();
-
- if (rs.next()) {
- return rs.getString(1);
- }
-
- } finally {
- try {
- if (rs != null) {
- rs.close();
- }
-
- ps.close();
- connection.close();
-
- } catch (Exception ignore) {
- log.error("An error occurred while closing database connections ", ignore);
- }
- }
-
- return null;
- }
-
- /**
- * Create table utility method.
- *
- * @param sql
- * SQL to be executed.
- * @throws SQLException
- * If an error occurred while creating the table.
- */
- public void executeSQL(String sql) throws SQLException {
-
- Connection connection = getConnection();
-
- PreparedStatement ps = connection.prepareStatement(sql);
-
- try {
- ps.executeUpdate();
- connection.commit();
- } finally {
- try {
- if (ps != null) {
- ps.close();
- }
-
- connection.close();
-
- } catch (Exception ignore) {
- log.error("An error occurred while closing database connections ", ignore);
- }
- }
-
- }
-
- private void loadDriver() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
- Class.forName(driverName).newInstance();
- }
-
- /**
- * Gets a new DBCP data source.
- *
- * @return A new data source.
- */
- public DataSource getDataSource() {
- BasicDataSource ds = new BasicDataSource();
- ds.setDriverClassName(this.driverName);
- ds.setUsername(this.databaseUserName);
- ds.setPassword(this.databasePassword);
- ds.setUrl(this.jdbcUrl);
-
- return ds;
- }
-
- /**
- * Creates a new JDBC connections based on provided DBCP properties.
- *
- * @return A new DB connection.
- * @throws SQLException
- * If an error occurred while creating the connection.
- */
- public Connection getConnection() throws SQLException {
- Connection connection = DriverManager.getConnection(jdbcUrl, properties);
- connection.setAutoCommit(false);
- return connection;
- }
-
- /**
- * Utility method to close statements and connections.
- *
- * @param preparedStatement
- * The prepared statement to close.
- * @param connection
- * The connection to close.
- */
- public static void cleanup(PreparedStatement preparedStatement, Connection connection) {
- if (preparedStatement != null) {
- try {
- preparedStatement.close();
- } catch (SQLException e) {
- log.error("Error closing prepared statement.", e);
- }
- }
- cleanup(connection);
- }
-
- /**
- * Utility method to close statements and connections.
- *
- * @param preparedStatement
- * The prepared statement to close.
- */
- public static void cleanup(PreparedStatement preparedStatement) {
- if (preparedStatement != null) {
- try {
- preparedStatement.close();
- } catch (SQLException e) {
- log.error("Error closing prepared statement.", e);
- }
- }
- }
-
- /**
- * Utility method to close statements and connections.
- *
- * @param preparedStatement
- * The prepared statement to close.
- */
- public static void cleanup(PreparedStatement preparedStatement, ResultSet resultSet) {
- if (resultSet != null) {
- try {
- resultSet.close();
- } catch (SQLException e) {
- log.error("Error closing prepared statement.", e);
- }
- }
-
- cleanup(preparedStatement);
- }
-
- /**
- * Cleanup the connection.
- * @param connection The connection to close.
- */
- public static void cleanup(Connection connection) {
- if (connection != null) {
- try {
- if (connection.isClosed()) {
- return;
- }
- if (!connection.getAutoCommit()) {
- connection.rollback();
- }
- connection.close();
- } catch (SQLException e) {
- throw new RuntimeException("Error closing connection", e);
- }
- }
- }
-
- /**
- * Mainly useful for tests.
- *
- * @param tableName
- * The table name.
- * @param connection
- * The connection to be used.
- */
- public static void truncate(String tableName, Connection connection) throws SQLException {
-
- String sql = "delete from " + tableName;
-
- PreparedStatement preparedStatement = connection.prepareStatement(sql);
- preparedStatement.executeUpdate();
-
- connection.commit();
-
- }
-}
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/DatabaseCreator.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/DatabaseCreator.java
deleted file mode 100644
index 539ccf4..0000000
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/DatabaseCreator.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * 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.commons.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.sql.*;
-import java.util.StringTokenizer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * This class creates the database tables required for custos with default configuration this
- * class creates derby database in server mode. User can specify required database in appropriate
- * properties files.
- */
-public class DatabaseCreator {
- private final static Logger logger = LoggerFactory.getLogger(DatabaseCreator.class);
-
- public enum DatabaseType {
- derby("(?i).*derby.*"), mysql("(?i).*(mysql|mariadb).*"), other("");
-
- private String pattern;
-
- private DatabaseType(String matchingPattern) {
- this.pattern = matchingPattern;
- }
-
- public String getMatchingPattern() {
- return this.pattern;
- }
- }
-
- private static DatabaseType[] supportedDatabase = new DatabaseType[] { DatabaseType.derby, DatabaseType.mysql };
-
- private static Logger log = LoggerFactory.getLogger(DatabaseCreator.class);
- private static final String delimiter = ";";
-
- /**
- * Creates database
- *
- * @throws Exception
- */
- public static void createRegistryDatabase(String prefix, Connection conn) throws Exception {
- createDatabase(prefix, conn);
- }
-
-
-
- /**
- * Checks whether database tables are created by using select * on given table name
- *
- * @param tableName
- * Table which should be existed
- * @return <code>true</core> if checkSQL is success, else <code>false</code> .
- */
- public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
- try {
-
- log.debug("Running a query to test the database tables existence.");
-
- // check whether the tables are already created with a query
- Statement statement = null;
- try {
- statement = conn.createStatement();
- ResultSet rs = statement.executeQuery("select * from " + tableName);
- if (rs != null) {
- rs.close();
- }
- } finally {
- try {
- if (statement != null) {
- statement.close();
- }
- } catch (SQLException e) {
- return false;
- }
- }
- } catch (SQLException e) {
- return false;
- }
-
- return true;
- }
-
- /**
- * executes given sql
- *
- * @param sql
- * @throws Exception
- */
- private static void executeSQL(String sql, Connection conn) throws Exception {
- // Check and ignore empty statements
- if ("".equals(sql.trim())) {
- return;
- }
-
- Statement statement = null;
- try {
- log.debug("SQL : " + sql);
-
- boolean ret;
- int updateCount = 0, updateCountTotal = 0;
- statement = conn.createStatement();
- ret = statement.execute(sql);
- updateCount = statement.getUpdateCount();
- do {
- if (!ret) {
- if (updateCount != -1) {
- updateCountTotal += updateCount;
- }
- }
- ret = statement.getMoreResults();
- if (ret) {
- updateCount = statement.getUpdateCount();
- }
- } while (ret);
-
- log.debug(sql + " : " + updateCountTotal + " rows affected");
-
- SQLWarning warning = conn.getWarnings();
- while (warning != null) {
- log.info(warning + " sql warning");
- warning = warning.getNextWarning();
- }
- conn.clearWarnings();
- } catch (SQLException e) {
- if (e.getSQLState().equals("X0Y32")) {
- // eliminating the table already exception for the derby
- // database
- log.info("Table Already Exists", e);
- } else {
- throw new Exception("Error occurred while executing : " + sql, e);
- }
- } finally {
- if (statement != null) {
- try {
- statement.close();
- } catch (SQLException e) {
- log.error("Error occurred while closing result set.", e);
- }
- }
- }
- }
-
- /**
- * computes relatational database type using database name
- *
- * @return DatabaseType
- * @throws Exception
- *
- */
- public static DatabaseType getDatabaseType(Connection conn) throws Exception {
- try {
- if (conn != null && (!conn.isClosed())) {
- DatabaseMetaData metaData = conn.getMetaData();
- String databaseProductName = metaData.getDatabaseProductName();
- return checkType(databaseProductName);
- }
- } catch (SQLException e) {
- String msg = "Failed to create Airavata database." + e.getMessage();
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- return DatabaseType.other;
- }
-
- /**
- * Overloaded method with String input
- *
- * @return DatabaseType
- * @throws Exception
- *
- */
- public static DatabaseType getDatabaseType(String dbUrl) throws Exception {
- return checkType(dbUrl);
- }
-
- private static DatabaseType checkType(String text) throws Exception {
- try {
- if (text != null) {
- for (DatabaseType type : supportedDatabase) {
- if (text.matches(type.getMatchingPattern()))
- return type;
- }
- }
- String msg = "Unsupported database: " + text
- + ". Database will not be created automatically by the custos. "
- + "Please create the database using appropriate database scripts for " + "the database.";
- throw new Exception(msg);
-
- } catch (SQLException e) {
- String msg = "Failed to create custosdatabase." + e.getMessage();
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- }
-
- /**
- * Get scripts location which is prefix + "-" + databaseType + ".sql"
- *
- * @param prefix
- * @param databaseType
- * @return script location
- */
- private static String getScriptLocation(String prefix, DatabaseType databaseType) {
- String scriptName = prefix + "-" + databaseType + ".sql";
- log.debug("Loading database script from :" + scriptName);
- return scriptName;
- }
-
- private static void createDatabase(String prefix, Connection conn) throws Exception {
- Statement statement = null;
- try {
- conn.setAutoCommit(false);
- statement = conn.createStatement();
- executeSQLScript(getScriptLocation(prefix, DatabaseCreator.getDatabaseType(conn)), conn);
- conn.commit();
- log.debug("Tables are created successfully.");
- } catch (SQLException e) {
- String msg = "Failed to create database tables for custos resource store. " + e.getMessage();
- log.error(msg, e);
- conn.rollback();
- throw new Exception(msg, e);
- } finally {
- conn.setAutoCommit(true);
- try {
- if (statement != null) {
- statement.close();
- }
- } catch (SQLException e) {
- log.error("Failed to close statement.", e);
- }
- }
- }
-
- private static void executeSQLScript(String dbscriptName, Connection conn) throws Exception {
- StringBuffer sql = new StringBuffer();
- BufferedReader reader = null;
-
- try {
- InputStream is = DatabaseCreator.class.getClassLoader().getResourceAsStream(dbscriptName);
- if(is == null) {
- logger.info("Script file not found at " + dbscriptName + ". Uses default database script file");
- DatabaseType databaseType = DatabaseCreator.getDatabaseType(conn);
- is = DatabaseCreator.class.getClassLoader().getResourceAsStream(
- getDBScriptFileName(databaseType, dbscriptName)
- );
- }
- reader = new BufferedReader(new InputStreamReader(is));
- String line;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.startsWith("//")) {
- continue;
- }
- if (line.startsWith("--")) {
- continue;
- }
- StringTokenizer st = new StringTokenizer(line);
- if (st.hasMoreTokens()) {
- String token = st.nextToken();
- if ("REM".equalsIgnoreCase(token)) {
- continue;
- }
- }
- sql.append(" ").append(line);
-
- // SQL defines "--" as a comment to EOL
- // and in Oracle it may contain a hint
- // so we cannot just remove it, instead we must end it
- if (line.indexOf("--") >= 0) {
- sql.append("\n");
- }
- if ((checkStringBufferEndsWith(sql, delimiter))) {
- executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
- sql.replace(0, sql.length(), "");
- }
- }
- // Catch any statements not followed by ;
- if (sql.length() > 0) {
- executeSQL(sql.toString(), conn);
- }
- } catch (IOException e) {
- log.error("Error occurred while executing SQL script for creating custos database", e);
- throw new Exception("Error occurred while executing SQL script for creating custos database", e);
-
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-
- /**
- * Checks that a string buffer ends up with a given string. It may sound trivial with the existing JDK API but the
- * various implementation among JDKs can make those methods extremely resource intensive and perform poorly due to
- * massive memory allocation and copying. See
- *
- * @param buffer
- * the buffer to perform the check on
- * @param suffix
- * the suffix
- * @return <code>true</code> if the character sequence represented by the argument is a suffix of the character
- * sequence represented by the StringBuffer object; <code>false</code> otherwise. Note that the result will
- * be <code>true</code> if the argument is the empty string.
- */
- public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
- if (suffix.length() > buffer.length()) {
- return false;
- }
- // this loop is done on purpose to avoid memory allocation performance
- // problems on various JDKs
- // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
- // implementation is ok though does allocation/copying
- // StringBuffer.toString().endsWith() does massive memory
- // allocation/copying on JDK 1.5
- // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
- int endIndex = suffix.length() - 1;
- int bufferIndex = buffer.length() - 1;
- while (endIndex >= 0) {
- if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
- return false;
- }
- bufferIndex--;
- endIndex--;
- }
- return true;
- }
-
- /**
- * Method will accept a filepath containing a database script (eg: /user/database_scripts/expcatalog.sql)
- * and return only the filename of the database script (eg: expcatalog.sql).
- * @param databaseType
- * @param scriptFilePath
- * @return
- */
- private static String getDBScriptFileName(DatabaseType databaseType, String scriptFilePath) {
- // pattern: {dir_name}/{scriptfile_name}-{dbtype}.sql".
- // Eg: database_scripts/expcatalog-derby.sql
- final String scriptFilePattern = "(\\w*)(-" + databaseType.toString() + ".sql)";
- final Pattern pattern = Pattern.compile(scriptFilePattern);
- final Matcher matcher = pattern.matcher(scriptFilePath);
- String dbScriptFileName = null;
- // find a match
- if (matcher.find()) {
- dbScriptFileName = matcher.group();
- }
- return dbScriptFileName;
- }
-
-// public static void main(String[] args) throws Exception {
-// System.out.println(DatabaseCreator.getDBScriptFileName(DatabaseType.derby, "db/db/expcatalog-derby.sql"));
-// System.out.println(DatabaseCreator.getDBScriptFileName(DatabaseType.mysql, "/expcatalog-mysql.sql"));
-// }
-}
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/JDBCConfig.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/JDBCConfig.java
deleted file mode 100644
index 5cdb0ec..0000000
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/JDBCConfig.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.commons.utils;
-
-public interface JDBCConfig {
- String getURL();
- String getDriver();
- String getUser();
- String getPassword();
- String getValidationQuery();
-}
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/JPAUtils.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/JPAUtils.java
deleted file mode 100644
index 9e02ce7..0000000
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/JPAUtils.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.apache.custos.commons.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * JPAUtils
- */
-public class JPAUtils {
-
- private final static Logger logger = LoggerFactory.getLogger(JPAUtils.class);
- private final static Map<String, String> DEFAULT_ENTITY_MANAGER_FACTORY_PROPERTIES;
- static {
- Map<String, String> properties = new HashMap<String, String>();
- properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
- properties.put("openjpa.DynamicEnhancementAgent", "true");
- properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
- properties.put("openjpa.RemoteCommitProvider", "sjvm");
- properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
- properties.put("openjpa.jdbc.SynchronizeMappings", "validate");
- properties.put("openjpa.jdbc.QuerySQLCache", "false");
- properties.put("openjpa.DetachState", "all");
- properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72,"
- + " PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000, autoReconnect=true");
- DEFAULT_ENTITY_MANAGER_FACTORY_PROPERTIES = properties;
- }
-
- /**
- * Create an {@link EntityManagerFactory} with the default settings.
- * @param persistenceUnitName
- * @param jdbcConfig
- * @return {@link EntityManagerFactory}
- */
- public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, JDBCConfig jdbcConfig){
-
- return getEntityManagerFactory(persistenceUnitName, jdbcConfig, Collections.emptyMap());
- }
-
- /**
- * Create an {@link EntityManagerFactory}. The given properties will override the default properties.
- * @param persistenceUnitName
- * @param jdbcConfig
- * @param properties
- * @return {@link EntityManagerFactory}
- */
- public static EntityManagerFactory getEntityManagerFactory(String persistenceUnitName, JDBCConfig jdbcConfig, Map<String, String> properties) {
-
- Map<String, String> finalProperties = new HashMap<>(DEFAULT_ENTITY_MANAGER_FACTORY_PROPERTIES);
- finalProperties.putAll(createConnectionProperties(jdbcConfig));
- finalProperties.putAll(properties);
- return Persistence.createEntityManagerFactory(persistenceUnitName, finalProperties);
- }
-
- private static Map<String, String> createConnectionProperties(JDBCConfig jdbcConfig) {
- String connectionProperties = "DriverClassName=" + jdbcConfig.getDriver() + "," + "Url=" + jdbcConfig.getURL()
- + "?autoReconnect=true," + "Username=" + jdbcConfig.getUser() + "," + "Password="
- + jdbcConfig.getPassword() + ",validationQuery=" + jdbcConfig.getValidationQuery();
- logger.debug("Connection properties={}", connectionProperties);
- return Collections.singletonMap("openjpa.ConnectionProperties", connectionProperties);
- }
-}
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/ServerSettings.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/ServerSettings.java
index 1b4015c..78570f7 100644
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/ServerSettings.java
+++ b/custos-commons/src/main/java/org/apache/custos/commons/utils/ServerSettings.java
@@ -26,7 +26,10 @@ import org.slf4j.LoggerFactory;
public class ServerSettings extends ApplicationSettings {
private static final Logger log = LoggerFactory.getLogger(ServerSettings.class);
-
+ // Iam Server Constants
+ public static final String IAM_SERVER_URL = "iam.server.url";
+ public static final String IAM_SERVER_SUPER_ADMIN_USERNAME = "iam.server.super.admin.username";
+ public static final String IAM_SERVER_SUPER_ADMIN_PASSWORD = "iam.server.super.admin.password";
public static int getCacheSize() throws ApplicationSettingsException {
return Integer.valueOf(getSetting(Constants.IN_MEMORY_CACHE_SIZE));
@@ -34,12 +37,7 @@ public class ServerSettings extends ApplicationSettings {
public static String getAuthzCacheManagerClassName() throws ApplicationSettingsException {
return getSetting(Constants.AUTHZ_CACHE_MANAGER_CLASS);
}
- public static boolean isAPISecured() throws ApplicationSettingsException {
- return Boolean.valueOf(getSetting(Constants.IS_API_SECURED));
- }
- public static String getAuthorizationPoliyName() throws ApplicationSettingsException {
- return getSetting(Constants.AUTHORIZATION_POLICY_NAME);
- }
+
public static String getSecurityManagerClassName() throws ApplicationSettingsException {
return getSetting(Constants.SECURITY_MANAGER_CLASS);
}
@@ -49,18 +47,6 @@ public class ServerSettings extends ApplicationSettings {
public static boolean isAuthzCacheEnabled() throws ApplicationSettingsException {
return Boolean.valueOf(getSetting(Constants.AUTHZ_CACHE_ENABLED));
}
- public static String getIamServerSuperAdminUsername() throws ApplicationSettingsException {
- return getSetting(ServerSettings.IAM_SERVER_SUPER_ADMIN_USERNAME);
- }
- public static String getIamServerSuperAdminPassword() throws ApplicationSettingsException {
- return getSetting(ServerSettings.IAM_SERVER_SUPER_ADMIN_PASSWORD);
- }
- public static String getProfileServiceServerHost() throws ApplicationSettingsException {
- return getSetting(ServerSettings.PROFILE_SERVICE_SERVER_HOST);
- }
- public static String getProfileServiceServerPort() throws ApplicationSettingsException {
- return getSetting(ServerSettings.PROFILE_SERVICE_SERVER_PORT);
- }
public static String getAuthenticationServerPort() throws ApplicationSettingsException {
return getSetting(ServerSettings.AUTHENTICATION_SERVICE_SERVER_PORT);
}
diff --git a/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityCheck.java b/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityCheck.java
deleted file mode 100644
index 362fb1f..0000000
--- a/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityCheck.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * 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.security.interceptor;
-
-import com.google.inject.BindingAnnotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This is just the definition of the annotation used to mark the API methods to be intercepted.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
-@BindingAnnotation
-public @interface SecurityCheck {
-}
diff --git a/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityInterceptor.java b/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityInterceptor.java
deleted file mode 100644
index a67cf8e..0000000
--- a/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityInterceptor.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- *
- * 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.security.interceptor;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-import org.apache.custos.commons.exceptions.ApplicationSettingsException;
-import org.apache.custos.commons.exceptions.CustosSecurityException;
-import org.apache.custos.commons.model.error.AuthorizationException;
-import org.apache.custos.commons.model.security.AuthzToken;
-import org.apache.custos.commons.utils.Constants;
-import org.apache.custos.commons.utils.ServerSettings;
-import org.apache.custos.security.manager.CustosSecurityManager;
-import org.apache.custos.security.manager.IdentityContext;
-import org.apache.custos.security.manager.SecurityManagerFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Interceptor of Custos API calls for the purpose of applying security.
- */
-public class SecurityInterceptor implements MethodInterceptor {
- private final static Logger logger = LoggerFactory.getLogger(SecurityInterceptor.class);
-
- @Override
- public Object invoke(MethodInvocation invocation) throws Throwable {
- //obtain the authz token from the input parameters
- AuthzToken authzToken = (AuthzToken) invocation.getArguments()[0];
- //authorize the API call
- HashMap<String, String> metaDataMap = new HashMap();
- metaDataMap.put(Constants.API_METHOD_NAME, invocation.getMethod().getName());
- authorize(authzToken, metaDataMap);
- //set the user identity info in a thread local to be used in downstream execution.
- IdentityContext.set(authzToken);
- //let the method call procees upon successful authorization
- Object returnObj = invocation.proceed();
- //clean the identity context before the method call returns
- IdentityContext.unset();
- return returnObj;
- }
-
- private void authorize(AuthzToken authzToken, Map<String, String> metaData) throws AuthorizationException {
- try {
- boolean isAPISecured = ServerSettings.isAPISecured();
- if (isAPISecured) {
- CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
- boolean isAuthz = securityManager.isUserAuthenticated(authzToken);
- if (!isAuthz) {
- throw new AuthorizationException("User is not authenticated or authorized.");
- }
- }
- } catch (CustosSecurityException e) {
- logger.error(e.getMessage(), e);
- throw new AuthorizationException("Error in authenticating or authorizing user.");
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new AuthorizationException("Internal error in authenticating or authorizing user.");
- }
- }
-}
-
-
diff --git a/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityModule.java b/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityModule.java
deleted file mode 100644
index c9475cc..0000000
--- a/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityModule.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * 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.security.interceptor;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.matcher.Matchers;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This does the plumbing work of integrating the interceptor with Guice framework for the methods to be
- * intercepted upon their invocation.
- */
-public class SecurityModule extends AbstractModule {
- private final static Logger logger = LoggerFactory.getLogger(SecurityModule.class);
-
- public void configure(){
- logger.info("Security module reached...");
- SecurityInterceptor interceptor = new SecurityInterceptor();
- //requestInjection(interceptor);
-
- bindInterceptor(Matchers.any(), Matchers.annotatedWith(SecurityCheck.class), interceptor);
- }
-
-}
diff --git a/custos-connectors/src/main/java/org.apache.custos.security/manager/CustosSecurityManager.java b/custos-connectors/src/main/java/org.apache.custos.security/manager/CustosSecurityManager.java
index 4fbcc5d..c18b8bc 100644
--- a/custos-connectors/src/main/java/org.apache.custos.security/manager/CustosSecurityManager.java
+++ b/custos-connectors/src/main/java/org.apache.custos.security/manager/CustosSecurityManager.java
@@ -48,7 +48,7 @@ public interface CustosSecurityManager {
* @return
* @throws CustosSecurityException
*/
- public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) throws CustosSecurityException;
+ public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws CustosSecurityException;
/**
* Get OpenID Connect user profile information from the given AuthzToken.
diff --git a/custos-connectors/src/main/java/org.apache.custos.security/manager/KeyCloakSecurityManager.java b/custos-connectors/src/main/java/org.apache.custos.security/manager/KeyCloakSecurityManager.java
index 88cd26f..0b4d16e 100644
--- a/custos-connectors/src/main/java/org.apache.custos.security/manager/KeyCloakSecurityManager.java
+++ b/custos-connectors/src/main/java/org.apache.custos.security/manager/KeyCloakSecurityManager.java
@@ -96,11 +96,6 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
String accessToken = authzToken.getAccessToken();
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
try {
- if (!ServerSettings.isAPISecured()) {
- return true;
- }
- initServiceClients();
-
if (ServerSettings.isAuthzCacheEnabled()) {
//obtain an instance of AuthzCacheManager implementation.
AuthzCacheManager authzCacheManager = AuthzCacheManagerFactory.getAuthzCacheManager();
@@ -118,22 +113,17 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
} else if (AuthzCachedStatus.NOT_CACHED.equals(authzCachedStatus)) {
logger.debug("Authz decision for: (" + subject + ", " + accessToken + ") is not in the cache. " +
"Generating decision based on group membership.");
-// GatewayGroupMembership gatewayGroupMembership = getGatewayGroupMembership(subject, accessToken, gatewayId);
-// boolean authorizationDecision = hasPermission(gatewayGroupMembership, action);
- boolean authorizationDecision = validateToken(subject, accessToken, gatewayId);
+ boolean authenticationDecision = validateToken(subject, accessToken, gatewayId);
//cache the authorization decision
long currentTime = System.currentTimeMillis();
- //TODO get the actual token expiration time
authzCacheManager.addToAuthzCache(new AuthzCacheIndex(subject, gatewayId, accessToken),
- new AuthzCacheEntry(authorizationDecision, currentTime + 1000 * 60 * 60, currentTime));
- return authorizationDecision;
+ new AuthzCacheEntry(authenticationDecision, currentTime + 1000 * 60 * 60, currentTime));
+ return authenticationDecision;
} else {
//undefined status returned from the authz cache manager
throw new CustosSecurityException("Error in reading from the authorization cache.");
}
} else {
-// GatewayGroupMembership gatewayGroupMembership = getGatewayGroupMembership(subject, accessToken, gatewayId);
-// return hasPermission(gatewayGroupMembership, action);
return validateToken(subject, accessToken, gatewayId);
}
@@ -144,48 +134,35 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
logger.error("Error occurred while checking if user: " + subject + " is authorized in gateway: " + gatewayId, e);
throw new CustosSecurityException(e.getMessage(), e);
}
-// } finally {
-// closeServiceClients();
-// }
}
-
+ //TODO: no way to get gateway as tenant profile service has not been migrated. Check if clientId and clientSecret could be removed
@Override
- public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) throws CustosSecurityException {
+ public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws CustosSecurityException {
try {
- initServiceClients();
- Gateway gateway = tenantProfileClient.getGatewayUsingGatewayId(authzToken,gatewayId);
String tokenURL = getTokenEndpoint(gatewayId);
- JSONObject clientCredentials = getClientCredentials(tokenURL, gateway.getOauthClientId(), gateway.getOauthClientSecret());
+ JSONObject clientCredentials = getClientCredentials(tokenURL, clientId, clientSecret);
String accessToken = clientCredentials.getString("access_token");
AuthzToken userManagementServiceAccountAuthzToken = new AuthzToken(accessToken);
userManagementServiceAccountAuthzToken.putToClaimsMap(Constants.GATEWAY_ID, gatewayId);
- userManagementServiceAccountAuthzToken.putToClaimsMap(Constants.USER_NAME, gateway.getOauthClientId());
+ userManagementServiceAccountAuthzToken.putToClaimsMap(Constants.USER_NAME, clientId);
return userManagementServiceAccountAuthzToken;
} catch (Exception e) {
throw new CustosSecurityException(e);
- } finally {
- closeServiceClients();
}
}
@Override
public UserInfo getUserInfoFromAuthzToken(AuthzToken authzToken) throws CustosSecurityException {
try {
-// initServiceClients();
final String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
final String token = authzToken.getAccessToken();
return getUserInfo(gatewayId, token);
} catch (Exception e) {
throw new CustosSecurityException(e);
}
-// } finally {
-// closeServiceClients();
-// }
}
private UserInfo getUserInfo(String gatewayId, String token) throws Exception {
-// GatewayResourceProfile gwrp = registryServiceClient.getGatewayResourceProfile(gatewayId);
-// String identityServerRealm = gwrp.getIdentityServerTenant();
//TODO: Confirm the difference between gatewayId and IdentityServerTenant, using gatewayId as of now
String openIdConnectUrl = getOpenIDConfigurationUrl(gatewayId);
JSONObject openIdConnectConfig = new JSONObject(getFromUrl(openIdConnectUrl, null));
@@ -200,25 +177,6 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
.setUsername(userInfo.getString("preferred_username"));
}
-// private GatewayGroupMembership getGatewayGroupMembership(String username, String token, String gatewayId) throws Exception {
-// validateToken(username, token, gatewayId);
-// GatewayGroups gatewayGroups = getGatewayGroups(gatewayId);
-// List<UserGroup> userGroups = sharingRegistryServiceClient.getAllMemberGroupsForUser(gatewayId, username + "@" + gatewayId);
-// List<String> userGroupIds = userGroups.stream().map(g -> g.getGroupId()).collect(Collectors.toList());
-// GatewayGroupMembership gatewayGroupMembership = new GatewayGroupMembership();
-// gatewayGroupMembership.setInAdminsGroup(userGroupIds.contains(gatewayGroups.getAdminsGroupId()));
-// gatewayGroupMembership.setInReadOnlyAdminsGroup(userGroupIds.contains(gatewayGroups.getReadOnlyAdminsGroupId()));
-// return gatewayGroupMembership;
-// }
-
-// private GatewayGroups getGatewayGroups(String gatewayId) throws Exception {
-// if (registryServiceClient.isGatewayGroupsExists(gatewayId)) {
-// return registryServiceClient.getGatewayGroups(gatewayId);
-// } else {
-// return GatewayGroupsInitializer.initializeGatewayGroups(gatewayId);
-// }
-// }
-
private boolean validateToken(String username, String token, String gatewayId) throws Exception {
UserInfo userInfo = getUserInfo(gatewayId, token);
if (!username.equals(userInfo.getUsername())) {
@@ -227,30 +185,6 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
return true;
}
-// private String[] getUserRolesFromOAuthToken(String username, String token, String gatewayId) throws Exception {
-// GatewayResourceProfile gwrp = getRegistryServiceClient().getGatewayResourceProfile(gatewayId);
-// String identityServerRealm = gwrp.getIdentityServerTenant();
-// String openIdConnectUrl = getOpenIDConfigurationUrl(identityServerRealm);
-// JSONObject openIdConnectConfig = new JSONObject(getFromUrl(openIdConnectUrl, token));
-// String userInfoEndPoint = openIdConnectConfig.getString("userinfo_endpoint");
-// JSONObject userInfo = new JSONObject(getFromUrl(userInfoEndPoint, token));
-// if (!username.equals(userInfo.get("preferred_username"))) {
-// throw new CustosSecurityException("Subject name and username for the token doesn't match");
-// }
-// String userId = userInfo.getString("sub");
-//
-// String userRoleMappingUrl = ServerSettings.getRemoteIDPServiceUrl() + "/admin/realms/"
-// + identityServerRealm + "/users/"
-// + userId + "/role-mappings/realm";
-// JSONArray roleMappings = new JSONArray(getFromUrl(userRoleMappingUrl, getAdminAccessToken(gatewayId)));
-// String[] roles = new String[roleMappings.length()];
-// for (int i = 0; i < roleMappings.length(); i++) {
-// roles[i] = (new JSONObject(roleMappings.get(i).toString())).get("name").toString();
-// }
-//
-// return roles;
-// }
-
private String getOpenIDConfigurationUrl(String realm) throws ApplicationSettingsException {
return ServerSettings.getRemoteIDPServiceUrl() + "/realms/" + realm + "/.well-known/openid-configuration";
}
@@ -274,33 +208,6 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
return result.toString();
}
-// private String getAdminAccessToken(String gatewayId) throws Exception {
-// CredentialStoreService.Client csClient = getCredentialStoreServiceClient();
-// GatewayResourceProfile gwrp = getRegistryServiceClient().getGatewayResourceProfile(gatewayId);
-// String identityServerRealm = gwrp.getIdentityServerTenant();
-// String openIdConnectUrl = getOpenIDConfigurationUrl(identityServerRealm);
-// JSONObject openIdConnectConfig = new JSONObject(getFromUrl(openIdConnectUrl, null));
-// PasswordCredential credential = csClient.getPasswordCredential(gwrp.getIdentityServerPwdCredToken(), gwrp.getGatewayID());
-// String username = credential.getLoginUserName();
-// String password = credential.getPassword();
-// String urlString = openIdConnectConfig.getString("token_endpoint");
-// StringBuilder result = new StringBuilder();
-// URL url = new URL(urlString);
-// HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-// conn.setRequestMethod("POST");
-// conn.setDoOutput(true);
-// String postFields = "client_id=admin-cli&username=" + username + "&password=" + password + "&grant_type=password";
-// conn.getOutputStream().write(postFields.getBytes());
-// BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
-// String line;
-// while ((line = rd.readLine()) != null) {
-// result.append(line);
-// }
-// rd.close();
-// JSONObject tokenInfo = new JSONObject(result.toString());
-// return tokenInfo.get("access_token").toString();
-// }
-
private String getTokenEndpoint(String gatewayId) throws Exception {
String openIdConnectUrl = getOpenIDConfigurationUrl(gatewayId);
JSONObject openIdConnectConfig = new JSONObject(getFromUrl(openIdConnectUrl, null));
@@ -337,94 +244,4 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
}
}
}
-
-// private boolean hasPermission(GatewayGroupMembership gatewayGroupMembership, String apiMethod) {
-//
-// // Note: as a stopgap solution, until all resources are secured with group-based authorization, map the Admins
-// // and Read Only Admins groups to the corresponding roles
-// final String role;
-// if (gatewayGroupMembership.isInAdminsGroup()) {
-// return true;
-// } else if (gatewayGroupMembership.isInReadOnlyAdminsGroup()) {
-// role = "admin-read-only";
-// } else {
-// // If not in Admins or Read Only Admins groups, treat as a gateway-user
-// role = "gateway-user";
-// }
-// Pattern pattern = Pattern.compile(this.rolePermissionConfig.get(role));
-// Matcher matcher = pattern.matcher(apiMethod);
-// return matcher.matches();
-// }
-//
-// private boolean hasPermission(String[] roles, String apiMethod) {
-// for (int i = 0; i < roles.length; i++) {
-// String role = roles[i];
-// if (this.rolePermissionConfig.keySet().contains(role)) {
-// Pattern pattern = Pattern.compile(this.rolePermissionConfig.get(role));
-// Matcher matcher = pattern.matcher(apiMethod);
-// if (matcher.matches())
-// return true;
-// }
-// }
-// return false;
-// }
-//
- private void initServiceClients() throws TException, ApplicationSettingsException {
- tenantProfileClient = getTenantProfileServiceClient();
- }
-
- private void closeServiceClients() {
- if (tenantProfileClient != null) {
- ThriftUtils.close(tenantProfileClient);
- }
- }
-
-// private RegistryService.Client getRegistryServiceClient() throws TException, ApplicationSettingsException {
-// final int serverPort = Integer.parseInt(ServerSettings.getRegistryServerPort());
-// final String serverHost = ServerSettings.getRegistryServerHost();
-// try {
-// return RegistryServiceClientFactory.createRegistryClient(serverHost, serverPort);
-// } catch (RegistryServiceException e) {
-// throw new TException("Unable to create registry client...", e);
-// }
-// }
-//
-// private CredentialStoreService.Client getCredentialStoreServiceClient() throws TException, ApplicationSettingsException {
-// final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort());
-// final String serverHost = ServerSettings.getCredentialStoreServerHost();
-// try {
-// return CredentialStoreClientFactory.createAiravataCSClient(serverHost, serverPort);
-// } catch (CredentialStoreException e) {
-// throw new TException("Unable to create credential store client...", e);
-// }
-// }
-//
-// private SharingRegistryService.Client getSharingRegistryServiceClient() throws TException, ApplicationSettingsException {
-// final int serverPort = Integer.parseInt(ServerSettings.getSharingRegistryPort());
-// final String serverHost = ServerSettings.getSharingRegistryHost();
-// try {
-// return SharingRegistryServiceClientFactory.createSharingRegistryClient(serverHost, serverPort);
-// } catch (SharingRegistryException e) {
-// throw new TException("Unable to create sharing registry client...", e);
-// }
-// }
-
-// public static void main(String[] args) throws CustosSecurityException, ApplicationSettingsException {
-// ServerSettings.setSetting("trust.store", "./modules/configuration/server/src/main/resources/client_truststore.jks");
-// ServerSettings.setSetting("trust.store.password", "airavata");
-// KeyCloakSecurityManager keyCloakSecurityManager = new KeyCloakSecurityManager();
-// final String tokenURL = "...";
-// final String clientId = "...";
-// final String clientSecret = "...";
-// JSONObject jsonObject = keyCloakSecurityManager.getClientCredentials(tokenURL, clientId, clientSecret);
-// System.out.println("access_token=" + jsonObject.getString("access_token"));
-// }
- private TenantProfileService.Client getTenantProfileServiceClient() throws ApplicationSettingsException , TenantProfileServiceException, TException {
- try {
- TenantProfileService.Client tenantProfileClient = ProfileServiceClientFactory.createTenantProfileServiceClient(ServerSettings.getProfileServiceServerHost(), Integer.parseInt(ServerSettings.getProfileServiceServerPort()));
- return tenantProfileClient;
- } catch (TenantProfileServiceException e) {
- throw new TenantProfileServiceException("Unable to create tenant profile client...");
- }
- }
}
diff --git a/custos-profile-service/iam-admin-services-core/pom.xml b/custos-profile-service/iam-admin-services-core/pom.xml
deleted file mode 100644
index 7b2e09d..0000000
--- a/custos-profile-service/iam-admin-services-core/pom.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>8</source>
- <target>8</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <parent>
- <groupId>org.apache.custos</groupId>
- <artifactId>profile-service</artifactId>
- <version>1.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
-
- <artifactId>iam-admin-services-core</artifactId>
- <name>Iam Admin Services</name>
-
- <dependencies>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.2</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.0.1</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/org.jboss.resteasy/resteasy-client -->
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-client</artifactId>
- <version>3.0.14.Final</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/org.jboss.resteasy/resteasy-jackson2-provider -->
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-jackson2-provider</artifactId>
- <version>3.0.14.Final</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.5.4</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/org.keycloak/keycloak-admin-client -->
- <dependency>
- <groupId>org.keycloak</groupId>
- <artifactId>keycloak-admin-client</artifactId>
- <version>2.5.5.Final</version>
- </dependency>
- <dependency>
- <groupId>org.apache.custos</groupId>
- <artifactId>profile-service-stubs</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.custos</groupId>
- <artifactId>custos-commons</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.custos</groupId>
- <artifactId>profile-service-models</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-
-</project>
\ No newline at end of file
diff --git a/custos-profile-service/iam-admin-services-core/src/main/java/org/apache/custos/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java b/custos-profile-service/iam-admin-services-core/src/main/java/org/apache/custos/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
deleted file mode 100644
index f3309bd..0000000
--- a/custos-profile-service/iam-admin-services-core/src/main/java/org/apache/custos/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
+++ /dev/null
@@ -1,821 +0,0 @@
-/*
- *
- * 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.profile.iam.admin.services.core.impl;
-
-import org.apache.custos.commons.exceptions.ApplicationSettingsException;
-import org.apache.custos.commons.utils.SecurityUtil;
-import org.apache.custos.commons.utils.ServerSettings;
-import org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
-import org.apache.custos.profile.model.tenant.PasswordCredential;
-import org.apache.custos.profile.model.user.Status;
-import org.apache.custos.profile.model.user.UserProfile;
-import org.apache.custos.profile.model.workspace.Gateway;
-import org.apache.custos.profile.iam.admin.services.core.interfaces.TenantManagementInterface;
-import org.jboss.resteasy.client.jaxrs.ResteasyClient;
-import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
-import org.keycloak.admin.client.Keycloak;
-import org.keycloak.admin.client.KeycloakBuilder;
-import org.keycloak.admin.client.resource.RoleResource;
-import org.keycloak.admin.client.resource.UserResource;
-import org.keycloak.representations.idm.ClientRepresentation;
-import org.keycloak.representations.idm.CredentialRepresentation;
-import org.keycloak.representations.idm.RealmRepresentation;
-import org.keycloak.representations.idm.RoleRepresentation;
-import org.keycloak.representations.idm.RolesRepresentation;
-import org.keycloak.representations.idm.UserRepresentation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.Response;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.KeyStore;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class TenantManagementKeycloakImpl implements TenantManagementInterface {
-
- private final static Logger logger = LoggerFactory.getLogger(TenantManagementKeycloakImpl.class);
-
- private String superAdminRealmId = "master";
-
- private static Keycloak getClient(String adminUrl, String realm, PasswordCredential AdminPasswordCreds) {
-
- ResteasyClient resteasyClient = new ResteasyClientBuilder()
- .connectionPoolSize(10)
- .trustStore(loadKeyStore())
- .build();
- return KeycloakBuilder.builder()
- .serverUrl(adminUrl)
- .realm(realm)
- .username(AdminPasswordCreds.getLoginUserName())
- .password(AdminPasswordCreds.getPassword())
- .clientId("admin-cli")
- .resteasyClient(resteasyClient)
- .build();
- }
-
- private static Keycloak getClient(String adminUrl, String realm, String accessToken) {
-
- ResteasyClient resteasyClient = new ResteasyClientBuilder()
- .connectionPoolSize(10)
- .trustStore(loadKeyStore())
- .build();
- return KeycloakBuilder.builder()
- .serverUrl(adminUrl)
- .realm(realm)
- .authorization(accessToken)
- .resteasyClient(resteasyClient)
- .build();
- }
-
- private static KeyStore loadKeyStore() {
-
- InputStream is = null;
- try {
-
- String trustStorePath = ServerSettings.getTrustStorePath();
- File trustStoreFile = new File(trustStorePath);
-
- if (trustStoreFile.exists()) {
- logger.debug("Loading trust store file from path " + trustStorePath);
- is = new FileInputStream(trustStorePath);
- } else {
- logger.debug("Trying to load trust store file form class path " + trustStorePath);
- is = SecurityUtil.class.getClassLoader().getResourceAsStream(trustStorePath);
- if (is != null) {
- logger.debug("Trust store file was loaded form class path " + trustStorePath);
- }
- }
-
- if (is == null) {
- throw new RuntimeException("Could not find a trust store file in path " + trustStorePath);
- }
-
- KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
- ks.load(is, ServerSettings.getTrustStorePassword().toCharArray());
- return ks;
- } catch (Exception e) {
- throw new RuntimeException("Failed to load trust store KeyStore instance", e);
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- logger.error("Failed to close trust store FileInputStream", e);
- }
- }
- }
- }
-
- @Override
- public Gateway addTenant(PasswordCredential isSuperAdminPasswordCreds, Gateway gatewayDetails) throws IamAdminServicesException {
- Keycloak client = null;
- try {
- // get client
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), this.superAdminRealmId, isSuperAdminPasswordCreds);
- // create realm
- RealmRepresentation newRealmDetails = new RealmRepresentation();
- newRealmDetails.setEnabled(true);
- newRealmDetails.setId(gatewayDetails.getGatewayId());
- newRealmDetails.setDisplayName(gatewayDetails.getGatewayName());
- newRealmDetails.setRealm(gatewayDetails.getGatewayId());
- // Following two settings allow duplicate email addresses
- newRealmDetails.setLoginWithEmailAllowed(false);
- newRealmDetails.setDuplicateEmailsAllowed(true);
- // Default access token lifespan to 30 minutes, SSO session idle to 60 minutes
- newRealmDetails.setAccessTokenLifespan(1800);
- newRealmDetails.setSsoSessionIdleTimeout(3600);
- RealmRepresentation realmWithRoles = TenantManagementKeycloakImpl.createDefaultRoles(newRealmDetails);
- client.realms().create(realmWithRoles);
- return gatewayDetails;
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting Iam server Url from property file, reason: " + ex.getMessage());
- throw exception;
- } catch (Exception ex){
- logger.error("Error creating Realm in Keycloak Server, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error creating Realm in Keycloak Server, reason: " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- public static RealmRepresentation createDefaultRoles(RealmRepresentation realmDetails){
- List<RoleRepresentation> defaultRoles = new ArrayList<RoleRepresentation>();
- RoleRepresentation adminRole = new RoleRepresentation();
- adminRole.setName("admin");
- adminRole.setDescription("Admin role for PGA users");
- defaultRoles.add(adminRole);
- RoleRepresentation adminReadOnlyRole = new RoleRepresentation();
- adminReadOnlyRole.setName("admin-read-only");
- adminReadOnlyRole.setDescription("Read only role for PGA Admin users");
- defaultRoles.add(adminReadOnlyRole);
- RoleRepresentation gatewayUserRole = new RoleRepresentation();
- gatewayUserRole.setName("gateway-user");
- gatewayUserRole.setDescription("default role for PGA users");
- defaultRoles.add(gatewayUserRole);
- RoleRepresentation pendingUserRole = new RoleRepresentation();
- pendingUserRole.setName("user-pending");
- pendingUserRole.setDescription("role for newly registered PGA users");
- defaultRoles.add(pendingUserRole);
- RoleRepresentation gatewayProviderRole = new RoleRepresentation();
- gatewayProviderRole.setName("gateway-provider");
- gatewayProviderRole.setDescription("role for gateway providers in the super-admin PGA");
- defaultRoles.add(gatewayProviderRole);
- RolesRepresentation rolesRepresentation = new RolesRepresentation();
- rolesRepresentation.setRealm(defaultRoles);
- realmDetails.setRoles(rolesRepresentation);
- return realmDetails;
- }
-
- @Override
- public boolean createTenantAdminAccount(PasswordCredential isSuperAdminPasswordCreds, Gateway gatewayDetails, String tenantAdminPassword) throws IamAdminServicesException{
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), this.superAdminRealmId, isSuperAdminPasswordCreds);
- UserRepresentation user = new UserRepresentation();
- user.setUsername(gatewayDetails.getIdentityServerUserName());
- user.setFirstName(gatewayDetails.getGatewayAdminFirstName());
- user.setLastName(gatewayDetails.getGatewayAdminLastName());
- user.setEmail(gatewayDetails.getGatewayAdminEmail());
- user.setEmailVerified(true);
- user.setEnabled(true);
- Response httpResponse = client.realm(gatewayDetails.getGatewayId()).users().create(user);
- logger.info("Tenant Admin account creation exited with code : " + httpResponse.getStatus()+" : " +httpResponse.getStatusInfo());
- if (httpResponse.getStatus() == 201) { //HTTP code for record creation: HTTP 201
- List<UserRepresentation> retrieveCreatedUserList = client.realm(gatewayDetails.getGatewayId()).users().search(user.getUsername(),
- user.getFirstName(),
- user.getLastName(),
- user.getEmail(),
- 0, 1);
- UserResource retrievedUser = client.realm(gatewayDetails.getGatewayId()).users().get(retrieveCreatedUserList.get(0).getId());
-
- // Add user to the "admin" role
- RoleResource adminRoleResource = client.realm(gatewayDetails.getGatewayId()).roles().get("admin");
- retrievedUser.roles().realmLevel().add(Arrays.asList(adminRoleResource.toRepresentation()));
-
- CredentialRepresentation credential = new CredentialRepresentation();
- credential.setType(CredentialRepresentation.PASSWORD);
- credential.setValue(tenantAdminPassword);
- credential.setTemporary(false);
- retrievedUser.resetPassword(credential);
- List<ClientRepresentation> realmClients = client.realm(gatewayDetails.getGatewayId()).clients().findAll();
- String realmManagementClientId=getRealmManagementClientId(client, gatewayDetails.getGatewayId());
- for(ClientRepresentation realmClient : realmClients){
- if(realmClient.getClientId().equals("realm-management")){
- realmManagementClientId = realmClient.getId();
- }
- }
- retrievedUser.roles().clientLevel(realmManagementClientId).add(retrievedUser.roles().clientLevel(realmManagementClientId).listAvailable());
- return true;
- } else {
- logger.error("Request for Tenant Admin Account Creation failed with HTTP code : " + httpResponse.getStatus());
- logger.error("Reason for Tenant Admin account creation failure : " + httpResponse.getStatusInfo());
- return false;
- }
- }catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- }catch (Exception ex){
- logger.error("Error creating Realm Admin Account in keycloak server, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error creating Realm Admin Account in keycloak server, reason: " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public Gateway configureClient(PasswordCredential isSuperAdminPasswordCreds, Gateway gatewayDetails) throws IamAdminServicesException{
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), this.superAdminRealmId, isSuperAdminPasswordCreds);
- ClientRepresentation pgaClient = new ClientRepresentation();
- pgaClient.setName("pga");
- pgaClient.setClientId("pga");
- pgaClient.setProtocol("openid-connect");
- pgaClient.setStandardFlowEnabled(true);
- pgaClient.setEnabled(true);
- pgaClient.setAuthorizationServicesEnabled(true);
- pgaClient.setDirectAccessGrantsEnabled(true);
- pgaClient.setServiceAccountsEnabled(true);
- pgaClient.setFullScopeAllowed(true);
- pgaClient.setClientAuthenticatorType("client-secret");
- List<String> redirectUris = new ArrayList<>();
- if(gatewayDetails.getGatewayURL()!=null){
- String gatewayURL = gatewayDetails.getGatewayURL();
- // Remove trailing slash from gatewayURL
- if(gatewayURL.endsWith("/")) {
- gatewayURL = gatewayURL.substring(0, gatewayURL.length() - 1);
- }
- // Add redirect URL after login
- redirectUris.add(gatewayURL + "/callback-url"); // PGA
- redirectUris.add(gatewayURL + "/auth/callback*"); // Django
- // Add redirect URL after logout
- redirectUris.add(gatewayURL);
- } else {
- logger.error("Request for Realm Client Creation failed, callback URL not present");
- IamAdminServicesException ex = new IamAdminServicesException();
- ex.setMessage("Gateway Url field in GatewayProfile cannot be empty, Realm Client creation failed");
- throw ex;
- }
- pgaClient.setRedirectUris(redirectUris);
- pgaClient.setPublicClient(false);
- Response httpResponse = client.realms().realm(gatewayDetails.getGatewayId()).clients().create(pgaClient);
- logger.info("Tenant Client configuration exited with code : " + httpResponse.getStatus()+" : " +httpResponse.getStatusInfo());
-
- // Add the manage-users role to the web client
- UserRepresentation serviceAccountUserRepresentation = getUserByUsername(client, gatewayDetails.getGatewayId(), "service-account-" + pgaClient.getClientId());
- UserResource serviceAccountUser = client.realms().realm(gatewayDetails.getGatewayId()).users().get(serviceAccountUserRepresentation.getId());
- String realmManagementClientId = getRealmManagementClientId(client, gatewayDetails.getGatewayId());
- List<RoleRepresentation> manageUsersRole = serviceAccountUser.roles().clientLevel(realmManagementClientId).listAvailable()
- .stream()
- .filter(r -> r.getName().equals("manage-users"))
- .collect(Collectors.toList());
- serviceAccountUser.roles().clientLevel(realmManagementClientId).add(manageUsersRole);
-
- if(httpResponse.getStatus() == 201){
- String ClientUUID = client.realms().realm(gatewayDetails.getGatewayId()).clients().findByClientId(pgaClient.getClientId()).get(0).getId();
- CredentialRepresentation clientSecret = client.realms().realm(gatewayDetails.getGatewayId()).clients().get(ClientUUID).getSecret();
- gatewayDetails.setOauthClientId(pgaClient.getClientId());
- gatewayDetails.setOauthClientSecret(clientSecret.getValue());
- return gatewayDetails;
- } else {
- logger.error("Request for Realm Client Creation failed with HTTP code : " + httpResponse.getStatus());
- logger.error("Reason for Realm Client Creation failure : " + httpResponse.getStatusInfo());
- return null;
- }
- }catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- private static String getRealmManagementClientId(Keycloak client, String realmId) {
- List<ClientRepresentation> realmClients = client.realm(realmId).clients().findAll();
- String realmManagementClientId=null;
- for(ClientRepresentation realmClient : realmClients){
- if(realmClient.getClientId().equals("realm-management")){
- realmManagementClientId = realmClient.getId();
- }
- }
- return realmManagementClientId;
- }
-
- @Override
- public boolean isUsernameAvailable(String accessToken, String tenantId, String username) throws IamAdminServicesException {
- Keycloak client = null;
- try {
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- UserRepresentation userRepresentation = getUserByUsername(client, tenantId, username);
- return userRepresentation == null;
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public boolean createUser(String accessToken, String tenantId, String username, String emailAddress, String firstName, String lastName, String newPassword) throws IamAdminServicesException{
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- UserRepresentation user = new UserRepresentation();
- user.setUsername(username);
- user.setFirstName(firstName);
- user.setLastName(lastName);
- user.setEmail(emailAddress);
- user.setEnabled(false);
- Response httpResponse = client.realm(tenantId).users().create(user);
- if (httpResponse.getStatus() == 201) { //HTTP code for record creation: HTTP 201
- List<UserRepresentation> retrieveCreatedUserList = client.realm(tenantId).users().search(user.getUsername(),
- user.getFirstName(),
- user.getLastName(),
- user.getEmail(),
- 0, 1);
- UserResource retrievedUser = client.realm(tenantId).users().get(retrieveCreatedUserList.get(0).getId());
- CredentialRepresentation credential = new CredentialRepresentation();
- credential.setType(CredentialRepresentation.PASSWORD);
- credential.setValue(newPassword);
- credential.setTemporary(false);
- retrievedUser.resetPassword(credential);
- return true;
- } else {
- logger.error("Request for user Account Creation failed with HTTP code : " + httpResponse.getStatus());
- logger.error("Reason for user account creation failure : " + httpResponse.getStatusInfo());
- return false;
- }
- }catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public boolean enableUserAccount(String accessToken, String tenantId, String username) throws IamAdminServicesException{
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- UserRepresentation userRepresentation = getUserByUsername(client, tenantId, username);
- UserResource userResource = client.realm(tenantId).users().get(userRepresentation.getId());
- UserRepresentation profile = userResource.toRepresentation();
- profile.setEnabled(true);
- // We require that a user verify their email before enabling the account
- profile.setEmailVerified(true);
- userResource.update(profile);
- return true;
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public boolean isUserAccountEnabled(String accessToken, String tenantId, String username) throws IamAdminServicesException{
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- UserRepresentation userRepresentation = getUserByUsername(client, tenantId, username);
- return userRepresentation != null && userRepresentation.isEnabled();
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public boolean isUserExist(String accessToken, String tenantId, String username) throws IamAdminServicesException {
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- UserRepresentation userRepresentation = getUserByUsername(client, tenantId, username);
- return userRepresentation != null;
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public UserProfile getUser(String accessToken, String tenantId, String username) throws IamAdminServicesException {
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- UserRepresentation userRepresentation = getUserByUsername(client, tenantId, username);
- return userRepresentation != null ? convertUserRepresentationToUserProfile(userRepresentation, tenantId) : null;
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public List<UserProfile> getUsers(String accessToken, String tenantId, int offset, int limit, String search)
- throws IamAdminServicesException {
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- List<UserRepresentation> userRepresentationList = client.realm(tenantId).users().search(search, offset, limit);
- return userRepresentationList.stream().map(ur -> convertUserRepresentationToUserProfile(ur, tenantId))
- .collect(Collectors.toList());
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public boolean resetUserPassword(String accessToken, String tenantId, String username, String newPassword) throws IamAdminServicesException{
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- UserRepresentation userRepresentation = getUserByUsername(client, tenantId, username);
- if(userRepresentation != null)
- {
- UserResource retrievedUser = client.realm(tenantId).users().get(userRepresentation.getId());
- CredentialRepresentation credential = new CredentialRepresentation();
- credential.setType(CredentialRepresentation.PASSWORD);
- credential.setValue(newPassword);
- credential.setTemporary(false);
- retrievedUser.resetPassword(credential);
- // Remove the UPDATE_PASSWORD required action
- userRepresentation = retrievedUser.toRepresentation();
- userRepresentation.getRequiredActions().remove("UPDATE_PASSWORD");
- retrievedUser.update(userRepresentation);
- return true;
- }else{
- logger.error("requested User not found");
- return false;
- }
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } catch (Exception ex){
- logger.error("Error resetting user password in keycloak server, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error resetting user password in keycloak server, reason: " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public List<UserProfile> findUser(String accessToken, String tenantId, String email, String userName) throws IamAdminServicesException{
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- List<UserRepresentation> retrieveUserList = client.realm(tenantId).users().search(userName,
- null,
- null,
- email,
- 0, 1);
- if(!retrieveUserList.isEmpty())
- {
- List<UserProfile> userList = new ArrayList<>();
- for(UserRepresentation user : retrieveUserList){
- UserProfile profile = new UserProfile();
- profile.setUserId(user.getUsername());
- profile.setFirstName(user.getFirstName());
- profile.setLastName(user.getLastName());
- profile.setEmails(Arrays.asList(new String[]{user.getEmail()}));
- userList.add(profile);
- }
- return userList;
- }else{
- logger.error("requested User not found");
- return null;
- }
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } catch (Exception ex){
- logger.error("Error finding user in keycloak server, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error finding user in keycloak server, reason: " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public void updateUserProfile(String accessToken, String tenantId, String username, UserProfile userDetails) throws IamAdminServicesException {
-
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, accessToken);
- UserRepresentation userRepresentation = getUserByUsername(client, tenantId, username);
- if(userRepresentation != null)
- {
- userRepresentation.setFirstName(userDetails.getFirstName());
- userRepresentation.setLastName(userDetails.getLastName());
- userRepresentation.setEmail(userDetails.getEmails().get(0));
- UserResource userResource = client.realm(tenantId).users().get(userRepresentation.getId());
- userResource.update(userRepresentation);
- }else{
- throw new IamAdminServicesException("User [" + username + "] wasn't found in Keycloak!");
- }
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } catch (Exception ex){
- logger.error("Error updating user profile in keycloak server, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error updating user profile in keycloak server, reason: " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public boolean addRoleToUser(PasswordCredential realmAdminCreds, String tenantId, String username, String roleName) throws IamAdminServicesException {
-
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, realmAdminCreds);
- List<UserRepresentation> retrieveCreatedUserList = client.realm(tenantId).users().search(username,
- null,
- null,
- null,
- 0, 1);
- UserResource retrievedUser = client.realm(tenantId).users().get(retrieveCreatedUserList.get(0).getId());
-
- // Add user to the role
- RoleResource roleResource = client.realm(tenantId).roles().get(roleName);
- retrievedUser.roles().realmLevel().add(Arrays.asList(roleResource.toRepresentation()));
- return true;
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- @Override
- public boolean removeRoleFromUser(PasswordCredential realmAdminCreds, String tenantId, String username, String roleName) throws IamAdminServicesException {
-
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, realmAdminCreds);
- List<UserRepresentation> retrieveCreatedUserList = client.realm(tenantId).users().search(username,
- null,
- null,
- null,
- 0, 1);
- UserResource retrievedUser = client.realm(tenantId).users().get(retrieveCreatedUserList.get(0).getId());
-
- // Remove role from user
- RoleResource roleResource = client.realm(tenantId).roles().get(roleName);
- retrievedUser.roles().realmLevel().remove(Arrays.asList(roleResource.toRepresentation()));
- return true;
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- client.close();
- }
- }
- }
-
- // TODO: this is needed for migrating from roles to group-based auth but after migration we can remove this
- @Override
- public List<UserProfile> getUsersWithRole(PasswordCredential realmAdminCreds, String tenantId, String roleName) throws IamAdminServicesException {
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, realmAdminCreds);
- // FIXME: this only searches through the most recent 100 users for the given role (assuming there are no more than 10,000 users in the gateway)
- int totalUserCount = client.realm(tenantId).users().count();
- logger.debug("getUsersWithRole: totalUserCount=" + totalUserCount);
- // Load all users in batches
- List<UserRepresentation> allUsers = new ArrayList<>();
- int userBatchSize = 100;
- for (int start = 0; start < totalUserCount; start=start+userBatchSize) {
-
- logger.debug("getUsersWithRole: fetching " + userBatchSize + " users...");
- allUsers.addAll(client.realm(tenantId).users().search(null,
- null,
- null,
- null,
- start, userBatchSize));
- }
- logger.debug("getUsersWithRole: all users count=" + allUsers.size());
- allUsers.sort((a, b) -> a.getCreatedTimestamp() - b.getCreatedTimestamp() > 0 ? -1 : 1);
- // The 100 most recently created users
- List<UserRepresentation> mostRecentUsers = allUsers.subList(0, Math.min(allUsers.size(), 100));
- logger.debug("getUsersWithRole: most recent users count=" + mostRecentUsers.size());
-
- List<UserProfile> usersWithRole = new ArrayList<>();
- for (UserRepresentation user: mostRecentUsers) {
- UserResource userResource = client.realm(tenantId).users().get(user.getId());
-
- List<RoleRepresentation> roleRepresentations = userResource.roles().realmLevel().listAll();
- for (RoleRepresentation roleRepresentation : roleRepresentations){
- if (roleRepresentation.getName().equals(roleName)) {
- usersWithRole.add(convertUserRepresentationToUserProfile(user, tenantId));
- break;
- }
- }
- }
- logger.debug("getUsersWithRole: most recent users with role count=" + usersWithRole.size());
- return usersWithRole;
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- logger.debug("getUsersWithRole: closing client...");
- client.close();
- logger.debug("getUsersWithRole: client closed");
- }
- }
- }
-
- public List<String> getUserRoles(PasswordCredential realmAdminCreds, String tenantId, String username) throws IamAdminServicesException {
- Keycloak client = null;
- try{
- client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), tenantId, realmAdminCreds);
- List<UserRepresentation> userRepresentationList = client.realm(tenantId).users().search(username,
- null,
- null,
- null,
- 0, 1);
- if (userRepresentationList.isEmpty()) {
- logger.warn("No Keycloak user found for username [" + username + "] in tenant [" + tenantId + "].");
- return null;
- }
- UserResource retrievedUser = client.realm(tenantId).users().get(userRepresentationList.get(0).getId());
- return retrievedUser.roles().realmLevel().listAll()
- .stream()
- .map(roleRepresentation -> roleRepresentation.getName())
- .collect(Collectors.toList());
- } catch (ApplicationSettingsException ex) {
- logger.error("Error getting values from property file, reason: " + ex.getMessage(), ex);
- IamAdminServicesException exception = new IamAdminServicesException();
- exception.setMessage("Error getting values from property file, reason " + ex.getMessage());
- throw exception;
- } finally {
- if (client != null) {
- logger.debug("getUserRoles: closing client...");
- client.close();
- logger.debug("getUserRoles: client closed");
- }
- }
- }
-
- private UserProfile convertUserRepresentationToUserProfile(UserRepresentation userRepresentation, String tenantId) {
-
- UserProfile profile = new UserProfile();
- profile.setCustosInternalUserId(userRepresentation.getUsername() + "@" + tenantId);
- profile.setGatewayId(tenantId);
- profile.setUserId(userRepresentation.getUsername());
- profile.setFirstName(userRepresentation.getFirstName());
- profile.setLastName(userRepresentation.getLastName());
- profile.setEmails(Arrays.asList(new String[]{userRepresentation.getEmail()}));
- profile.setCreationTime(userRepresentation.getCreatedTimestamp());
-
- // Just default these. UserProfile isn't a great data model for this data since it isn't actually the Airavata UserProfile
- profile.setLastAccessTime(0);
- profile.setValidUntil(0);
- // Use state field to indicate whether user has been enabled or email verified in Keycloak
- if (userRepresentation.isEnabled()) {
- profile.setState(Status.ACTIVE);
- } else if (userRepresentation.isEmailVerified()) {
- profile.setState(Status.CONFIRMED);
- } else {
- profile.setState(Status.PENDING_CONFIRMATION);
- }
-
- return profile;
- }
-
- private static UserRepresentation getUserByUsername(Keycloak client, String tenantId, String username) {
-
- // Searching for users by username returns also partial matches, so need to filter down to an exact match if it exists
- List<UserRepresentation> userResourceList = client.realm(tenantId).users().search(
- username, null, null, null, null, null);
- for (UserRepresentation userRepresentation : userResourceList) {
- if (userRepresentation.getUsername().equals(username)) {
- return userRepresentation;
- }
- }
- return null;
- }
-
-// public static void main(String[] args) throws IamAdminServicesException, ApplicationSettingsException {
-// TenantManagementKeycloakImpl tenantManagementKeycloak = new TenantManagementKeycloakImpl();
-// ServerSettings.setSetting("trust.store", "./modules/configuration/server/src/main/resources/client_truststore.jks");
-// ServerSettings.setSetting("trust.store.password", "airavata");
-// ServerSettings.setSetting("iam.server.url", "");
-// String accessToken = "";
-// String tenantId = "";
-// String username = "";
-// boolean isUsernameAvailable = tenantManagementKeycloak.isUsernameAvailable(accessToken, tenantId, username);
-// System.out.println("Username " + username + " is " + (isUsernameAvailable ? "": "NOT ") + "available");
-// }
-}
diff --git a/custos-profile-service/iam-admin-services-core/src/main/java/org/apache/custos/profile/iam/admin/services/core/interfaces/TenantManagementInterface.java b/custos-profile-service/iam-admin-services-core/src/main/java/org/apache/custos/profile/iam/admin/services/core/interfaces/TenantManagementInterface.java
deleted file mode 100644
index 1d4a141..0000000
--- a/custos-profile-service/iam-admin-services-core/src/main/java/org/apache/custos/profile/iam/admin/services/core/interfaces/TenantManagementInterface.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- *
- * 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.profile.iam.admin.services.core.interfaces;
-
-import org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
-import org.apache.custos.profile.model.tenant.PasswordCredential;
-import org.apache.custos.profile.model.user.UserProfile;
-import org.apache.custos.profile.model.workspace.Gateway;
-
-import java.util.List;
-
-public interface TenantManagementInterface {
-
- /**
- * Method to add Identity server tenant for Custos gateway creation.
- *
- * @param isSuperAdminPasswordCreds identity server super admin credentials
- * @param gatewayDetails gateway details from workspace catalog
- * @return Gateway object.
- */
- Gateway addTenant(PasswordCredential isSuperAdminPasswordCreds, Gateway gatewayDetails) throws IamAdminServicesException;
-
- /**
- * Method to add tenant Admin account in Identity Server.
- *
- * @param isSuperAdminPasswordCreds identity server super admin credentials
- * @param gatewayDetails gateway details from workspace catalog
- * @param gatewayAdminPassword password to use when creating tenant admin account
- * @return Gateway object.
- */
- boolean createTenantAdminAccount(PasswordCredential isSuperAdminPasswordCreds, Gateway gatewayDetails, String gatewayAdminPassword) throws IamAdminServicesException;
-
- /**
- * Method to configure application client in Identity Server
- *
- * @param isSuperAdminPasswordCreds identity server super admin credentials
- * @param gatewayDetails gateway details from workspace catalog
- * @return Gateway object.
- */
- Gateway configureClient(PasswordCredential isSuperAdminPasswordCreds, Gateway gatewayDetails) throws IamAdminServicesException;
-
- /**
- * Check if username is available to be used for creating a new user account.
- * @param accessToken needs to have access to searching across users by username
- * @param tenantId
- * @param username
- * @return
- */
- boolean isUsernameAvailable(String accessToken, String tenantId, String username) throws IamAdminServicesException;
-
- /**
- * Method to create user in Identity Server
- *
- * @param accessToken
- * @param tenantId
- * @param username
- * @param emailAddress
- * @param firstName
- * @param lastName
- * @param newPassword
- * @return true if user created
- * @throws IamAdminServicesException
- */
- boolean createUser(String accessToken, String tenantId, String username, String emailAddress, String firstName, String lastName, String newPassword) throws IamAdminServicesException;
-
- /**
- * Method to enable user in Identity Server
- *
- * @param accessToken
- * @param tenantId
- * @param username
- * @return boolean.
- */
- boolean enableUserAccount(String accessToken, String tenantId, String username) throws IamAdminServicesException;
-
- /**
- * Method to check if user is enabled in Identity Server
- *
- * @param accessToken
- * @param tenantId
- * @param username
- * @return boolean.
- */
- boolean isUserAccountEnabled(String accessToken, String tenantId, String username) throws IamAdminServicesException;
-
- /**
- * Return whether user exists with username.
- *
- * @param accessToken
- * @param tenantId
- * @param username
- * @return
- */
- boolean isUserExist(String accessToken, String tenantId, String username) throws IamAdminServicesException;
-
- /**
- * Get user profile information from Identity Server
- *
- * @param accessToken
- * @param tenantId
- * @param username
- * @return
- */
- UserProfile getUser(String accessToken, String tenantId, String username) throws IamAdminServicesException;
-
- /**
- * Get a paginated list of user profiles from Identity Server
- *
- * @param accessToken
- * @param tenantId
- * @param offset
- * @param limit
- * @param search String - optional, if specified used to search user profiles
- * @return
- * @throws IamAdminServicesException
- */
- List<UserProfile> getUsers(String accessToken, String tenantId, int offset, int limit, String search) throws IamAdminServicesException;
-
- /**
- * Method to reset user password in Identity Server
- *
- * @param accessToken
- * @param tenantId
- * @param username
- * @param newPassword
- * @return boolean
- */
- boolean resetUserPassword(String accessToken, String tenantId, String username, String newPassword) throws IamAdminServicesException;
-
- /**
- * Method to find user in Identity Server
- *
- * @param accessToken
- * @param tenantId required
- * @param email required
- * @param username can be null
- * @return Gateway object.
- */
- List<UserProfile> findUser(String accessToken, String tenantId, String email, String username) throws IamAdminServicesException;
-
- /**
- * Update the user's profile in the Identity Server
- * @param accessToken
- * @param tenantId
- * @param username
- * @param userDetails
- */
- void updateUserProfile(String accessToken, String tenantId, String username, UserProfile userDetails) throws IamAdminServicesException;
-
- /**
- * Add the given role to the user.
- *
- * @param realmAdminCreds
- * @param tenantId
- * @param username
- * @param roleName
- * @return
- * @throws IamAdminServicesException
- */
- @Deprecated
- boolean addRoleToUser(PasswordCredential realmAdminCreds, String tenantId, String username, String roleName) throws IamAdminServicesException;
-
- /**
- * Remove the given role from the user.
- *
- * @param realmAdminCreds
- * @param tenantId
- * @param username
- * @param roleName
- * @return
- * @throws IamAdminServicesException
- */
- @Deprecated
- boolean removeRoleFromUser(PasswordCredential realmAdminCreds, String tenantId, String username, String roleName) throws IamAdminServicesException;
-
- /**
- * Get all users having the given role.
- *
- * @param realmAdminCreds
- * @param tenantId
- * @param roleName
- * @return
- * @throws IamAdminServicesException
- */
- @Deprecated
- List<UserProfile> getUsersWithRole(PasswordCredential realmAdminCreds, String tenantId, String roleName) throws IamAdminServicesException;
-}
diff --git a/custos-profile-service/iam-admin-services-core/src/test/java/org/apache/custos/profile/iam/admin/services/core/tests/SetupNewGateway.java b/custos-profile-service/iam-admin-services-core/src/test/java/org/apache/custos/profile/iam/admin/services/core/tests/SetupNewGateway.java
deleted file mode 100644
index c96d0f0..0000000
--- a/custos-profile-service/iam-admin-services-core/src/test/java/org/apache/custos/profile/iam/admin/services/core/tests/SetupNewGateway.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.apache.custos.profile.iam.admin.services.core.tests;
-
-import org.apache.custos.profile.model.tenant.PasswordCredential;
-import org.apache.custos.profile.model.user.UserProfile;
-import org.apache.custos.profile.model.workspace.Gateway;
-import org.apache.custos.profile.iam.admin.services.core.impl.TenantManagementKeycloakImpl;
-import org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SetupNewGateway {
-
- private final static Logger logger = LoggerFactory.getLogger(SetupNewGateway.class);
-
- public static void main(String[] args) {
- findUser();
-// final PasswordCredential tenantAdminCreds = createTenantAdminCreds("tenant", "admin", "admin-password");
-// getUserRoles(tenantAdminCreds, "username");
- }
-
- public static void setUpGateway(){
- Gateway testGateway = new Gateway();
- testGateway.setGatewayId("maven.test.gateway");
- testGateway.setGatewayName("maven test gateway");
- testGateway.setIdentityServerUserName("mavenTest");
- testGateway.setGatewayAdminFirstName("Maven");
- testGateway.setGatewayAdminLastName("Test");
- testGateway.setGatewayAdminEmail("some.man@gmail.com");
- PasswordCredential superAdminCreds = new PasswordCredential();
- superAdminCreds.setGatewayId(testGateway.getGatewayId());
- superAdminCreds.setDescription("test credentials for IS admin creation");
- superAdminCreds.setLoginUserName("airavataAdmin");
- superAdminCreds.setPassword("Airavata@123");
- superAdminCreds.setPortalUserName("superAdmin");
- TenantManagementKeycloakImpl client = new TenantManagementKeycloakImpl();
- try {
- client.addTenant(superAdminCreds, testGateway);
- if (!client.createTenantAdminAccount(superAdminCreds, testGateway, "Test@123")) {
- logger.error("Admin account creation failed !!, please refer error logs for reason");
- }
- Gateway gatewayWithIdAndSecret = client.configureClient(superAdminCreds, testGateway);
- System.out.println(gatewayWithIdAndSecret.getOauthClientId());
- System.out.println(gatewayWithIdAndSecret.getOauthClientSecret());
- } catch (IamAdminServicesException ex) {
- logger.error("Gateway Setup Failed, reason: " + ex.getCause(), ex);
- }
- }
- public static void UserRegistration(){
- UserProfile user = new UserProfile();
- user.setUserId("testuser");
- user.setFirstName("test-firstname");
- user.setLastName("test-lastname");
- List<String> emails = new ArrayList<>();
- emails.add("some.man@outlook.com");
- user.setGatewayId("maven.test.gateway");
- user.setEmails(emails);
- PasswordCredential tenantAdminCreds = new PasswordCredential();
- tenantAdminCreds.setGatewayId(user.getGatewayId());
- tenantAdminCreds.setDescription("test credentials for tenant admin creation");
- tenantAdminCreds.setLoginUserName("mavenTest");
- tenantAdminCreds.setPassword("Test@1234");
- tenantAdminCreds.setPortalUserName("TenantAdmin");
-
- TenantManagementKeycloakImpl client = new TenantManagementKeycloakImpl();
- try {
- // FIXME: get an access token from tenant admin creds
- String accessToken = "";
- client.createUser(accessToken, user.getGatewayId(), user.getUserId(), user.getEmails().get(0), user.getFirstName(), user.getLastName(),"test@123");
- client.enableUserAccount(accessToken, user.getGatewayId(), user.getUserId());
- } catch (IamAdminServicesException e) {
- e.printStackTrace();
- }
- }
-
-// public static void resetPassword(){
-// UserProfile user = new UserProfile();
-// user.setUserId("testuser");
-// List<String> emails = new ArrayList<>();
-// emails.add("some.man@outlook.com");
-// user.setGatewayId("maven.test.gateway");
-// user.setEmails(emails);
-// TenantManagementKeycloakImpl client = new TenantManagementKeycloakImpl();
-// try {
-// PasswordCredential tenantAdminCreds = new PasswordCredential();
-// tenantAdminCreds.setGatewayId(user.getGatewayId());
-// tenantAdminCreds.setDescription("test credentials for tenant admin creation");
-// tenantAdminCreds.setLoginUserName("mavenTest");
-// tenantAdminCreds.setPassword("Test@1234");
-// tenantAdminCreds.setPortalUserName("TenantAdmin");
-// client.resetUserPassword(tenantAdminCreds,user,"test@123");
-// } catch (IamAdminServicesException e) {
-// e.printStackTrace();
-// }
-// }
-
- public static void findUser(){
- UserProfile user = new UserProfile();
-
- List<String> emails = new ArrayList<>();
- emails.add("some.man@outlook.com");
- user.setGatewayId("maven.test.gateway");
- user.setEmails(emails);
- TenantManagementKeycloakImpl client = new TenantManagementKeycloakImpl();
- try {
- PasswordCredential tenantAdminCreds = new PasswordCredential();
- tenantAdminCreds.setGatewayId(user.getGatewayId());
- tenantAdminCreds.setDescription("test credentials for tenant admin creation");
- tenantAdminCreds.setLoginUserName("mavenTest");
- tenantAdminCreds.setPassword("Test@1234");
- tenantAdminCreds.setPortalUserName("TenantAdmin");
- // FIXME: get an access token from tenant admin creds
- String accessToken = "";
- List<UserProfile> list = client.findUser(accessToken,"maven.test.gateway","some.man@outlook.com",null);
- System.out.println(list.get(0).getUserId());
- } catch (IamAdminServicesException e) {
- e.printStackTrace();
- }
- }
-
- public static void getUserRoles(PasswordCredential tenantAdminCreds, String username) {
- TenantManagementKeycloakImpl keycloakClient = new TenantManagementKeycloakImpl();
-
- try {
- List<String> roleNames = keycloakClient.getUserRoles(tenantAdminCreds, tenantAdminCreds.getGatewayId(), username);
- System.out.println("Roles=" + roleNames);
- } catch (IamAdminServicesException e) {
- e.printStackTrace();
- }
- }
-
- private static PasswordCredential createTenantAdminCreds(String tenantId, String username, String password) {
- PasswordCredential tenantAdminCreds = new PasswordCredential();
- tenantAdminCreds.setGatewayId(tenantId);
- tenantAdminCreds.setLoginUserName(username);
- tenantAdminCreds.setPassword(password);
- return tenantAdminCreds;
- }
-}
diff --git a/custos-profile-service/pom.xml b/custos-profile-service/pom.xml
deleted file mode 100644
index 1857392..0000000
--- a/custos-profile-service/pom.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>custos</artifactId>
- <groupId>org.apache.custos</groupId>
- <version>1.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>profile-service</artifactId>
- <packaging>pom</packaging>
- <name>profile-service</name>
- <modules>
- <module>iam-admin-services-core</module>
- <module>profile-tenant-core</module>
- <module>profile-user-core</module>
- <module>profile-service-server</module>
- <module>profile-service-commons</module>
- <module>profile-service-model</module>
- <module>profile-service-stubs</module>
- </modules>
-</project>
\ No newline at end of file
diff --git a/custos-profile-service/profile-service-commons/pom.xml b/custos-profile-service/profile-service-commons/pom.xml
deleted file mode 100644
index 184a4cf..0000000
--- a/custos-profile-service/profile-service-commons/pom.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>profile-service</artifactId>
- <groupId>org.apache.custos</groupId>
- <version>1.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>profile-service-commons</artifactId>
- <name>Custos Profile Service Commons</name>
- <description>Module to expose a profile-service-commons as a thrift service</description>
-
- <properties>
- <derby.version>10.11.1.1</derby.version>
- <surefire.version>2.18.1</surefire.version>
- <skipTests>true</skipTests>
- <mysql.connector.version>5.1.34</mysql.connector.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>net.sf.dozer</groupId>
- <artifactId>dozer</artifactId>
- <version>5.4.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
- <version>${openjpa.version}</version>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.connector.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbyclient</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbynet</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbytools</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.custos</groupId>
- <artifactId>custos-commons</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.custos</groupId>
- <artifactId>profile-service-models</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-maven-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <includes>**/entities/*.class</includes>
- <excludes>**/entities/XML*.class</excludes>
- <addDefaultConstructor>true</addDefaultConstructor>
- <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
- </configuration>
- <executions>
- <execution>
- <id>enhancer</id>
- <phase>process-classes</phase>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
- <inherited>true</inherited>
- <configuration>
- <failIfNoTests>false</failIfNoTests>
- <skipTests>${skipTests}</skipTests>
- <workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/AbstractRepository.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/AbstractRepository.java
deleted file mode 100644
index 376b4fb..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/AbstractRepository.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * 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.profile.commons.repositories;
-
-import org.apache.custos.profile.commons.utils.JPAUtils;
-import org.apache.custos.profile.commons.utils.ObjectMapperSingleton;
-import org.dozer.Mapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.Query;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public abstract class AbstractRepository<T, E, Id> {
- private final static Logger logger = LoggerFactory.getLogger(AbstractRepository.class);
-
- private Class<T> thriftGenericClass;
- private Class<E> dbEntityGenericClass;
-
- public AbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass) {
- this.thriftGenericClass = thriftGenericClass;
- this.dbEntityGenericClass = dbEntityGenericClass;
- }
-
- public T create(T t) {
- return update(t);
- }
-
- public T update(T t) {
- Mapper mapper = ObjectMapperSingleton.getInstance();
- E entity = mapper.map(t, dbEntityGenericClass);
- E persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(entity));
- return mapper.map(persistedCopy, thriftGenericClass);
- }
-
- public boolean delete(Id id) {
- JPAUtils.execute(entityManager -> {
- E entity = entityManager.find(dbEntityGenericClass, id);
- entityManager.remove(entity);
- return entity;
- });
- return true;
- }
-
- public T get(Id id) {
- E entity = JPAUtils.execute(entityManager -> entityManager
- .find(dbEntityGenericClass, id));
- Mapper mapper = ObjectMapperSingleton.getInstance();
- return mapper.map(entity, thriftGenericClass);
- }
-
- public List<T> select(String query) {
- List resultSet = (List) JPAUtils.execute(entityManager -> entityManager.createQuery(query).getResultList());
- Mapper mapper = ObjectMapperSingleton.getInstance();
- List<T> resultList = new ArrayList<>();
- resultSet.stream().forEach(rs -> resultList.add(mapper.map(rs, thriftGenericClass)));
- return resultList;
- }
-
- public List<T> select(String query, int limit, int offset) {
- List resultSet = (List) JPAUtils.execute(entityManager -> entityManager.createQuery(query).setFirstResult(offset)
- .setMaxResults(limit).getResultList());
- Mapper mapper = ObjectMapperSingleton.getInstance();
- List<T> resultList = new ArrayList<>();
- resultSet.stream().forEach(rs -> resultList.add(mapper.map(rs, thriftGenericClass)));
- return resultList;
- }
-
- public List<T> select(String query, int limit, int offset, Map<String, Object> queryParams) {
- List resultSet = (List) JPAUtils.execute(entityManager -> {
- Query jpaQuery = entityManager.createQuery(query);
-
- for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
-
- jpaQuery.setParameter(entry.getKey(), entry.getValue());
- }
-
- return jpaQuery.setFirstResult(offset).setMaxResults(limit).getResultList();
-
- });
- Mapper mapper = ObjectMapperSingleton.getInstance();
- List<T> resultList = new ArrayList<>();
- resultSet.stream().forEach(rs -> resultList.add(mapper.map(rs, thriftGenericClass)));
- return resultList;
- }
-
- public List<T> select(String query, Map<String, Object> queryParams) {
- List resultSet = (List) JPAUtils.execute(entityManager -> {
- Query jpaQuery = entityManager.createQuery(query);
-
- for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
-
- jpaQuery.setParameter(entry.getKey(), entry.getValue());
- }
-
- return jpaQuery.getResultList();
-
- });
- Mapper mapper = ObjectMapperSingleton.getInstance();
- List<T> resultList = new ArrayList<>();
- resultSet.stream().forEach(rs -> resultList.add(mapper.map(rs, thriftGenericClass)));
- return resultList;
- }
-}
\ No newline at end of file
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/tenant/entities/GatewayEntity.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/tenant/entities/GatewayEntity.java
deleted file mode 100644
index 8f68815..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/tenant/entities/GatewayEntity.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/**
- *
- * 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.profile.commons.tenant.entities;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.persistence.*;
-import java.util.UUID;
-
-@Entity
-@Table(name = "GATEWAY")
-public class GatewayEntity {
- private final static Logger logger = LoggerFactory.getLogger(GatewayEntity.class);
- private String custosInternalGatewayId;
- private String gatewayId;
- private String gatewayName;
- private String domain;
- private String emailAddress;
- private String gatewayApprovalStatus;
- private String gatewayAcronym;
- private String gatewayUrl;
- private String gatewayPublicAbstract;
- private String reviewProposalDescription;
- private String gatewayAdminFirstName;
- private String gatewayAdminLastName;
- private String gatewayAdminEmail;
- private String identityServerUserName;
- private String identityServerPasswordToken;
- private String declinedReason;
- private String oauthClientId;
- private String oauthClientSecret;
- private long requestCreationTime;
- private String requesterUsername;
-
- // set random value for internalGatewayId
- public GatewayEntity() {
- this.custosInternalGatewayId = UUID.randomUUID().toString();
- }
-
- @Id
- @Column(name = "CUSTOS_INTERNAL_GATEWAY_ID")
- public String getCustosInternalGatewayId() {
- return custosInternalGatewayId;
- }
-
- public void setCustosInternalGatewayId(String custosInternalGatewayId) {
- this.custosInternalGatewayId = custosInternalGatewayId;
- }
-
- @Column(name = "GATEWAY_ID")
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- @Column(name = "GATEWAY_NAME")
- public String getGatewayName() {
- return gatewayName;
- }
-
- public void setGatewayName(String gatewayName) {
- this.gatewayName = gatewayName;
- }
-
- @Column(name = "GATEWAY_DOMAIN")
- public String getDomain() {
- return domain;
- }
-
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
- @Column(name = "EMAIL_ADDRESS")
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- @Column(name = "GATEWAY_APPROVAL_STATUS")
- public String getGatewayApprovalStatus() {
- return gatewayApprovalStatus;
- }
-
- public void setGatewayApprovalStatus(String gatewayApprovalStatus) {
- this.gatewayApprovalStatus = gatewayApprovalStatus;
- }
-
- @Column(name = "GATEWAY_ACRONYM")
- public String getGatewayAcronym() {
- return gatewayAcronym;
- }
-
- public void setGatewayAcronym(String gatewayAcronym) {
- this.gatewayAcronym = gatewayAcronym;
- }
-
- @Column(name = "GATEWAY_URL")
- public String getGatewayUrl() {
- return gatewayUrl;
- }
-
- public void setGatewayUrl(String gatewayUrl) {
- this.gatewayUrl = gatewayUrl;
- }
-
- @Column(name = "GATEWAY_PUBLIC_ABSTRACT")
- public String getGatewayPublicAbstract() {
- return gatewayPublicAbstract;
- }
-
- public void setGatewayPublicAbstract(String gatewayPublicAbstract) {
- this.gatewayPublicAbstract = gatewayPublicAbstract;
- }
-
- @Column(name = "GATEWAY_REVIEW_PROPOSAL_DESCRIPTION")
- public String getReviewProposalDescription() {
- return reviewProposalDescription;
- }
-
- public void setReviewProposalDescription(String reviewProposalDescription) {
- this.reviewProposalDescription = reviewProposalDescription;
- }
-
- @Column(name = "GATEWAY_ADMIN_FIRST_NAME")
- public String getGatewayAdminFirstName() {
- return gatewayAdminFirstName;
- }
-
- public void setGatewayAdminFirstName(String gatewayAdminFirstName) {
- this.gatewayAdminFirstName = gatewayAdminFirstName;
- }
-
- @Column(name = "GATEWAY_ADMIN_LAST_NAME")
- public String getGatewayAdminLastName() {
- return gatewayAdminLastName;
- }
-
- public void setGatewayAdminLastName(String gatewayAdminLastName) {
- this.gatewayAdminLastName = gatewayAdminLastName;
- }
-
- @Column(name = "GATEWAY_ADMIN_EMAIL")
- public String getGatewayAdminEmail() {
- return gatewayAdminEmail;
- }
-
- public void setGatewayAdminEmail(String gatewayAdminEmail) {
- this.gatewayAdminEmail = gatewayAdminEmail;
- }
-
- @Column(name = "IDENTITY_SERVER_USERNAME")
- public String getIdentityServerUserName() {
- return identityServerUserName;
- }
-
- public void setIdentityServerUserName(String identityServerUserName) {
- this.identityServerUserName = identityServerUserName;
- }
-
- @Column(name = "IDENTITY_SERVER_PASSWORD_TOKEN")
- public String getIdentityServerPasswordToken() {
- return identityServerPasswordToken;
- }
-
- public void setIdentityServerPasswordToken(String identityServerPasswordToken) {
- this.identityServerPasswordToken = identityServerPasswordToken;
- }
-
- @Column(name = "REQUESTER_USERNAME")
- public String getRequesterUsername() {
- return requesterUsername;
- }
-
- public void setRequesterUsername(String requesterUsername) {
- this.requesterUsername = requesterUsername;
- }
-
- @Column(name = "DECLINED_REASON")
- public String getDeclinedReason() {
- return declinedReason;
- }
-
- public void setDeclinedReason(String declinedReason) {
- this.declinedReason = declinedReason;
- }
-
- @Column(name = "OAUTH_CLIENT_ID")
- public String getOauthClientId() {
- return oauthClientId;
- }
-
- public void setOauthClientId(String oauthClientId) {
- this.oauthClientId = oauthClientId;
- }
-
- @Column(name = "REQUEST_CREATION_TIME")
- public long getRequestCreationTime() {
- return requestCreationTime;
- }
-
- public void setRequestCreationTime(long requestCreationTime) {
- this.requestCreationTime = requestCreationTime;
- }
-
- @Column(name = "OAUTH_CLIENT_SECRET")
- public String getOauthClientSecret() {
- return oauthClientSecret;
- }
-
- public void setOauthClientSecret(String oauthClientSecret) {
- this.oauthClientSecret = oauthClientSecret;
- }
-
- @PrePersist
- void createdAt() {
- this.requestCreationTime = System.currentTimeMillis();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof GatewayEntity)) {
- return false;
- }
- GatewayEntity gwy = (GatewayEntity) obj;
- return getCustosInternalGatewayId().equals(gwy.getCustosInternalGatewayId());
- }
-
- @Override
- public String toString() {
- return "GatewayEntity{" +
- "custosInternalGatewayId='" + custosInternalGatewayId + '\'' +
- ", gatewayId='" + gatewayId + '\'' +
- ", gatewayName='" + gatewayName + '\'' +
- ", domain='" + domain + '\'' +
- ", emailAddress='" + emailAddress + '\'' +
- ", gatewayApprovalStatus='" + gatewayApprovalStatus + '\'' +
- ", gatewayAcronym='" + gatewayAcronym + '\'' +
- ", gatewayUrl='" + gatewayUrl + '\'' +
- ", gatewayPublicAbstract='" + gatewayPublicAbstract + '\'' +
- ", reviewProposalDescription='" + reviewProposalDescription + '\'' +
- ", gatewayAdminFirstName='" + gatewayAdminFirstName + '\'' +
- ", gatewayAdminLastName='" + gatewayAdminLastName + '\'' +
- ", gatewayAdminEmail='" + gatewayAdminEmail + '\'' +
- ", identityServerUserName='" + identityServerUserName + '\'' +
- ", identityServerPasswordToken='" + identityServerPasswordToken + '\'' +
- ", declinedReason='" + declinedReason + '\'' +
- ", oauthClientId='" + oauthClientId + '\'' +
- ", oauthClientSecret='" + oauthClientSecret + '\'' +
- ", requestCreationTime=" + requestCreationTime +
- ", requesterUsername='" + requesterUsername + '\'' +
- '}';
- }
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/CustomizedDashboardEntity.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/CustomizedDashboardEntity.java
deleted file mode 100644
index d92cc25..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/CustomizedDashboardEntity.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- *
- * 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.profile.commons.user.entities;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "CUSTOMIZED_DASHBOARD")
-public class CustomizedDashboardEntity {
-
- private String custosInternalUserId;
- private String experimentId;
- private String name;
- private String description;
- private String project;
- private String owner;
- private String application;
- private String computeResource;
- private String jobName;
- private String jobId;
- private String jobStatus;
- private String jobCreationTime;
- private String notificationsTo;
- private String workingDir;
- private String jobDescription;
- private String creationTime;
- private String lastModifiedTime;
- private String wallTime;
- private String cpuCount;
- private String nodeCount;
- private String queue;
- private String inputs;
- private String outputs;
- private String storageDir;
- private String errors;
-
- private UserProfileEntity userProfileEntity;
-
- @Id
- @Column(name = "CUSTOS_INTERNAL_USER_ID")
- public String getCustosInternalUserId() {
- return custosInternalUserId;
- }
-
- public void setCustosInternalUserId(String custosInternalUserId) {
- this.custosInternalUserId = custosInternalUserId;
- }
-
- @Column(name = "ENABLED_EXPERIMENT_ID")
- public String getExperimentId() {
- return experimentId;
- }
-
- public void setExperimentId(String experimentId) {
- this.experimentId = experimentId;
- }
-
- @Column(name = "ENABLED_NAME")
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Column(name = "ENABLED_DESCRIPTION")
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Column(name = "ENABLED_PROJECT")
- public String getProject() {
- return project;
- }
-
- public void setProject(String project) {
- this.project = project;
- }
-
- @Column(name = "ENABLED_OWNER")
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- @Column(name = "ENABLED_APPLICATION")
- public String getApplication() {
- return application;
- }
-
- public void setApplication(String application) {
- this.application = application;
- }
-
- @Column(name = "ENABLED_COMPUTE_RESOURCE")
- public String getComputeResource() {
- return computeResource;
- }
-
- public void setComputeResource(String computeResource) {
- this.computeResource = computeResource;
- }
-
- @Column(name = "ENABLED_JOB_NAME")
- public String getJobName() {
- return jobName;
- }
-
- public void setJobName(String jobName) {
- this.jobName = jobName;
- }
-
- @Column(name = "ENABLED_JOB_ID")
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- @Column(name = "ENABLED_JOB_STATUS")
- public String getJobStatus() {
- return jobStatus;
- }
-
- public void setJobStatus(String jobStatus) {
- this.jobStatus = jobStatus;
- }
-
- @Column(name = "ENABLED_JOB_CREATION_TIME")
- public String getJobCreationTime() {
- return jobCreationTime;
- }
-
- public void setJobCreationTime(String jobCreationTime) {
- this.jobCreationTime = jobCreationTime;
- }
-
- @Column(name = "ENABLED_NOTIFICATIONS_TO")
- public String getNotificationsTo() {
- return notificationsTo;
- }
-
- public void setNotificationsTo(String notificationsTo) {
- this.notificationsTo = notificationsTo;
- }
-
- @Column(name = "ENABLED_WORKING_DIR")
- public String getWorkingDir() {
- return workingDir;
- }
-
- public void setWorkingDir(String workingDir) {
- this.workingDir = workingDir;
- }
-
- @Column(name = "ENABLED_JOB_DESCRIPTION")
- public String getJobDescription() {
- return jobDescription;
- }
-
- public void setJobDescription(String jobDescription) {
- this.jobDescription = jobDescription;
- }
-
- @Column(name = "ENABLED_CREATION_TIME")
- public String getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(String creationTime) {
- this.creationTime = creationTime;
- }
-
- @Column(name = "ENABLED_LAST_MODIFIED_TIME")
- public String getLastModifiedTime() {
- return lastModifiedTime;
- }
-
- public void setLastModifiedTime(String lastModifiedTime) {
- this.lastModifiedTime = lastModifiedTime;
- }
-
- @Column(name = "ENABLED_WALL_TIME")
- public String getWallTime() {
- return wallTime;
- }
-
- public void setWallTime(String wallTime) {
- this.wallTime = wallTime;
- }
-
- @Column(name = "ENABLED_CPU_COUNT")
- public String getCpuCount() {
- return cpuCount;
- }
-
- public void setCpuCount(String cpuCount) {
- this.cpuCount = cpuCount;
- }
-
- @Column(name = "ENABLED_NODE_COUNT")
- public String getNodeCount() {
- return nodeCount;
- }
-
- public void setNodeCount(String nodeCount) {
- this.nodeCount = nodeCount;
- }
-
- @Column(name = "ENABLED_QUEUE")
- public String getQueue() {
- return queue;
- }
-
- public void setQueue(String queue) {
- this.queue = queue;
- }
-
- @Column(name = "ENABLED_INPUTS")
- public String getInputs() {
- return inputs;
- }
-
- public void setInputs(String inputs) {
- this.inputs = inputs;
- }
-
- @Column(name = "ENABLED_OUTPUTS")
- public String getOutputs() {
- return outputs;
- }
-
- public void setOutputs(String outputs) {
- this.outputs = outputs;
- }
-
- @Column(name = "ENABLED_STORAGE_DIR")
- public String getStorageDir() {
- return storageDir;
- }
-
- public void setStorageDir(String storageDir) {
- this.storageDir = storageDir;
- }
-
- @Column(name = "ENABLED_ERRORS")
- public String getErrors() {
- return errors;
- }
-
- public void setErrors(String errors) {
- this.errors = errors;
- }
-
- @OneToOne(targetEntity = UserProfileEntity.class, cascade = CascadeType.ALL)
- @PrimaryKeyJoinColumn(name = "CUSTOS_INTERNAL_USER_ID", referencedColumnName = "CUSTOS_INTERNAL_USER_ID")
- public UserProfileEntity getUserProfileEntity() {
- return userProfileEntity;
- }
-
- public void setUserProfileEntity(UserProfileEntity userProfileEntity) {
- this.userProfileEntity = userProfileEntity;
- }
-
- @Override
- public String toString() {
- return "CustomizedDashboardEntity{" +
- "custosInternalUserId='" + custosInternalUserId + '\'' +
- ", experimentId='" + experimentId + '\'' +
- ", name='" + name + '\'' +
- ", description='" + description + '\'' +
- ", project='" + project + '\'' +
- ", owner='" + owner + '\'' +
- ", application='" + application + '\'' +
- ", computeResource='" + computeResource + '\'' +
- ", jobName='" + jobName + '\'' +
- ", jobId='" + jobId + '\'' +
- ", jobStatus='" + jobStatus + '\'' +
- ", jobCreationTime='" + jobCreationTime + '\'' +
- ", notificationsTo='" + notificationsTo + '\'' +
- ", workingDir='" + workingDir + '\'' +
- ", jobDescription='" + jobDescription + '\'' +
- ", creationTime='" + creationTime + '\'' +
- ", lastModifiedTime='" + lastModifiedTime + '\'' +
- ", wallTime='" + wallTime + '\'' +
- ", cpuCount='" + cpuCount + '\'' +
- ", nodeCount='" + nodeCount + '\'' +
- ", queue='" + queue + '\'' +
- ", inputs='" + inputs + '\'' +
- ", outputs='" + outputs + '\'' +
- ", storageDir='" + storageDir + '\'' +
- ", errors='" + errors + '\'' +
- '}';
- }
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/NSFDemographicsEntity.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/NSFDemographicsEntity.java
deleted file mode 100644
index fdf2b90..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/NSFDemographicsEntity.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *
- * 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.profile.commons.user.entities;
-
-import javax.persistence.*;
-import java.util.List;
-
-@Entity
-@Table(name = "NSF_DEMOGRAPHIC")
-public class NSFDemographicsEntity {
- private String custosInternalUserId;
- private String gender;
- private List<String> ethnicities;
- private List<String> races;
- private List<String> disabilities;
- private UserProfileEntity userProfile;
-
- @Id
- @Column(name = "CUSTOS_INTERNAL_USER_ID")
- public String getCustosInternalUserId() {
- return custosInternalUserId;
- }
-
- public void setCustosInternalUserId(String userId) {
- this.custosInternalUserId = userId;
- }
-
- @Column(name = "GENDER")
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- @ElementCollection
- @CollectionTable(name="NSF_DEMOGRAPHIC_ETHNICITY", joinColumns = @JoinColumn(name="CUSTOS_INTERNAL_USER_ID"))
- @Column(name = "ETHNICITY")
- public List<String> getEthnicities() {
- return ethnicities;
- }
-
- public void setEthnicities(List<String> ethnicities) {
- this.ethnicities = ethnicities;
- }
-
- @ElementCollection
- @CollectionTable(name="NSF_DEMOGRAPHIC_RACE", joinColumns = @JoinColumn(name="CUSTOS_INTERNAL_USER_ID"))
- @Column(name = "RACE")
- public List<String> getRaces() {
- return races;
- }
-
- public void setRaces(List<String> races) {
- this.races = races;
- }
-
- @ElementCollection
- @CollectionTable(name="NSF_DEMOGRAPHIC_DISABILITY", joinColumns = @JoinColumn(name="CUSTOS_INTERNAL_USER_ID"))
- @Column(name = "DISABILITY")
- public List<String> getDisabilities() {
- return disabilities;
- }
-
- public void setDisabilities(List<String> disabilities) {
- this.disabilities = disabilities;
- }
-
- @OneToOne(targetEntity = UserProfileEntity.class, cascade = CascadeType.ALL)
- @PrimaryKeyJoinColumn(name = "CUSTOS_INTERNAL_USER_ID", referencedColumnName = "CUSTOS_INTERNAL_USER_ID")
- public UserProfileEntity getUserProfile() {
- return userProfile;
- }
-
- public void setUserProfile(UserProfileEntity userProfile) {
- this.userProfile = userProfile;
- }
-
- @Override
- public String toString() {
- return "NSFDemographicsEntity{" +
- "custosInternalUserId='" + custosInternalUserId + '\'' +
- ", gender='" + gender + '\'' +
- ", ethnicities=" + ethnicities +
- ", races=" + races +
- ", disabilities=" + disabilities +
- '}';
- }
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/UserProfileEntity.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/UserProfileEntity.java
deleted file mode 100644
index 04f3265..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/user/entities/UserProfileEntity.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- *
- * 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.profile.commons.user.entities;
-
-import javax.persistence.*;
-import java.util.Date;
-import java.util.List;
-
-@Entity
-@Table(name="USER_PROFILE")
-public class UserProfileEntity {
- private String custosInternalUserId;
- private String userId;
- private String gatewayId;
- private String userModelVersion;
- private String firstName;
- private String lastName;
- private String middleName;
- private String namePrefix;
- private String nameSuffix;
- private String orcidId;
- private String country;
- private String homeOrganization;
- private String orginationAffiliation;
- private Date creationTime;
- private Date lastAccessTime;
- private Date validUntil;
- private String state;
- private String comments;
- private List<String> labeledURI;
- private String gpgKey;
- private String timeZone;
-
- private List<String> nationality;
- private List<String> emails;
- private List<String> phones;
- private NSFDemographicsEntity nsfDemographics;
- private CustomizedDashboardEntity customizedDashboardEntity;
-
- @Id
- @Column(name = "CUSTOS_INTERNAL_USER_ID")
- public String getCustosInternalUserId() {
- return custosInternalUserId;
- }
-
- public void setCustosInternalUserId(String id) {
- this.custosInternalUserId = id;
- }
-
- @Column(name = "USER_ID")
- public String getUserId() {
- return userId;
- }
-
- public void setUserId(String userId) {
- this.userId = userId;
- }
-
- @Column(name = "GATEWAY_ID")
- public String getGatewayId() {
- return gatewayId;
- }
-
- public void setGatewayId(String gatewayId) {
- this.gatewayId = gatewayId;
- }
-
- @Column(name = "USER_MODEL_VERSION")
- public String getUserModelVersion() {
- return userModelVersion;
- }
-
- public void setUserModelVersion(String userModelVersion) {
- this.userModelVersion = userModelVersion;
- }
-
- @ElementCollection(fetch = FetchType.EAGER)
- @CollectionTable(name="USER_PROFILE_EMAIL", joinColumns = @JoinColumn(name="CUSTOS_INTERNAL_USER_ID"))
- @Column(name = "EMAIL")
- public List<String> getEmails() {
- return emails;
- }
-
- public void setEmails(List<String> emails) {
- this.emails = emails;
- }
-
- @Column(name = "FIRST_NAME")
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- @Column(name = "LAST_NAME")
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- @Column(name = "MIDDLE_NAME")
- public String getMiddleName() {
- return middleName;
- }
-
- public void setMiddleName(String middleName) {
- this.middleName = middleName;
- }
-
- @Column(name = "NAME_PREFIX")
- public String getNamePrefix() {
- return namePrefix;
- }
-
- public void setNamePrefix(String namePrefix) {
- this.namePrefix = namePrefix;
- }
-
- @Column(name = "NAME_SUFFIX")
- public String getNameSuffix() {
- return nameSuffix;
- }
-
- public void setNameSuffix(String nameSuffix) {
- this.nameSuffix = nameSuffix;
- }
-
- @Column(name = "ORCID_ID")
- public String getOrcidId() {
- return orcidId;
- }
-
- public void setOrcidId(String orcidId) {
- this.orcidId = orcidId;
- }
-
- @ElementCollection(fetch = FetchType.EAGER)
- @CollectionTable(name="USER_PROFILE_PHONE", joinColumns = @JoinColumn(name="CUSTOS_INTERNAL_USER_ID"))
- @Column(name = "PHONE")
- public List<String> getPhones() {
- return phones;
- }
-
- public void setPhones(List<String> phones) {
- this.phones = phones;
- }
-
- @Column(name = "COUNTRY")
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- @ElementCollection(fetch = FetchType.EAGER)
- @CollectionTable(name="USER_PROFILE_NATIONALITY", joinColumns = @JoinColumn(name="CUSTOS_INTERNAL_USER_ID"))
- @Column(name = "NATIONALITY")
- public List<String> getNationality() {
- return nationality;
- }
-
- public void setNationality(List<String> nationality) {
- this.nationality = nationality;
- }
-
- @Column(name = "HOME_ORGANIZATION")
- public String getHomeOrganization() {
- return homeOrganization;
- }
-
- public void setHomeOrganization(String homeOrganization) {
- this.homeOrganization = homeOrganization;
- }
-
- @Column(name = "ORIGINATION_AFFILIATION")
- public String getOrginationAffiliation() {
- return orginationAffiliation;
- }
-
- public void setOrginationAffiliation(String orginationAffiliation) {
- this.orginationAffiliation = orginationAffiliation;
- }
-
- @Column(name="CREATION_TIME")
- public Date getCreationTime() {
- return creationTime;
- }
-
- private void setCreationTime(Date creationTime) {
- this.creationTime = creationTime;
- }
-
- @Column(name = "LAST_ACCESS_TIME")
- public Date getLastAccessTime() {
- return lastAccessTime;
- }
-
- private void setLastAccessTime(Date lastAccessTime) {
- this.lastAccessTime = lastAccessTime;
- }
-
- @Column(name = "VALID_UNTIL")
- public Date getValidUntil() {
- return validUntil;
- }
-
- public void setValidUntil(Date validUntil) {
- this.validUntil = validUntil;
- }
-
- @Column(name = "STATE")
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- @Lob
- @Column(name = "COMMENTS")
- public String getComments() {
- return comments;
- }
-
- public void setComments(String comments) {
- this.comments = comments;
- }
-
- @ElementCollection(fetch = FetchType.EAGER)
- @CollectionTable(name="USER_PROFILE_LABELED_URI", joinColumns = @JoinColumn(name="CUSTOS_INTERNAL_USER_ID"))
- @Column(name = "LABELED_URI")
- public List<String> getLabeledURI() {
- return labeledURI;
- }
-
- public void setLabeledURI(List<String> labeledURI) {
- this.labeledURI = labeledURI;
- }
-
- @Lob
- @Column(name = "GPG_KEY")
- public String getGpgKey() {
- return gpgKey;
- }
-
- public void setGpgKey(String gpgKey) {
- this.gpgKey = gpgKey;
- }
-
- @Column(name = "TIME_ZONE")
- public String getTimeZone() {
- return timeZone;
- }
-
- public void setTimeZone(String timeZone) {
- this.timeZone = timeZone;
- }
-
- @OneToOne(targetEntity = NSFDemographicsEntity.class, cascade = CascadeType.ALL,
- mappedBy = "userProfile", fetch = FetchType.EAGER)
- public NSFDemographicsEntity getNsfDemographics() {
- return nsfDemographics;
- }
-
- public void setNsfDemographics(NSFDemographicsEntity nsfDemographics) {
- this.nsfDemographics = nsfDemographics;
- }
-
- @OneToOne(targetEntity = CustomizedDashboardEntity.class, cascade = CascadeType.ALL,
- mappedBy = "userProfileEntity", fetch = FetchType.EAGER)
- public CustomizedDashboardEntity getCustomizedDashboardEntity() {
- return customizedDashboardEntity;
- }
-
- public void setCustomizedDashboardEntity(CustomizedDashboardEntity customizedDashboardEntity) {
- this.customizedDashboardEntity = customizedDashboardEntity;
- }
-
- @PrePersist
- void createdAt() {
- this.creationTime = this.lastAccessTime = new Date();
- }
-
- @PreUpdate
- void updatedAt() {
- this.lastAccessTime = new Date();
- }
-
- @Override
- public String toString() {
- return "UserProfileEntity{" +
- "custosInternalUserId='" + custosInternalUserId + '\'' +
- ", userId='" + userId + '\'' +
- ", gatewayId='" + gatewayId + '\'' +
- ", userModelVersion='" + userModelVersion + '\'' +
- ", firstName='" + firstName + '\'' +
- ", lastName='" + lastName + '\'' +
- ", middleName='" + middleName + '\'' +
- ", namePrefix='" + namePrefix + '\'' +
- ", nameSuffix='" + nameSuffix + '\'' +
- ", orcidId='" + orcidId + '\'' +
- ", country='" + country + '\'' +
- ", homeOrganization='" + homeOrganization + '\'' +
- ", orginationAffiliation='" + orginationAffiliation + '\'' +
- ", creationTime=" + creationTime +
- ", lastAccessTime=" + lastAccessTime +
- ", validUntil=" + validUntil +
- ", state='" + state + '\'' +
- ", comments='" + comments + '\'' +
- ", labeledURI=" + labeledURI +
- ", gpgKey='" + gpgKey + '\'' +
- ", timeZone='" + timeZone + '\'' +
- ", nationality=" + nationality +
- ", emails=" + emails +
- ", phones=" + phones +
- ", nsfDemographics=" + nsfDemographics +
- '}';
- }
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/Committer.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/Committer.java
deleted file mode 100644
index 5cf4ea3..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/Committer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * 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.profile.commons.utils;
-
-@FunctionalInterface
-public interface Committer<T, R> {
-
- R commit(T t);
-}
\ No newline at end of file
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/JPAConstants.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/JPAConstants.java
deleted file mode 100644
index 7d35b13..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/JPAConstants.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * 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.profile.commons.utils;
-
-public class JPAConstants {
- public static final String KEY_JDBC_URL = "profile.service.jdbc.url";
- public static final String KEY_JDBC_USER = "profile.service.jdbc.user";
- public static final String KEY_JDBC_PASSWORD = "profile.service.jdbc.password";
- public static final String KEY_JDBC_DRIVER = "profile.service.jdbc.driver";
-
- // TODO: is this needed?
- public static final String KEY_DERBY_START_ENABLE = "profile.service.start.derby.server.mode";
- public static final String VALIDATION_QUERY = "profile.service.validationQuery";
- public static final String JPA_CACHE_SIZE = "profile.service.jpa.cache.size";
- public static final String ENABLE_CACHING = "profile.service.cache.enable";
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/JPAUtils.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/JPAUtils.java
deleted file mode 100644
index 2b881eb..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/JPAUtils.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * 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.profile.commons.utils;
-
-import org.apache.custos.commons.utils.JDBCConfig;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-
-public class JPAUtils {
- private static final String PERSISTENCE_UNIT_NAME = "profile_service";
- private static final JDBCConfig JDBC_CONFIG = new ProfileServiceJDBCConfig();
- private static final EntityManagerFactory factory = org.apache.custos.commons.utils.JPAUtils.getEntityManagerFactory(PERSISTENCE_UNIT_NAME, JDBC_CONFIG);
-
- public static EntityManager getEntityManager() {
- return factory.createEntityManager();
- }
-
- public static <R> R execute(Committer<EntityManager, R> committer){
- EntityManager entityManager = JPAUtils.getEntityManager();
- try {
- entityManager.getTransaction().begin();
- R r = committer.commit(entityManager);
- entityManager.getTransaction().commit();
- return r;
- }finally {
- if (entityManager != null && entityManager.isOpen()) {
- if (entityManager.getTransaction().isActive()) {
- entityManager.getTransaction().rollback();
- }
- entityManager.close();
- }
- }
- }
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/ObjectMapperSingleton.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/ObjectMapperSingleton.java
deleted file mode 100644
index b012b17..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/ObjectMapperSingleton.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- * 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.profile.commons.utils;
-
-import org.dozer.DozerBeanMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ObjectMapperSingleton extends DozerBeanMapper{
- private final static Logger logger = LoggerFactory.getLogger(ObjectMapperSingleton.class);
-
- private static ObjectMapperSingleton instance;
-
- private ObjectMapperSingleton(){}
-
- public static ObjectMapperSingleton getInstance(){
- if(instance == null)
- instance = new ObjectMapperSingleton();
- return instance;
- }
-}
\ No newline at end of file
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/ProfileServiceJDBCConfig.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/ProfileServiceJDBCConfig.java
deleted file mode 100644
index 84a1f66..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/ProfileServiceJDBCConfig.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * 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.profile.commons.utils;
-
-import org.apache.custos.commons.utils.JDBCConfig;
-
-public class ProfileServiceJDBCConfig implements JDBCConfig {
-
- @Override
- public String getURL() {
- return Utils.getJDBCURL();
- }
-
- @Override
- public String getDriver() {
- return Utils.getJDBCDriver();
- }
-
- @Override
- public String getUser() {
- return Utils.getJDBCUser();
- }
-
- @Override
- public String getPassword() {
- return Utils.getJDBCPassword();
- }
-
- @Override
- public String getValidationQuery() {
- return Utils.getValidationQuery();
- }
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/QueryConstants.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/QueryConstants.java
deleted file mode 100644
index 15cc267..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/QueryConstants.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.apache.custos.profile.commons.utils;
-
-import org.apache.custos.profile.model.user.UserProfile;
-import org.apache.custos.profile.model.workspace.Gateway;
-
-/**
- * Created by goshenoy on 03/08/2017.
- */
-public class QueryConstants {
-
-
- public static final String FIND_USER_PROFILE_BY_USER_ID = "SELECT u FROM UserProfileEntity u " +
- "where u.userId LIKE :" + UserProfile._Fields.USER_ID.getFieldName() + " " +
- "AND u.gatewayId LIKE :" + UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
-
- public static final String FIND_ALL_USER_PROFILES_BY_GATEWAY_ID = "SELECT u FROM UserProfileEntity u " +
- "where u.gatewayId LIKE :" + UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
-
- public static final String FIND_GATEWAY_BY_INTERNAL_ID = "SELECT g FROM GatewayEntity g " +
- "where g.custosInternalGatewayId LIKE :" + Gateway._Fields.CUSTOS_INTERNAL_GATEWAY_ID.getFieldName();
-
- public static final String FIND_GATEWAY_BY_GATEWAY_ID = "SELECT g FROM GatewayEntity g " +
- "where g.gatewayId LIKE :" + Gateway._Fields.GATEWAY_ID.getFieldName();
-
- public static final String FIND_DUPLICATE_GATEWAY = "SELECT g FROM GatewayEntity g " +
- "where g.gatewayApprovalStatus IN :" + Gateway._Fields.GATEWAY_APPROVAL_STATUS.getFieldName() + " " +
- "and (g.gatewayId LIKE :" + Gateway._Fields.GATEWAY_ID.getFieldName() + " " +
- " or g.gatewayName LIKE :" + Gateway._Fields.GATEWAY_NAME.getFieldName() + " " +
- " or g.gatewayUrl LIKE :" + Gateway._Fields.GATEWAY_URL.getFieldName() + " " +
- " )";
-
- public static final String GET_ALL_GATEWAYS = "SELECT g FROM GatewayEntity g";
-
- public static final String GET_USER_GATEWAYS = "SELECT g from GatewayEntity g " +
- "where g.requesterUsername LIKE :" + Gateway._Fields.REQUESTER_USERNAME.getFieldName() + "";
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/Utils.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/Utils.java
deleted file mode 100644
index b3ddd31..0000000
--- a/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/utils/Utils.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *
- * 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.profile.commons.utils;
-
-import org.apache.custos.commons.exceptions.ApplicationSettingsException;
-import org.apache.custos.commons.utils.ServerSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.URI;
-
-
-public class Utils {
- private final static Logger logger = LoggerFactory.getLogger(Utils.class);
-
- public static String getJDBCURL(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_URL);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getHost(){
- try{
- String jdbcURL = getJDBCURL();
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getHost();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static int getPort(){
- try{
- String jdbcURL = getJDBCURL();
- String cleanURI = jdbcURL.substring(5);
- URI uri = URI.create(cleanURI);
- return uri.getPort();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- return -1;
- }
- }
-
- public static int getJPACacheSize (){
- try {
- String cache = ServerSettings.getSetting(JPAConstants.JPA_CACHE_SIZE, "5000");
- return Integer.parseInt(cache);
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- return -1;
- }
- }
-
- public static String isCachingEnabled (){
- try {
- return ServerSettings.getSetting(JPAConstants.ENABLE_CACHING, "true");
- }catch (Exception e){
- logger.error(e.getMessage(), e);
- return "true";
- }
- }
-
- public static String getJDBCUser(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_USER);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getValidationQuery(){
- try {
- return ServerSettings.getSetting(JPAConstants.VALIDATION_QUERY);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- public static String getJDBCPassword(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_PASSWORD);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
-
- }
-
- public static String getJDBCDriver(){
- try {
- return ServerSettings.getSetting(JPAConstants.KEY_JDBC_DRIVER);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-}
diff --git a/custos-profile-service/profile-service-commons/src/main/resources/META-INF/persistence.xml b/custos-profile-service/profile-service-commons/src/main/resources/META-INF/persistence.xml
deleted file mode 100644
index f0a162e..0000000
--- a/custos-profile-service/profile-service-commons/src/main/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--*
- *
- * 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.
- *
-* -->
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
- <persistence-unit name="profile_service">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.custos.profile.commons.user.entities.UserProfileEntity</class>
- <class>org.apache.custos.profile.commons.user.entities.NSFDemographicsEntity</class>
- <class>org.apache.custos.profile.commons.user.entities.CustomizedDashboardEntity</class>
- <class>org.apache.custos.profile.commons.tenant.entities.GatewayEntity</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
-
- <properties>
- <property name="openjpa.jdbc.MappingDefaults"
- value="ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=cascade" />
- </properties>
- </persistence-unit>
-</persistence>
diff --git a/custos-profile-service/profile-service-model/pom.xml b/custos-profile-service/profile-service-model/pom.xml
deleted file mode 100644
index dcae7be..0000000
--- a/custos-profile-service/profile-service-model/pom.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>profile-service</artifactId>
- <groupId>org.apache.custos</groupId>
- <version>1.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
... 62691 lines suppressed ...