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/08/27 06:15:44 UTC
[airavata-custos] 24/30: refactored tenant profile and iam admin
services service
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 d2686411d8fc7053d2faa48a489e69dbb756e0fe
Author: Aarushi <aa...@gmail.com>
AuthorDate: Thu Aug 15 13:47:42 2019 -0400
refactored tenant profile and iam admin services service
---
.../{cpi => }/CustosAuthenticationService.java | 238 +---
.../cpi/CustosAuthenticationService.java | 236 +---
.../CustosAuthenticationServiceException.java | 2 +-
.../handler/CustosAuthenticationHandler.java | 4 +-
custos-connectors/pom.xml | 5 +
.../manager/CustosSecurityManager.java | 2 +-
.../manager/KeyCloakSecurityManager.java | 27 +-
.../services/core/TenantManagementInterface.java | 10 +
.../core/TenantManagementKeycloakImpl.java | 30 +
.../iam/admin/services/cpi/IamAdminServices.java | 1255 ++++++++++++++++++--
.../services/handler/IamAdminServicesHandler.java | 34 +-
.../repositories}/TenantProfileRepository.java | 19 +-
.../repositories/UserProfileRepository.java | 3 +-
.../profile/tenant/client/TenantProfileClient.java | 26 +
.../profile/tenant/cpi/TenantProfileService.java | 1109 ++++++++++++++++-
.../handler/TenantProfileServiceHandler.java | 19 +-
.../profile/user/client/UserProfileClient.java | 4 +
.../profile/user/cpi/UserProfileService.java | 470 +-------
.../user/handler/UserProfileServiceHandler.java | 16 +-
.../authentication-service-cpi.thrift | 2 +-
.../iam-admin-services-cpi.thrift | 6 +-
.../profile-tenant/profile-tenant-cpi.thrift | 4 +
.../profile-user/profile-user-cpi.thrift | 8 +-
23 files changed, 2525 insertions(+), 1004 deletions(-)
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/CustosAuthenticationService.java
similarity index 92%
copy from custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java
copy to custos-authentication/src/main/java/org/apache/custos/authentication/CustosAuthenticationService.java
index 396506a..9f9baca 100644
--- a/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/CustosAuthenticationService.java
@@ -4,10 +4,10 @@
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
-package org.apache.custos.authentication.cpi;
+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")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-15")
public class CustosAuthenticationService {
public interface Iface {
@@ -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, String clientId, String clientSecret) 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;
}
@@ -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, String clientId, String clientSecret, 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, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException;
}
@@ -102,19 +102,17 @@ 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, String clientId, String clientSecret) 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
{
- send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId, clientId, clientSecret);
+ send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
return recv_getUserManagementServiceAccountAuthzToken();
}
- public void send_getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws org.apache.thrift.TException
+ 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);
- args.setClientId(clientId);
- args.setClientSecret(clientSecret);
sendBase("getUserManagementServiceAccountAuthzToken", args);
}
@@ -213,9 +211,9 @@ public class CustosAuthenticationService {
}
}
- 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 {
+ 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, clientId, clientSecret, resultHandler, this, ___protocolFactory, ___transport);
+ getUserManagementServiceAccountAuthzToken_call method_call = new getUserManagementServiceAccountAuthzToken_call(authzToken, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -223,14 +221,10 @@ 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;
- 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 {
+ 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;
- this.clientId = clientId;
- this.clientSecret = clientSecret;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -238,8 +232,6 @@ 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();
}
@@ -353,7 +345,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, args.clientId, args.clientSecret);
+ result.success = iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId);
} catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
result.ae = ae;
}
@@ -572,7 +564,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, args.clientId, args.clientSecret,resultHandler);
+ iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId,resultHandler);
}
}
@@ -2263,23 +2255,17 @@ 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"),
- CLIENT_ID((short)3, "clientId"),
- CLIENT_SECRET((short)4, "clientSecret");
+ GATEWAY_ID((short)2, "gatewayId");
private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
@@ -2299,10 +2285,6 @@ 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;
}
@@ -2351,10 +2333,6 @@ public class CustosAuthenticationService {
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);
}
@@ -2364,15 +2342,11 @@ public class CustosAuthenticationService {
public getUserManagementServiceAccountAuthzToken_args(
org.apache.custos.commons.model.security.AuthzToken authzToken,
- String gatewayId,
- String clientId,
- String clientSecret)
+ String gatewayId)
{
this();
this.authzToken = authzToken;
this.gatewayId = gatewayId;
- this.clientId = clientId;
- this.clientSecret = clientSecret;
}
/**
@@ -2385,12 +2359,6 @@ 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() {
@@ -2401,8 +2369,6 @@ public class CustosAuthenticationService {
public void clear() {
this.authzToken = null;
this.gatewayId = null;
- this.clientId = null;
- this.clientSecret = null;
}
@org.apache.thrift.annotation.Nullable
@@ -2455,56 +2421,6 @@ 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:
@@ -2523,22 +2439,6 @@ public class CustosAuthenticationService {
}
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;
-
}
}
@@ -2551,12 +2451,6 @@ public class CustosAuthenticationService {
case GATEWAY_ID:
return getGatewayId();
- case CLIENT_ID:
- return getClientId();
-
- case CLIENT_SECRET:
- return getClientSecret();
-
}
throw new IllegalStateException();
}
@@ -2572,10 +2466,6 @@ public class CustosAuthenticationService {
return isSetAuthzToken();
case GATEWAY_ID:
return isSetGatewayId();
- case CLIENT_ID:
- return isSetClientId();
- case CLIENT_SECRET:
- return isSetClientSecret();
}
throw new IllegalStateException();
}
@@ -2613,24 +2503,6 @@ 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;
}
@@ -2646,14 +2518,6 @@ 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;
}
@@ -2685,26 +2549,6 @@ 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;
}
@@ -2741,22 +2585,6 @@ 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();
}
@@ -2769,12 +2597,6 @@ 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();
@@ -2832,22 +2654,6 @@ public class CustosAuthenticationService {
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;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -2873,16 +2679,6 @@ 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();
}
@@ -2902,8 +2698,6 @@ 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
@@ -2914,10 +2708,6 @@ 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);
}
}
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 396506a..e6842d8 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
@@ -7,7 +7,7 @@
package org.apache.custos.authentication.cpi;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-08")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-15")
public class CustosAuthenticationService {
public interface Iface {
@@ -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, String clientId, String clientSecret) 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;
}
@@ -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, String clientId, String clientSecret, 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, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException;
}
@@ -102,19 +102,17 @@ 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, String clientId, String clientSecret) 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
{
- send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId, clientId, clientSecret);
+ send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
return recv_getUserManagementServiceAccountAuthzToken();
}
- public void send_getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws org.apache.thrift.TException
+ 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);
- args.setClientId(clientId);
- args.setClientSecret(clientSecret);
sendBase("getUserManagementServiceAccountAuthzToken", args);
}
@@ -213,9 +211,9 @@ public class CustosAuthenticationService {
}
}
- 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 {
+ 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, clientId, clientSecret, resultHandler, this, ___protocolFactory, ___transport);
+ getUserManagementServiceAccountAuthzToken_call method_call = new getUserManagementServiceAccountAuthzToken_call(authzToken, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -223,14 +221,10 @@ 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;
- 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 {
+ 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;
- this.clientId = clientId;
- this.clientSecret = clientSecret;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -238,8 +232,6 @@ 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();
}
@@ -353,7 +345,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, args.clientId, args.clientSecret);
+ result.success = iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId);
} catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
result.ae = ae;
}
@@ -572,7 +564,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, args.clientId, args.clientSecret,resultHandler);
+ iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId,resultHandler);
}
}
@@ -2263,23 +2255,17 @@ 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"),
- CLIENT_ID((short)3, "clientId"),
- CLIENT_SECRET((short)4, "clientSecret");
+ GATEWAY_ID((short)2, "gatewayId");
private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
@@ -2299,10 +2285,6 @@ 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;
}
@@ -2351,10 +2333,6 @@ public class CustosAuthenticationService {
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);
}
@@ -2364,15 +2342,11 @@ public class CustosAuthenticationService {
public getUserManagementServiceAccountAuthzToken_args(
org.apache.custos.commons.model.security.AuthzToken authzToken,
- String gatewayId,
- String clientId,
- String clientSecret)
+ String gatewayId)
{
this();
this.authzToken = authzToken;
this.gatewayId = gatewayId;
- this.clientId = clientId;
- this.clientSecret = clientSecret;
}
/**
@@ -2385,12 +2359,6 @@ 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() {
@@ -2401,8 +2369,6 @@ public class CustosAuthenticationService {
public void clear() {
this.authzToken = null;
this.gatewayId = null;
- this.clientId = null;
- this.clientSecret = null;
}
@org.apache.thrift.annotation.Nullable
@@ -2455,56 +2421,6 @@ 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:
@@ -2523,22 +2439,6 @@ public class CustosAuthenticationService {
}
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;
-
}
}
@@ -2551,12 +2451,6 @@ public class CustosAuthenticationService {
case GATEWAY_ID:
return getGatewayId();
- case CLIENT_ID:
- return getClientId();
-
- case CLIENT_SECRET:
- return getClientSecret();
-
}
throw new IllegalStateException();
}
@@ -2572,10 +2466,6 @@ public class CustosAuthenticationService {
return isSetAuthzToken();
case GATEWAY_ID:
return isSetGatewayId();
- case CLIENT_ID:
- return isSetClientId();
- case CLIENT_SECRET:
- return isSetClientSecret();
}
throw new IllegalStateException();
}
@@ -2613,24 +2503,6 @@ 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;
}
@@ -2646,14 +2518,6 @@ 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;
}
@@ -2685,26 +2549,6 @@ 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;
}
@@ -2741,22 +2585,6 @@ 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();
}
@@ -2769,12 +2597,6 @@ 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();
@@ -2832,22 +2654,6 @@ public class CustosAuthenticationService {
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;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -2873,16 +2679,6 @@ 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();
}
@@ -2902,8 +2698,6 @@ 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
@@ -2914,10 +2708,6 @@ 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);
}
}
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/exception/CustosAuthenticationServiceException.java b/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/exception/CustosAuthenticationServiceException.java
index 571f176..ad96056 100644
--- a/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/exception/CustosAuthenticationServiceException.java
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/exception/CustosAuthenticationServiceException.java
@@ -7,7 +7,7 @@
package org.apache.custos.authentication.cpi.exception;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-07")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-15")
public class CustosAuthenticationServiceException extends org.apache.thrift.TException implements org.apache.thrift.TBase<CustosAuthenticationServiceException, CustosAuthenticationServiceException._Fields>, java.io.Serializable, Cloneable, Comparable<CustosAuthenticationServiceException> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CustosAuthenticationServiceException");
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 0a2f43c..8a7de8c 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
@@ -42,10 +42,10 @@ public class CustosAuthenticationHandler implements CustosAuthenticationService.
}
}
@Override
- public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId, String clientId, String clientSecret) throws CustosAuthenticationServiceException {
+ public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) throws CustosAuthenticationServiceException {
try{
CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
- return securityManager.getUserManagementServiceAccountAuthzToken(authzToken, gatewayId, clientId, clientSecret);
+ return securityManager.getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
}catch (CustosSecurityException e){
logger.error(e.getMessage(), e);
throw new CustosAuthenticationServiceException("Could get user management account authz token");
diff --git a/custos-connectors/pom.xml b/custos-connectors/pom.xml
index aa5f07c..44afda6 100644
--- a/custos-connectors/pom.xml
+++ b/custos-connectors/pom.xml
@@ -76,6 +76,11 @@
<artifactId>keycloak-admin-client</artifactId>
<version>2.5.5.Final</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.custos</groupId>
+ <artifactId>tenant-profile-service</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
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 c18b8bc..4fbcc5d 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, String clientId, String clientSecret) throws CustosSecurityException;
+ public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) 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 3550f4f..e7f8b30 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
@@ -26,6 +26,9 @@ import org.apache.custos.commons.model.security.AuthzToken;
import org.apache.custos.commons.model.security.UserInfo;
import org.apache.custos.commons.utils.Constants;
import org.apache.custos.commons.utils.ServerSettings;
+import org.apache.custos.profile.model.workspace.Gateway;
+import org.apache.custos.profile.tenant.client.TenantProfileClient;
+import org.apache.custos.profile.tenant.cpi.TenantProfileService;
import org.apache.custos.security.authzcache.*;
import org.apache.custos.security.utils.TrustStoreManager;
import org.apache.http.Consts;
@@ -38,6 +41,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
+import org.apache.thrift.TException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,10 +58,12 @@ import java.util.List;
public class KeyCloakSecurityManager implements CustosSecurityManager {
private final static Logger logger = LoggerFactory.getLogger(KeyCloakSecurityManager.class);
+ private static TenantProfileService.Client tenantProfileClient;
public KeyCloakSecurityManager() throws CustosSecurityException {
initializeSecurityInfra();
}
+
/**
* Implement this method in your SecurityManager to perform necessary initializations at the server startup.
*
@@ -128,16 +134,18 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
throw new CustosSecurityException(e.getMessage(), e);
}
}
- //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, String clientId, String clientSecret) throws CustosSecurityException {
+ public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) throws CustosSecurityException {
try {
+ tenantProfileClient = getTenantProfileServiceClient();
+ Gateway gateway = tenantProfileClient.getGatewayUsingGatewayId(authzToken, gatewayId);
String tokenURL = getTokenEndpoint(gatewayId);
- JSONObject clientCredentials = getClientCredentials(tokenURL, clientId, clientSecret);
+ JSONObject clientCredentials = getClientCredentials(tokenURL, gateway.getOauthClientId(), gateway.getOauthClientSecret());
String accessToken = clientCredentials.getString("access_token");
AuthzToken userManagementServiceAccountAuthzToken = new AuthzToken(accessToken);
userManagementServiceAccountAuthzToken.putToClaimsMap(Constants.GATEWAY_ID, gatewayId);
- userManagementServiceAccountAuthzToken.putToClaimsMap(Constants.USER_NAME, clientId);
+ userManagementServiceAccountAuthzToken.putToClaimsMap(Constants.USER_NAME, gateway.getOauthClientId());
return userManagementServiceAccountAuthzToken;
} catch (Exception e) {
throw new CustosSecurityException(e);
@@ -237,4 +245,15 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
}
}
}
+ private TenantProfileService.Client getTenantProfileServiceClient() throws Exception {
+
+ try {
+ String serverHost = ServerSettings.getProfileServiceServerHost();
+ String serverPort = ServerSettings.getProfileServiceServerPort();
+ TenantProfileService.Client client = TenantProfileClient.createCustosTenantProfileServiceClient(serverHost, Integer.parseInt(serverPort));
+ return client;
+ } catch (ApplicationSettingsException | TException e) {
+ throw new Exception("Could not create tenant profile client", e);
+ }
+ }
}
diff --git a/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/core/TenantManagementInterface.java b/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/core/TenantManagementInterface.java
index fdd18de..8ee3af3 100644
--- a/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/core/TenantManagementInterface.java
+++ b/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/core/TenantManagementInterface.java
@@ -167,6 +167,16 @@ public interface TenantManagementInterface {
void updateUserProfile(String accessToken, String tenantId, String username, UserProfile userDetails) throws IamAdminServicesException;
/**
+ * Delete this user from the IAM service.
+ * @param accessToken
+ * @param tenantId
+ * @param username
+ * @return
+ * @throws IamAdminServicesException
+ */
+ boolean deleteUser(String accessToken, String tenantId, String username) throws IamAdminServicesException;
+
+ /**
* Add the given role to the user.
*
* @param realmAdminCreds
diff --git a/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/core/TenantManagementKeycloakImpl.java b/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/core/TenantManagementKeycloakImpl.java
index efc82c2..0a8efa2 100644
--- a/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/core/TenantManagementKeycloakImpl.java
+++ b/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/core/TenantManagementKeycloakImpl.java
@@ -618,6 +618,36 @@ public class TenantManagementKeycloakImpl implements TenantManagementInterface {
}
@Override
+ public boolean deleteUser(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);
+ if(userRepresentation != null)
+ {
+ client.realm(tenantId).users().delete(userRepresentation.getId());
+ return true;
+ }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 deleting user in keycloak server, reason: " + ex.getMessage(), ex);
+ IamAdminServicesException exception = new IamAdminServicesException();
+ exception.setMessage("Error deleting user 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;
diff --git a/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/cpi/IamAdminServices.java b/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/cpi/IamAdminServices.java
index d994d84..7a7e796 100644
--- a/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/cpi/IamAdminServices.java
+++ b/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/cpi/IamAdminServices.java
@@ -7,7 +7,7 @@
package org.apache.custos.profile.iam.admin.services.cpi;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-10")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-15")
public class IamAdminServices {
public interface Iface {
@@ -20,7 +20,9 @@ public class IamAdminServices {
public boolean registerUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, String emailAddress, String firstName, String lastName, String newPassword) throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException;
- public boolean enableUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username) throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException;
+ public boolean deleteUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username) throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException;
+
+ public org.apache.custos.profile.model.user.UserProfile enableUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username) throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException;
public boolean isUserEnabled(org.apache.custos.commons.model.security.AuthzToken authzToken, String username) throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException;
@@ -54,7 +56,9 @@ public class IamAdminServices {
public void registerUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, String emailAddress, String firstName, String lastName, String newPassword, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException;
- public void enableUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException;
+ public void deleteUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException;
+
+ public void enableUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException;
public void isUserEnabled(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException;
@@ -209,7 +213,34 @@ public class IamAdminServices {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "registerUser failed: unknown result");
}
- public boolean enableUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username) throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException
+ public boolean deleteUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username) throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException
+ {
+ send_deleteUser(authzToken, username);
+ return recv_deleteUser();
+ }
+
+ public void send_deleteUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username) throws org.apache.thrift.TException
+ {
+ deleteUser_args args = new deleteUser_args();
+ args.setAuthzToken(authzToken);
+ args.setUsername(username);
+ sendBase("deleteUser", args);
+ }
+
+ public boolean recv_deleteUser() throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException
+ {
+ deleteUser_result result = new deleteUser_result();
+ receiveBase(result, "deleteUser");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.Idse != null) {
+ throw result.Idse;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "deleteUser failed: unknown result");
+ }
+
+ public org.apache.custos.profile.model.user.UserProfile enableUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username) throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException
{
send_enableUser(authzToken, username);
return recv_enableUser();
@@ -223,7 +254,7 @@ public class IamAdminServices {
sendBase("enableUser", args);
}
- public boolean recv_enableUser() throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException
+ public org.apache.custos.profile.model.user.UserProfile recv_enableUser() throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException
{
enableUser_result result = new enableUser_result();
receiveBase(result, "enableUser");
@@ -679,17 +710,52 @@ public class IamAdminServices {
}
}
- public void enableUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
+ public void deleteUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ deleteUser_call method_call = new deleteUser_call(authzToken, username, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class deleteUser_call extends org.apache.thrift.async.TAsyncMethodCall<Boolean> {
+ private org.apache.custos.commons.model.security.AuthzToken authzToken;
+ private String username;
+ public deleteUser_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, 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;
+ this.username = username;
+ }
+
+ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+ prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("deleteUser", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ deleteUser_args args = new deleteUser_args();
+ args.setAuthzToken(authzToken);
+ args.setUsername(username);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public Boolean getResult() throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, 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_deleteUser();
+ }
+ }
+
+ public void enableUser(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException {
checkReady();
enableUser_call method_call = new enableUser_call(authzToken, username, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
- public static class enableUser_call extends org.apache.thrift.async.TAsyncMethodCall<Boolean> {
+ public static class enableUser_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.profile.model.user.UserProfile> {
private org.apache.custos.commons.model.security.AuthzToken authzToken;
private String username;
- public enableUser_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, 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 {
+ public enableUser_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String username, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> 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.username = username;
@@ -704,7 +770,7 @@ public class IamAdminServices {
prot.writeMessageEnd();
}
- public Boolean getResult() throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException {
+ public org.apache.custos.profile.model.user.UserProfile getResult() throws org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException, org.apache.thrift.TException {
if (getState() != State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -1108,6 +1174,7 @@ public class IamAdminServices {
processMap.put("setUpGateway", new setUpGateway());
processMap.put("isUsernameAvailable", new isUsernameAvailable());
processMap.put("registerUser", new registerUser());
+ processMap.put("deleteUser", new deleteUser());
processMap.put("enableUser", new enableUser());
processMap.put("isUserEnabled", new isUserEnabled());
processMap.put("isUserExist", new isUserExist());
@@ -1240,6 +1307,36 @@ public class IamAdminServices {
}
}
+ public static class deleteUser<I extends Iface> extends org.apache.thrift.ProcessFunction<I, deleteUser_args> {
+ public deleteUser() {
+ super("deleteUser");
+ }
+
+ public deleteUser_args getEmptyArgsInstance() {
+ return new deleteUser_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ @Override
+ protected boolean rethrowUnhandledExceptions() {
+ return false;
+ }
+
+ public deleteUser_result getResult(I iface, deleteUser_args args) throws org.apache.thrift.TException {
+ deleteUser_result result = new deleteUser_result();
+ try {
+ result.success = iface.deleteUser(args.authzToken, args.username);
+ result.setSuccessIsSet(true);
+ } catch (org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse) {
+ result.Idse = Idse;
+ }
+ return result;
+ }
+ }
+
public static class enableUser<I extends Iface> extends org.apache.thrift.ProcessFunction<I, enableUser_args> {
public enableUser() {
super("enableUser");
@@ -1262,7 +1359,6 @@ public class IamAdminServices {
enableUser_result result = new enableUser_result();
try {
result.success = iface.enableUser(args.authzToken, args.username);
- result.setSuccessIsSet(true);
} catch (org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse) {
result.Idse = Idse;
}
@@ -1582,6 +1678,7 @@ public class IamAdminServices {
processMap.put("setUpGateway", new setUpGateway());
processMap.put("isUsernameAvailable", new isUsernameAvailable());
processMap.put("registerUser", new registerUser());
+ processMap.put("deleteUser", new deleteUser());
processMap.put("enableUser", new enableUser());
processMap.put("isUserEnabled", new isUserEnabled());
processMap.put("isUserExist", new isUserExist());
@@ -1858,7 +1955,73 @@ public class IamAdminServices {
}
}
- public static class enableUser<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, enableUser_args, Boolean> {
+ public static class deleteUser<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, deleteUser_args, Boolean> {
+ public deleteUser() {
+ super("deleteUser");
+ }
+
+ public deleteUser_args getEmptyArgsInstance() {
+ return new deleteUser_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) {
+ deleteUser_result result = new deleteUser_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;
+ deleteUser_result result = new deleteUser_result();
+ if (e instanceof org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException) {
+ result.Idse = (org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException) e;
+ result.setIdseIsSet(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, deleteUser_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
+ iface.deleteUser(args.authzToken, args.username,resultHandler);
+ }
+ }
+
+ public static class enableUser<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, enableUser_args, org.apache.custos.profile.model.user.UserProfile> {
public enableUser() {
super("enableUser");
}
@@ -1867,13 +2030,12 @@ public class IamAdminServices {
return new enableUser_args();
}
- public org.apache.thrift.async.AsyncMethodCallback<Boolean> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+ public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> 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) {
+ return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile>() {
+ public void onComplete(org.apache.custos.profile.model.user.UserProfile o) {
enableUser_result result = new enableUser_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) {
@@ -1919,7 +2081,7 @@ public class IamAdminServices {
return false;
}
- public void start(I iface, enableUser_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
+ public void start(I iface, enableUser_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException {
iface.enableUser(args.authzToken, args.username,resultHandler);
}
}
@@ -6642,14 +6804,14 @@ public class IamAdminServices {
}
}
- public static class enableUser_args implements org.apache.thrift.TBase<enableUser_args, enableUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<enableUser_args> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("enableUser_args");
+ public static class deleteUser_args implements org.apache.thrift.TBase<deleteUser_args, deleteUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<deleteUser_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("deleteUser_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 USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new enableUser_argsStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new enableUser_argsTupleSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new deleteUser_argsStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new deleteUser_argsTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
public @org.apache.thrift.annotation.Nullable String username; // required
@@ -6726,13 +6888,13 @@ public class IamAdminServices {
tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", 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(enableUser_args.class, metaDataMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(deleteUser_args.class, metaDataMap);
}
- public enableUser_args() {
+ public deleteUser_args() {
}
- public enableUser_args(
+ public deleteUser_args(
org.apache.custos.commons.model.security.AuthzToken authzToken,
String username)
{
@@ -6744,7 +6906,7 @@ public class IamAdminServices {
/**
* Performs a deep copy on <i>other</i>.
*/
- public enableUser_args(enableUser_args other) {
+ public deleteUser_args(deleteUser_args other) {
if (other.isSetAuthzToken()) {
this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
}
@@ -6753,8 +6915,8 @@ public class IamAdminServices {
}
}
- public enableUser_args deepCopy() {
- return new enableUser_args(this);
+ public deleteUser_args deepCopy() {
+ return new deleteUser_args(this);
}
@Override
@@ -6768,7 +6930,7 @@ public class IamAdminServices {
return this.authzToken;
}
- public enableUser_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
+ public deleteUser_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
this.authzToken = authzToken;
return this;
}
@@ -6793,7 +6955,7 @@ public class IamAdminServices {
return this.username;
}
- public enableUser_args setUsername(@org.apache.thrift.annotation.Nullable String username) {
+ public deleteUser_args setUsername(@org.apache.thrift.annotation.Nullable String username) {
this.username = username;
return this;
}
@@ -6866,12 +7028,12 @@ public class IamAdminServices {
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof enableUser_args)
- return this.equals((enableUser_args)that);
+ if (that instanceof deleteUser_args)
+ return this.equals((deleteUser_args)that);
return false;
}
- public boolean equals(enableUser_args that) {
+ public boolean equals(deleteUser_args that) {
if (that == null)
return false;
if (this == that)
@@ -6914,7 +7076,7 @@ public class IamAdminServices {
}
@Override
- public int compareTo(enableUser_args other) {
+ public int compareTo(deleteUser_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
@@ -6959,7 +7121,7 @@ public class IamAdminServices {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("enableUser_args(");
+ StringBuilder sb = new StringBuilder("deleteUser_args(");
boolean first = true;
sb.append("authzToken:");
@@ -7011,15 +7173,15 @@ public class IamAdminServices {
}
}
- private static class enableUser_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public enableUser_argsStandardScheme getScheme() {
- return new enableUser_argsStandardScheme();
+ private static class deleteUser_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public deleteUser_argsStandardScheme getScheme() {
+ return new deleteUser_argsStandardScheme();
}
}
- private static class enableUser_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<enableUser_args> {
+ private static class deleteUser_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<deleteUser_args> {
- public void read(org.apache.thrift.protocol.TProtocol iprot, enableUser_args struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol iprot, deleteUser_args struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
@@ -7057,7 +7219,7 @@ public class IamAdminServices {
struct.validate();
}
- public void write(org.apache.thrift.protocol.TProtocol oprot, enableUser_args struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol oprot, deleteUser_args struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
@@ -7077,23 +7239,23 @@ public class IamAdminServices {
}
- private static class enableUser_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public enableUser_argsTupleScheme getScheme() {
- return new enableUser_argsTupleScheme();
+ private static class deleteUser_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public deleteUser_argsTupleScheme getScheme() {
+ return new deleteUser_argsTupleScheme();
}
}
- private static class enableUser_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<enableUser_args> {
+ private static class deleteUser_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<deleteUser_args> {
@Override
- public void write(org.apache.thrift.protocol.TProtocol prot, enableUser_args struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol prot, deleteUser_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.username);
}
@Override
- public void read(org.apache.thrift.protocol.TProtocol prot, enableUser_args struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol prot, deleteUser_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);
@@ -7108,14 +7270,14 @@ public class IamAdminServices {
}
}
- public static class enableUser_result implements org.apache.thrift.TBase<enableUser_result, enableUser_result._Fields>, java.io.Serializable, Cloneable, Comparable<enableUser_result> {
- private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("enableUser_result");
+ public static class deleteUser_result implements org.apache.thrift.TBase<deleteUser_result, deleteUser_result._Fields>, java.io.Serializable, Cloneable, Comparable<deleteUser_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("deleteUser_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 IDSE_FIELD_DESC = new org.apache.thrift.protocol.TField("Idse", org.apache.thrift.protocol.TType.STRUCT, (short)1);
- private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new enableUser_resultStandardSchemeFactory();
- private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new enableUser_resultTupleSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new deleteUser_resultStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new deleteUser_resultTupleSchemeFactory();
public boolean success; // required
public @org.apache.thrift.annotation.Nullable org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse; // required
@@ -7194,13 +7356,13 @@ public class IamAdminServices {
tmpMap.put(_Fields.IDSE, new org.apache.thrift.meta_data.FieldMetaData("Idse", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
- org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(enableUser_result.class, metaDataMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(deleteUser_result.class, metaDataMap);
}
- public enableUser_result() {
+ public deleteUser_result() {
}
- public enableUser_result(
+ public deleteUser_result(
boolean success,
org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse)
{
@@ -7213,7 +7375,7 @@ public class IamAdminServices {
/**
* Performs a deep copy on <i>other</i>.
*/
- public enableUser_result(enableUser_result other) {
+ public deleteUser_result(deleteUser_result other) {
__isset_bitfield = other.__isset_bitfield;
this.success = other.success;
if (other.isSetIdse()) {
@@ -7221,8 +7383,8 @@ public class IamAdminServices {
}
}
- public enableUser_result deepCopy() {
- return new enableUser_result(this);
+ public deleteUser_result deepCopy() {
+ return new deleteUser_result(this);
}
@Override
@@ -7236,7 +7398,7 @@ public class IamAdminServices {
return this.success;
}
- public enableUser_result setSuccess(boolean success) {
+ public deleteUser_result setSuccess(boolean success) {
this.success = success;
setSuccessIsSet(true);
return this;
@@ -7260,7 +7422,7 @@ public class IamAdminServices {
return this.Idse;
}
- public enableUser_result setIdse(@org.apache.thrift.annotation.Nullable org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse) {
+ public deleteUser_result setIdse(@org.apache.thrift.annotation.Nullable org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse) {
this.Idse = Idse;
return this;
}
@@ -7333,12 +7495,12 @@ public class IamAdminServices {
public boolean equals(Object that) {
if (that == null)
return false;
- if (that instanceof enableUser_result)
- return this.equals((enableUser_result)that);
+ if (that instanceof deleteUser_result)
+ return this.equals((deleteUser_result)that);
return false;
}
- public boolean equals(enableUser_result that) {
+ public boolean equals(deleteUser_result that) {
if (that == null)
return false;
if (this == that)
@@ -7379,7 +7541,7 @@ public class IamAdminServices {
}
@Override
- public int compareTo(enableUser_result other) {
+ public int compareTo(deleteUser_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
@@ -7424,7 +7586,7 @@ public class IamAdminServices {
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("enableUser_result(");
+ StringBuilder sb = new StringBuilder("deleteUser_result(");
boolean first = true;
sb.append("success:");
@@ -7465,15 +7627,15 @@ public class IamAdminServices {
}
}
- private static class enableUser_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public enableUser_resultStandardScheme getScheme() {
- return new enableUser_resultStandardScheme();
+ private static class deleteUser_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public deleteUser_resultStandardScheme getScheme() {
+ return new deleteUser_resultStandardScheme();
}
}
- private static class enableUser_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<enableUser_result> {
+ private static class deleteUser_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<deleteUser_result> {
- public void read(org.apache.thrift.protocol.TProtocol iprot, enableUser_result struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol iprot, deleteUser_result struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
@@ -7511,7 +7673,7 @@ public class IamAdminServices {
struct.validate();
}
- public void write(org.apache.thrift.protocol.TProtocol oprot, enableUser_result struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol oprot, deleteUser_result struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
@@ -7531,16 +7693,16 @@ public class IamAdminServices {
}
- private static class enableUser_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
- public enableUser_resultTupleScheme getScheme() {
- return new enableUser_resultTupleScheme();
+ private static class deleteUser_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public deleteUser_resultTupleScheme getScheme() {
+ return new deleteUser_resultTupleScheme();
}
}
- private static class enableUser_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<enableUser_result> {
+ private static class deleteUser_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<deleteUser_result> {
@Override
- public void write(org.apache.thrift.protocol.TProtocol prot, enableUser_result struct) throws org.apache.thrift.TException {
+ public void write(org.apache.thrift.protocol.TProtocol prot, deleteUser_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()) {
@@ -7559,7 +7721,7 @@ public class IamAdminServices {
}
@Override
- public void read(org.apache.thrift.protocol.TProtocol prot, enableUser_result struct) throws org.apache.thrift.TException {
+ public void read(org.apache.thrift.protocol.TProtocol prot, deleteUser_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)) {
@@ -7579,6 +7741,951 @@ public class IamAdminServices {
}
}
+ public static class enableUser_args implements org.apache.thrift.TBase<enableUser_args, enableUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<enableUser_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("enableUser_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 USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new enableUser_argsStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new enableUser_argsTupleSchemeFactory();
+
+ public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
+ public @org.apache.thrift.annotation.Nullable String username; // 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"),
+ USERNAME((short)2, "username");
+
+ 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: // USERNAME
+ return USERNAME;
+ 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.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", 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(enableUser_args.class, metaDataMap);
+ }
+
+ public enableUser_args() {
+ }
+
+ public enableUser_args(
+ org.apache.custos.commons.model.security.AuthzToken authzToken,
+ String username)
+ {
+ this();
+ this.authzToken = authzToken;
+ this.username = username;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public enableUser_args(enableUser_args other) {
+ if (other.isSetAuthzToken()) {
+ this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
+ }
+ if (other.isSetUsername()) {
+ this.username = other.username;
+ }
+ }
+
+ public enableUser_args deepCopy() {
+ return new enableUser_args(this);
+ }
+
+ @Override
+ public void clear() {
+ this.authzToken = null;
+ this.username = null;
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
+ return this.authzToken;
+ }
+
+ public enableUser_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 getUsername() {
+ return this.username;
+ }
+
+ public enableUser_args setUsername(@org.apache.thrift.annotation.Nullable String username) {
+ this.username = username;
+ return this;
+ }
+
+ public void unsetUsername() {
+ this.username = null;
+ }
+
+ /** Returns true if field username is set (has been assigned a value) and false otherwise */
+ public boolean isSetUsername() {
+ return this.username != null;
+ }
+
+ public void setUsernameIsSet(boolean value) {
+ if (!value) {
+ this.username = 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 USERNAME:
+ if (value == null) {
+ unsetUsername();
+ } else {
+ setUsername((String)value);
+ }
+ break;
+
+ }
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case AUTHZ_TOKEN:
+ return getAuthzToken();
+
+ case USERNAME:
+ return getUsername();
+
+ }
+ 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 USERNAME:
+ return isSetUsername();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof enableUser_args)
+ return this.equals((enableUser_args)that);
+ return false;
+ }
+
+ public boolean equals(enableUser_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_username = true && this.isSetUsername();
+ boolean that_present_username = true && that.isSetUsername();
+ if (this_present_username || that_present_username) {
+ if (!(this_present_username && that_present_username))
+ return false;
+ if (!this.username.equals(that.username))
+ 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 + ((isSetUsername()) ? 131071 : 524287);
+ if (isSetUsername())
+ hashCode = hashCode * 8191 + username.hashCode();
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(enableUser_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(isSetUsername()).compareTo(other.isSetUsername());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetUsername()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
+ 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("enableUser_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("username:");
+ if (this.username == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.username);
+ }
+ 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 (username == null) {
+ throw new org.apache.thrift.protocol.TProtocolException("Required field 'username' 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 enableUser_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public enableUser_argsStandardScheme getScheme() {
+ return new enableUser_argsStandardScheme();
+ }
+ }
+
+ private static class enableUser_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<enableUser_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, enableUser_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: // USERNAME
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+ struct.username = iprot.readString();
+ struct.setUsernameIsSet(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, enableUser_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.username != null) {
+ oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+ oprot.writeString(struct.username);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class enableUser_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public enableUser_argsTupleScheme getScheme() {
+ return new enableUser_argsTupleScheme();
+ }
+ }
+
+ private static class enableUser_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<enableUser_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, enableUser_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.username);
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, enableUser_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.username = iprot.readString();
+ struct.setUsernameIsSet(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 enableUser_result implements org.apache.thrift.TBase<enableUser_result, enableUser_result._Fields>, java.io.Serializable, Cloneable, Comparable<enableUser_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("enableUser_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 IDSE_FIELD_DESC = new org.apache.thrift.protocol.TField("Idse", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new enableUser_resultStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new enableUser_resultTupleSchemeFactory();
+
+ public @org.apache.thrift.annotation.Nullable org.apache.custos.profile.model.user.UserProfile success; // required
+ public @org.apache.thrift.annotation.Nullable org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse; // 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"),
+ IDSE((short)1, "Idse");
+
+ 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: // IDSE
+ return IDSE;
+ 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.profile.model.user.UserProfile.class)));
+ tmpMap.put(_Fields.IDSE, new org.apache.thrift.meta_data.FieldMetaData("Idse", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException.class)));
+ metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(enableUser_result.class, metaDataMap);
+ }
+
+ public enableUser_result() {
+ }
+
+ public enableUser_result(
+ org.apache.custos.profile.model.user.UserProfile success,
+ org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse)
+ {
+ this();
+ this.success = success;
+ this.Idse = Idse;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public enableUser_result(enableUser_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new org.apache.custos.profile.model.user.UserProfile(other.success);
+ }
+ if (other.isSetIdse()) {
+ this.Idse = new org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException(other.Idse);
+ }
+ }
+
+ public enableUser_result deepCopy() {
+ return new enableUser_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ this.Idse = null;
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public org.apache.custos.profile.model.user.UserProfile getSuccess() {
+ return this.success;
+ }
+
+ public enableUser_result setSuccess(@org.apache.thrift.annotation.Nullable org.apache.custos.profile.model.user.UserProfile 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.profile.iam.admin.services.cpi.exception.IamAdminServicesException getIdse() {
+ return this.Idse;
+ }
+
+ public enableUser_result setIdse(@org.apache.thrift.annotation.Nullable org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException Idse) {
+ this.Idse = Idse;
+ return this;
+ }
+
+ public void unsetIdse() {
+ this.Idse = null;
+ }
+
+ /** Returns true if field Idse is set (has been assigned a value) and false otherwise */
+ public boolean isSetIdse() {
+ return this.Idse != null;
+ }
+
+ public void setIdseIsSet(boolean value) {
+ if (!value) {
+ this.Idse = 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.profile.model.user.UserProfile)value);
+ }
+ break;
+
+ case IDSE:
+ if (value == null) {
+ unsetIdse();
+ } else {
+ setIdse((org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException)value);
+ }
+ break;
+
+ }
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ case IDSE:
+ return getIdse();
+
+ }
+ 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 IDSE:
+ return isSetIdse();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof enableUser_result)
+ return this.equals((enableUser_result)that);
+ return false;
+ }
+
+ public boolean equals(enableUser_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_Idse = true && this.isSetIdse();
+ boolean that_present_Idse = true && that.isSetIdse();
+ if (this_present_Idse || that_present_Idse) {
+ if (!(this_present_Idse && that_present_Idse))
+ return false;
+ if (!this.Idse.equals(that.Idse))
+ 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 + ((isSetIdse()) ? 131071 : 524287);
+ if (isSetIdse())
+ hashCode = hashCode * 8191 + Idse.hashCode();
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(enableUser_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(isSetIdse()).compareTo(other.isSetIdse());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetIdse()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.Idse, other.Idse);
+ 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("enableUser_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("Idse:");
+ if (this.Idse == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.Idse);
+ }
+ 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 enableUser_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public enableUser_resultStandardScheme getScheme() {
+ return new enableUser_resultStandardScheme();
+ }
+ }
+
+ private static class enableUser_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<enableUser_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, enableUser_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.profile.model.user.UserProfile();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // IDSE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.Idse = new org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException();
+ struct.Idse.read(iprot);
+ struct.setIdseIsSet(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, enableUser_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.Idse != null) {
+ oprot.writeFieldBegin(IDSE_FIELD_DESC);
+ struct.Idse.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class enableUser_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public enableUser_resultTupleScheme getScheme() {
+ return new enableUser_resultTupleScheme();
+ }
+ }
+
+ private static class enableUser_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<enableUser_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, enableUser_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.isSetIdse()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetSuccess()) {
+ struct.success.write(oprot);
+ }
+ if (struct.isSetIdse()) {
+ struct.Idse.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, enableUser_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.profile.model.user.UserProfile();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.Idse = new org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException();
+ struct.Idse.read(iprot);
+ struct.setIdseIsSet(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 isUserEnabled_args implements org.apache.thrift.TBase<isUserEnabled_args, isUserEnabled_args._Fields>, java.io.Serializable, Cloneable, Comparable<isUserEnabled_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isUserEnabled_args");
diff --git a/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/handler/IamAdminServicesHandler.java b/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/handler/IamAdminServicesHandler.java
index 5ccfd3a..0339b1c 100644
--- a/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/handler/IamAdminServicesHandler.java
+++ b/custos-profile-service/iam-admin-services/src/main/java/org/apache/custos/profile/iam/admin/services/handler/IamAdminServicesHandler.java
@@ -24,7 +24,9 @@ package org.apache.custos.profile.iam.admin.services.handler;
import org.apache.custos.commons.exceptions.ApplicationSettingsException;
import org.apache.custos.commons.model.security.AuthzToken;
import org.apache.custos.commons.utils.Constants;
+import org.apache.custos.commons.utils.CustosUtils;
import org.apache.custos.commons.utils.ServerSettings;
+import org.apache.custos.profile.commons.repositories.UserProfileRepository;
import org.apache.custos.profile.model.tenant.PasswordCredential;
import org.apache.custos.profile.model.user.UserProfile;
import org.apache.custos.profile.model.workspace.Gateway;
@@ -41,7 +43,7 @@ import java.util.List;
public class IamAdminServicesHandler implements IamAdminServices.Iface {
private final static Logger logger = LoggerFactory.getLogger(IamAdminServicesHandler.class);
-
+ private UserProfileRepository userProfileRepository = new UserProfileRepository();
@Override
public String getAPIVersion() throws IamAdminServicesException {
@@ -98,14 +100,25 @@ public class IamAdminServicesHandler implements IamAdminServices.Iface {
}
@Override
- public boolean enableUser(AuthzToken authzToken, String username) throws IamAdminServicesException {
+ public UserProfile enableUser(AuthzToken authzToken, String username) throws IamAdminServicesException, TException {
TenantManagementKeycloakImpl keycloakclient = new TenantManagementKeycloakImpl();
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
try {
- if (keycloakclient.enableUserAccount(authzToken.getAccessToken(), gatewayId, username))
- return true;
- else
- return false;
+ if (keycloakclient.enableUserAccount(authzToken.getAccessToken(), gatewayId, username)) {
+ // Check if user profile exists, if not create it
+ UserProfile userProfile = userProfileRepository.getUserProfileByIdAndGateWay(username, gatewayId);
+ if (userProfile == null) {
+ // Load basic user profile information from Keycloak and then save in UserProfileRepository
+ userProfile = keycloakclient.getUser(authzToken.getAccessToken(), gatewayId, username);
+ userProfile.setCreationTime(CustosUtils.getCurrentTimestamp().getTime());
+ userProfile.setLastAccessTime(CustosUtils.getCurrentTimestamp().getTime());
+ userProfile.setValidUntil(-1);
+ userProfileRepository.createUserProfile(userProfile);
+ }
+ return userProfile;
+ } else {
+ return null;
+ }
} catch (TException ex) {
String msg = "Error while enabling user account, reason: " + ex.getMessage();
logger.error(msg, ex);
@@ -207,6 +220,15 @@ public class IamAdminServicesHandler implements IamAdminServices.Iface {
}
@Override
+ public boolean deleteUser(AuthzToken authzToken, String username) throws IamAdminServicesException, TException {
+
+ TenantManagementKeycloakImpl keycloakclient = new TenantManagementKeycloakImpl();
+ String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+
+ return keycloakclient.deleteUser(authzToken.getAccessToken(), gatewayId, username);
+ }
+
+ @Override
@Deprecated
//TODO: check if isRealmAdminCredentials required or not
public boolean addRoleToUser(AuthzToken authzToken, String username, String roleName, PasswordCredential isRealmAdminCredentials) throws IamAdminServicesException, TException {
diff --git a/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/core/TenantProfileRepository.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/TenantProfileRepository.java
similarity index 85%
rename from custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/core/TenantProfileRepository.java
rename to custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/TenantProfileRepository.java
index b20f428..9aabf9d 100644
--- a/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/core/TenantProfileRepository.java
+++ b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/TenantProfileRepository.java
@@ -17,9 +17,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.custos.profile.tenant.core;
+package org.apache.custos.profile.commons.repositories;
-import org.apache.custos.profile.commons.repositories.AbstractRepository;
import org.apache.custos.profile.commons.tenant.entities.GatewayEntity;
import org.apache.custos.profile.commons.utils.QueryConstants;
import org.apache.custos.profile.model.workspace.Gateway;
@@ -59,6 +58,22 @@ public class TenantProfileRepository extends AbstractRepository<Gateway, Gateway
return gateway;
}
+ public Gateway getGatewayUsingGatewayId (String gatewayId) throws Exception {
+ Gateway gateway = null;
+ try {
+ Map<String, Object> queryParam = new HashMap<String, Object>();
+ queryParam.put(Gateway._Fields.GATEWAY_ID.getFieldName(), gatewayId);
+ List<Gateway> gatewayList = select(QueryConstants.FIND_GATEWAY_BY_GATEWAY_ID, 1, 0, queryParam);
+ if (!gatewayList.isEmpty()) {
+ gateway = gatewayList.get(0);
+ }
+ } catch (Exception ex) {
+ logger.error("Error while getting gateway, reason: " + ex.getMessage(), ex);
+ throw ex;
+ }
+ return gateway;
+ }
+
public List<Gateway> getAllGateways () throws Exception {
try {
List<Gateway> gatewayList = select(QueryConstants.GET_ALL_GATEWAYS);
diff --git a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/core/repositories/UserProfileRepository.java b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/UserProfileRepository.java
similarity index 97%
rename from custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/core/repositories/UserProfileRepository.java
rename to custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/UserProfileRepository.java
index 9f81813..fab458c 100644
--- a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/core/repositories/UserProfileRepository.java
+++ b/custos-profile-service/profile-service-commons/src/main/java/org/apache/custos/profile/commons/repositories/UserProfileRepository.java
@@ -18,9 +18,8 @@
* under the License.
*
*/
-package org.apache.custos.profile.user.core.repositories;
+package org.apache.custos.profile.commons.repositories;
-import org.apache.custos.profile.commons.repositories.AbstractRepository;
import org.apache.custos.profile.commons.user.entities.UserProfileEntity;
import org.apache.custos.profile.commons.utils.JPAUtils;
import org.apache.custos.profile.commons.utils.ObjectMapperSingleton;
diff --git a/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/client/TenantProfileClient.java b/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/client/TenantProfileClient.java
new file mode 100644
index 0000000..9e8a45c
--- /dev/null
+++ b/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/client/TenantProfileClient.java
@@ -0,0 +1,26 @@
+package org.apache.custos.profile.tenant.client;
+
+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.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;
+
+public class TenantProfileClient {
+
+ 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());
+ }
+ }
+}
diff --git a/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/cpi/TenantProfileService.java b/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/cpi/TenantProfileService.java
index b9402a7..c2150c1 100644
--- a/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/cpi/TenantProfileService.java
+++ b/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/cpi/TenantProfileService.java
@@ -7,7 +7,7 @@
package org.apache.custos.profile.tenant.cpi;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-09")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-14")
public class TenantProfileService {
public interface Iface {
@@ -20,6 +20,8 @@ public class TenantProfileService {
public org.apache.custos.profile.model.workspace.Gateway getGateway(org.apache.custos.commons.model.security.AuthzToken authzToken, String custosInternalGatewayId) throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.thrift.TException;
+ public org.apache.custos.profile.model.workspace.Gateway getGatewayUsingGatewayId(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.thrift.TException;
+
public org.apache.custos.profile.model.workspace.Gateway deleteGateway(org.apache.custos.commons.model.security.AuthzToken authzToken, String custosInternalGatewayId, String gatewayId) throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.thrift.TException;
public java.util.List<org.apache.custos.profile.model.workspace.Gateway> getAllGateways(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.thrift.TException;
@@ -42,6 +44,8 @@ public class TenantProfileService {
public void getGateway(org.apache.custos.commons.model.security.AuthzToken authzToken, String custosInternalGatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.workspace.Gateway> resultHandler) throws org.apache.thrift.TException;
+ public void getGatewayUsingGatewayId(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.workspace.Gateway> resultHandler) throws org.apache.thrift.TException;
+
public void deleteGateway(org.apache.custos.commons.model.security.AuthzToken authzToken, String custosInternalGatewayId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.workspace.Gateway> resultHandler) throws org.apache.thrift.TException;
public void getAllGateways(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.custos.profile.model.workspace.Gateway>> resultHandler) throws org.apache.thrift.TException;
@@ -180,6 +184,33 @@ public class TenantProfileService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getGateway failed: unknown result");
}
+ public org.apache.custos.profile.model.workspace.Gateway getGatewayUsingGatewayId(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.thrift.TException
+ {
+ send_getGatewayUsingGatewayId(authzToken, gatewayId);
+ return recv_getGatewayUsingGatewayId();
+ }
+
+ public void send_getGatewayUsingGatewayId(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.thrift.TException
+ {
+ getGatewayUsingGatewayId_args args = new getGatewayUsingGatewayId_args();
+ args.setAuthzToken(authzToken);
+ args.setGatewayId(gatewayId);
+ sendBase("getGatewayUsingGatewayId", args);
+ }
+
+ public org.apache.custos.profile.model.workspace.Gateway recv_getGatewayUsingGatewayId() throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.thrift.TException
+ {
+ getGatewayUsingGatewayId_result result = new getGatewayUsingGatewayId_result();
+ receiveBase(result, "getGatewayUsingGatewayId");
+ if (result.isSetSuccess()) {
+ return result.success;
+ }
+ if (result.tpe != null) {
+ throw result.tpe;
+ }
+ throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getGatewayUsingGatewayId failed: unknown result");
+ }
+
public org.apache.custos.profile.model.workspace.Gateway deleteGateway(org.apache.custos.commons.model.security.AuthzToken authzToken, String custosInternalGatewayId, String gatewayId) throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.thrift.TException
{
send_deleteGateway(authzToken, custosInternalGatewayId, gatewayId);
@@ -467,6 +498,41 @@ public class TenantProfileService {
}
}
+ public void getGatewayUsingGatewayId(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.workspace.Gateway> resultHandler) throws org.apache.thrift.TException {
+ checkReady();
+ getGatewayUsingGatewayId_call method_call = new getGatewayUsingGatewayId_call(authzToken, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+ this.___currentMethod = method_call;
+ ___manager.call(method_call);
+ }
+
+ public static class getGatewayUsingGatewayId_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.profile.model.workspace.Gateway> {
+ private org.apache.custos.commons.model.security.AuthzToken authzToken;
+ private String gatewayId;
+ public getGatewayUsingGatewayId_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.workspace.Gateway> 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("getGatewayUsingGatewayId", org.apache.thrift.protocol.TMessageType.CALL, 0));
+ getGatewayUsingGatewayId_args args = new getGatewayUsingGatewayId_args();
+ args.setAuthzToken(authzToken);
+ args.setGatewayId(gatewayId);
+ args.write(prot);
+ prot.writeMessageEnd();
+ }
+
+ public org.apache.custos.profile.model.workspace.Gateway getResult() throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, 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_getGatewayUsingGatewayId();
+ }
+ }
+
public void deleteGateway(org.apache.custos.commons.model.security.AuthzToken authzToken, String custosInternalGatewayId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.workspace.Gateway> resultHandler) throws org.apache.thrift.TException {
checkReady();
deleteGateway_call method_call = new deleteGateway_call(authzToken, custosInternalGatewayId, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
@@ -659,6 +725,7 @@ public class TenantProfileService {
processMap.put("addGateway", new addGateway());
processMap.put("updateGateway", new updateGateway());
processMap.put("getGateway", new getGateway());
+ processMap.put("getGatewayUsingGatewayId", new getGatewayUsingGatewayId());
processMap.put("deleteGateway", new deleteGateway());
processMap.put("getAllGateways", new getAllGateways());
processMap.put("isGatewayExist", new isGatewayExist());
@@ -783,6 +850,35 @@ public class TenantProfileService {
}
}
+ public static class getGatewayUsingGatewayId<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getGatewayUsingGatewayId_args> {
+ public getGatewayUsingGatewayId() {
+ super("getGatewayUsingGatewayId");
+ }
+
+ public getGatewayUsingGatewayId_args getEmptyArgsInstance() {
+ return new getGatewayUsingGatewayId_args();
+ }
+
+ protected boolean isOneway() {
+ return false;
+ }
+
+ @Override
+ protected boolean rethrowUnhandledExceptions() {
+ return false;
+ }
+
+ public getGatewayUsingGatewayId_result getResult(I iface, getGatewayUsingGatewayId_args args) throws org.apache.thrift.TException {
+ getGatewayUsingGatewayId_result result = new getGatewayUsingGatewayId_result();
+ try {
+ result.success = iface.getGatewayUsingGatewayId(args.authzToken, args.gatewayId);
+ } catch (org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException tpe) {
+ result.tpe = tpe;
+ }
+ return result;
+ }
+ }
+
public static class deleteGateway<I extends Iface> extends org.apache.thrift.ProcessFunction<I, deleteGateway_args> {
public deleteGateway() {
super("deleteGateway");
@@ -947,6 +1043,7 @@ public class TenantProfileService {
processMap.put("addGateway", new addGateway());
processMap.put("updateGateway", new updateGateway());
processMap.put("getGateway", new getGateway());
+ processMap.put("getGatewayUsingGatewayId", new getGatewayUsingGatewayId());
processMap.put("deleteGateway", new deleteGateway());
processMap.put("getAllGateways", new getAllGateways());
processMap.put("isGatewayExist", new isGatewayExist());
@@ -1215,6 +1312,71 @@ public class TenantProfileService {
}
}
+ public static class getGatewayUsingGatewayId<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getGatewayUsingGatewayId_args, org.apache.custos.profile.model.workspace.Gateway> {
+ public getGatewayUsingGatewayId() {
+ super("getGatewayUsingGatewayId");
+ }
+
+ public getGatewayUsingGatewayId_args getEmptyArgsInstance() {
+ return new getGatewayUsingGatewayId_args();
+ }
+
+ public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.workspace.Gateway> 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.profile.model.workspace.Gateway>() {
+ public void onComplete(org.apache.custos.profile.model.workspace.Gateway o) {
+ getGatewayUsingGatewayId_result result = new getGatewayUsingGatewayId_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;
+ getGatewayUsingGatewayId_result result = new getGatewayUsingGatewayId_result();
+ if (e instanceof org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException) {
+ result.tpe = (org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException) e;
+ result.setTpeIsSet(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, getGatewayUsingGatewayId_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.workspace.Gateway> resultHandler) throws org.apache.thrift.TException {
+ iface.getGatewayUsingGatewayId(args.authzToken, args.gatewayId,resultHandler);
+ }
+ }
+
public static class deleteGateway<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, deleteGateway_args, org.apache.custos.profile.model.workspace.Gateway> {
public deleteGateway() {
super("deleteGateway");
@@ -5117,6 +5279,951 @@ public class TenantProfileService {
}
}
+ public static class getGatewayUsingGatewayId_args implements org.apache.thrift.TBase<getGatewayUsingGatewayId_args, getGatewayUsingGatewayId_args._Fields>, java.io.Serializable, Cloneable, Comparable<getGatewayUsingGatewayId_args> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_argsStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getGatewayUsingGatewayId_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(getGatewayUsingGatewayId_args.class, metaDataMap);
+ }
+
+ public getGatewayUsingGatewayId_args() {
+ }
+
+ public getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_args(getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_args deepCopy() {
+ return new getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_args)
+ return this.equals((getGatewayUsingGatewayId_args)that);
+ return false;
+ }
+
+ public boolean equals(getGatewayUsingGatewayId_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(getGatewayUsingGatewayId_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("getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public getGatewayUsingGatewayId_argsStandardScheme getScheme() {
+ return new getGatewayUsingGatewayId_argsStandardScheme();
+ }
+ }
+
+ private static class getGatewayUsingGatewayId_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getGatewayUsingGatewayId_args> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getGatewayUsingGatewayId_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, getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public getGatewayUsingGatewayId_argsTupleScheme getScheme() {
+ return new getGatewayUsingGatewayId_argsTupleScheme();
+ }
+ }
+
+ private static class getGatewayUsingGatewayId_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getGatewayUsingGatewayId_args> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getGatewayUsingGatewayId_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, getGatewayUsingGatewayId_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 getGatewayUsingGatewayId_result implements org.apache.thrift.TBase<getGatewayUsingGatewayId_result, getGatewayUsingGatewayId_result._Fields>, java.io.Serializable, Cloneable, Comparable<getGatewayUsingGatewayId_result> {
+ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getGatewayUsingGatewayId_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 TPE_FIELD_DESC = new org.apache.thrift.protocol.TField("tpe", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getGatewayUsingGatewayId_resultStandardSchemeFactory();
+ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getGatewayUsingGatewayId_resultTupleSchemeFactory();
+
+ public @org.apache.thrift.annotation.Nullable org.apache.custos.profile.model.workspace.Gateway success; // required
+ public @org.apache.thrift.annotation.Nullable org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException tpe; // 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"),
+ TPE((short)1, "tpe");
+
+ 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: // TPE
+ return TPE;
+ 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.profile.model.workspace.Gateway.class)));
+ tmpMap.put(_Fields.TPE, new org.apache.thrift.meta_data.FieldMetaData("tpe", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException.class)));
+ metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+ org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getGatewayUsingGatewayId_result.class, metaDataMap);
+ }
+
+ public getGatewayUsingGatewayId_result() {
+ }
+
+ public getGatewayUsingGatewayId_result(
+ org.apache.custos.profile.model.workspace.Gateway success,
+ org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException tpe)
+ {
+ this();
+ this.success = success;
+ this.tpe = tpe;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public getGatewayUsingGatewayId_result(getGatewayUsingGatewayId_result other) {
+ if (other.isSetSuccess()) {
+ this.success = new org.apache.custos.profile.model.workspace.Gateway(other.success);
+ }
+ if (other.isSetTpe()) {
+ this.tpe = new org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException(other.tpe);
+ }
+ }
+
+ public getGatewayUsingGatewayId_result deepCopy() {
+ return new getGatewayUsingGatewayId_result(this);
+ }
+
+ @Override
+ public void clear() {
+ this.success = null;
+ this.tpe = null;
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public org.apache.custos.profile.model.workspace.Gateway getSuccess() {
+ return this.success;
+ }
+
+ public getGatewayUsingGatewayId_result setSuccess(@org.apache.thrift.annotation.Nullable org.apache.custos.profile.model.workspace.Gateway 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.profile.tenant.cpi.exception.TenantProfileServiceException getTpe() {
+ return this.tpe;
+ }
+
+ public getGatewayUsingGatewayId_result setTpe(@org.apache.thrift.annotation.Nullable org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException tpe) {
+ this.tpe = tpe;
+ return this;
+ }
+
+ public void unsetTpe() {
+ this.tpe = null;
+ }
+
+ /** Returns true if field tpe is set (has been assigned a value) and false otherwise */
+ public boolean isSetTpe() {
+ return this.tpe != null;
+ }
+
+ public void setTpeIsSet(boolean value) {
+ if (!value) {
+ this.tpe = 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.profile.model.workspace.Gateway)value);
+ }
+ break;
+
+ case TPE:
+ if (value == null) {
+ unsetTpe();
+ } else {
+ setTpe((org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException)value);
+ }
+ break;
+
+ }
+ }
+
+ @org.apache.thrift.annotation.Nullable
+ public Object getFieldValue(_Fields field) {
+ switch (field) {
+ case SUCCESS:
+ return getSuccess();
+
+ case TPE:
+ return getTpe();
+
+ }
+ 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 TPE:
+ return isSetTpe();
+ }
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof getGatewayUsingGatewayId_result)
+ return this.equals((getGatewayUsingGatewayId_result)that);
+ return false;
+ }
+
+ public boolean equals(getGatewayUsingGatewayId_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_tpe = true && this.isSetTpe();
+ boolean that_present_tpe = true && that.isSetTpe();
+ if (this_present_tpe || that_present_tpe) {
+ if (!(this_present_tpe && that_present_tpe))
+ return false;
+ if (!this.tpe.equals(that.tpe))
+ 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 + ((isSetTpe()) ? 131071 : 524287);
+ if (isSetTpe())
+ hashCode = hashCode * 8191 + tpe.hashCode();
+
+ return hashCode;
+ }
+
+ @Override
+ public int compareTo(getGatewayUsingGatewayId_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(isSetTpe()).compareTo(other.isSetTpe());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetTpe()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tpe, other.tpe);
+ 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("getGatewayUsingGatewayId_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("tpe:");
+ if (this.tpe == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.tpe);
+ }
+ 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 getGatewayUsingGatewayId_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public getGatewayUsingGatewayId_resultStandardScheme getScheme() {
+ return new getGatewayUsingGatewayId_resultStandardScheme();
+ }
+ }
+
+ private static class getGatewayUsingGatewayId_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getGatewayUsingGatewayId_result> {
+
+ public void read(org.apache.thrift.protocol.TProtocol iprot, getGatewayUsingGatewayId_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.profile.model.workspace.Gateway();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 1: // TPE
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.tpe = new org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException();
+ struct.tpe.read(iprot);
+ struct.setTpeIsSet(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, getGatewayUsingGatewayId_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.tpe != null) {
+ oprot.writeFieldBegin(TPE_FIELD_DESC);
+ struct.tpe.write(oprot);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ }
+
+ private static class getGatewayUsingGatewayId_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+ public getGatewayUsingGatewayId_resultTupleScheme getScheme() {
+ return new getGatewayUsingGatewayId_resultTupleScheme();
+ }
+ }
+
+ private static class getGatewayUsingGatewayId_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getGatewayUsingGatewayId_result> {
+
+ @Override
+ public void write(org.apache.thrift.protocol.TProtocol prot, getGatewayUsingGatewayId_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.isSetTpe()) {
+ optionals.set(1);
+ }
+ oprot.writeBitSet(optionals, 2);
+ if (struct.isSetSuccess()) {
+ struct.success.write(oprot);
+ }
+ if (struct.isSetTpe()) {
+ struct.tpe.write(oprot);
+ }
+ }
+
+ @Override
+ public void read(org.apache.thrift.protocol.TProtocol prot, getGatewayUsingGatewayId_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.profile.model.workspace.Gateway();
+ struct.success.read(iprot);
+ struct.setSuccessIsSet(true);
+ }
+ if (incoming.get(1)) {
+ struct.tpe = new org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException();
+ struct.tpe.read(iprot);
+ struct.setTpeIsSet(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 deleteGateway_args implements org.apache.thrift.TBase<deleteGateway_args, deleteGateway_args._Fields>, java.io.Serializable, Cloneable, Comparable<deleteGateway_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("deleteGateway_args");
diff --git a/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/handler/TenantProfileServiceHandler.java b/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/handler/TenantProfileServiceHandler.java
index f194e84..b68a440 100644
--- a/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/handler/TenantProfileServiceHandler.java
+++ b/custos-profile-service/tenant-profile-service/src/main/java/org/apache/custos/profile/tenant/handler/TenantProfileServiceHandler.java
@@ -23,7 +23,7 @@ import org.apache.custos.commons.model.security.AuthzToken;
import org.apache.custos.profile.commons.tenant.entities.GatewayEntity;
import org.apache.custos.profile.model.workspace.Gateway;
import org.apache.custos.profile.model.workspace.GatewayApprovalStatus;
-import org.apache.custos.profile.tenant.core.TenantProfileRepository;
+import org.apache.custos.profile.commons.repositories.TenantProfileRepository;
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;
@@ -31,7 +31,6 @@ import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.persistence.metamodel.EntityType;
import java.util.List;
import java.util.UUID;
@@ -123,6 +122,22 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface {
}
@Override
+ public Gateway getGatewayUsingGatewayId(AuthzToken authzToken, String gatewayId) throws TenantProfileServiceException, TException {
+ try {
+ Gateway gateway = tenantProfileRepository.getGatewayUsingGatewayId(gatewayId);
+ if (gateway == null) {
+ throw new Exception("Could not find Gateway with ID: " + gatewayId);
+ }
+ return gateway;
+ } catch (Exception ex) {
+ logger.error("Error getting gateway-profile, reason: " + ex.getMessage(), ex);
+ TenantProfileServiceException exception = new TenantProfileServiceException();
+ exception.setMessage("Error getting gateway-profile, reason: " + ex.getMessage());
+ throw exception;
+ }
+ }
+
+ @Override
public Gateway deleteGateway(AuthzToken authzToken, String custosInternalGatewayId, String gatewayId) throws TenantProfileServiceException, TException {
try {
logger.debug("Deleting Custos gateway-profile with ID: " + gatewayId + "Internal ID: " + custosInternalGatewayId);
diff --git a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/client/UserProfileClient.java b/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/client/UserProfileClient.java
new file mode 100644
index 0000000..c5136c2
--- /dev/null
+++ b/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/client/UserProfileClient.java
@@ -0,0 +1,4 @@
+package org.apache.custos.profile.user.client;
+
+public class UserProfileClient {
+}
diff --git a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/cpi/UserProfileService.java b/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/cpi/UserProfileService.java
index 74df8c9..d05650c 100644
--- a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/cpi/UserProfileService.java
+++ b/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/cpi/UserProfileService.java
@@ -7,7 +7,7 @@
package org.apache.custos.profile.user.cpi;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-10")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-08-14")
public class UserProfileService {
public interface Iface {
@@ -21,9 +21,9 @@ public class UserProfileService {
*/
public org.apache.custos.profile.model.user.UserProfile initializeUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException;
- public org.apache.custos.profile.model.user.UserProfile addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException;
+ public org.apache.custos.profile.model.user.UserProfile addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException;
- public org.apache.custos.profile.model.user.UserProfile updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException;
+ public org.apache.custos.profile.model.user.UserProfile updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException;
public org.apache.custos.profile.model.user.UserProfile getUserProfileById(org.apache.custos.commons.model.security.AuthzToken authzToken, String userId, String gatewayId) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException;
@@ -41,9 +41,9 @@ public class UserProfileService {
public void initializeUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException;
- public void addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException;
+ public void addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException;
- public void updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException;
+ public void updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException;
public void getUserProfileById(org.apache.custos.commons.model.security.AuthzToken authzToken, String userId, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException;
@@ -126,19 +126,17 @@ public class UserProfileService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "initializeUserProfile failed: unknown result");
}
- public org.apache.custos.profile.model.user.UserProfile addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException
+ public org.apache.custos.profile.model.user.UserProfile addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException
{
- send_addUserProfile(authzToken, userProfile, clientId, clientSecret);
+ send_addUserProfile(authzToken, userProfile);
return recv_addUserProfile();
}
- public void send_addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret) throws org.apache.thrift.TException
+ public void send_addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile) throws org.apache.thrift.TException
{
addUserProfile_args args = new addUserProfile_args();
args.setAuthzToken(authzToken);
args.setUserProfile(userProfile);
- args.setClientId(clientId);
- args.setClientSecret(clientSecret);
sendBase("addUserProfile", args);
}
@@ -155,19 +153,17 @@ public class UserProfileService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "addUserProfile failed: unknown result");
}
- public org.apache.custos.profile.model.user.UserProfile updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException
+ public org.apache.custos.profile.model.user.UserProfile updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile) throws org.apache.custos.profile.user.cpi.exception.UserProfileServiceException, org.apache.thrift.TException
{
- send_updateUserProfile(authzToken, userProfile, clientId, clientSecret);
+ send_updateUserProfile(authzToken, userProfile);
return recv_updateUserProfile();
}
- public void send_updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret) throws org.apache.thrift.TException
+ public void send_updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile) throws org.apache.thrift.TException
{
updateUserProfile_args args = new updateUserProfile_args();
args.setAuthzToken(authzToken);
args.setUserProfile(userProfile);
- args.setClientId(clientId);
- args.setClientSecret(clientSecret);
sendBase("updateUserProfile", args);
}
@@ -376,9 +372,9 @@ public class UserProfileService {
}
}
- public void addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException {
+ public void addUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException {
checkReady();
- addUserProfile_call method_call = new addUserProfile_call(authzToken, userProfile, clientId, clientSecret, resultHandler, this, ___protocolFactory, ___transport);
+ addUserProfile_call method_call = new addUserProfile_call(authzToken, userProfile, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -386,14 +382,10 @@ public class UserProfileService {
public static class addUserProfile_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.profile.model.user.UserProfile> {
private org.apache.custos.commons.model.security.AuthzToken authzToken;
private org.apache.custos.profile.model.user.UserProfile userProfile;
- private String clientId;
- private String clientSecret;
- public addUserProfile_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.t [...]
+ public addUserProfile_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> 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.userProfile = userProfile;
- this.clientId = clientId;
- this.clientSecret = clientSecret;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -401,8 +393,6 @@ public class UserProfileService {
addUserProfile_args args = new addUserProfile_args();
args.setAuthzToken(authzToken);
args.setUserProfile(userProfile);
- args.setClientId(clientId);
- args.setClientSecret(clientSecret);
args.write(prot);
prot.writeMessageEnd();
}
@@ -417,9 +407,9 @@ public class UserProfileService {
}
}
- public void updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException {
+ public void updateUserProfile(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException {
checkReady();
- updateUserProfile_call method_call = new updateUserProfile_call(authzToken, userProfile, clientId, clientSecret, resultHandler, this, ___protocolFactory, ___transport);
+ updateUserProfile_call method_call = new updateUserProfile_call(authzToken, userProfile, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -427,14 +417,10 @@ public class UserProfileService {
public static class updateUserProfile_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.profile.model.user.UserProfile> {
private org.apache.custos.commons.model.security.AuthzToken authzToken;
private org.apache.custos.profile.model.user.UserProfile userProfile;
- private String clientId;
- private String clientSecret;
- public updateUserProfile_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, String clientId, String clientSecret, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apach [...]
+ public updateUserProfile_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.custos.profile.model.user.UserProfile userProfile, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> 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.userProfile = userProfile;
- this.clientId = clientId;
- this.clientSecret = clientSecret;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -442,8 +428,6 @@ public class UserProfileService {
updateUserProfile_args args = new updateUserProfile_args();
args.setAuthzToken(authzToken);
args.setUserProfile(userProfile);
- args.setClientId(clientId);
- args.setClientSecret(clientSecret);
args.write(prot);
prot.writeMessageEnd();
}
@@ -716,7 +700,7 @@ public class UserProfileService {
public addUserProfile_result getResult(I iface, addUserProfile_args args) throws org.apache.thrift.TException {
addUserProfile_result result = new addUserProfile_result();
try {
- result.success = iface.addUserProfile(args.authzToken, args.userProfile, args.clientId, args.clientSecret);
+ result.success = iface.addUserProfile(args.authzToken, args.userProfile);
} catch (org.apache.custos.profile.user.cpi.exception.UserProfileServiceException upe) {
result.upe = upe;
}
@@ -745,7 +729,7 @@ public class UserProfileService {
public updateUserProfile_result getResult(I iface, updateUserProfile_args args) throws org.apache.thrift.TException {
updateUserProfile_result result = new updateUserProfile_result();
try {
- result.success = iface.updateUserProfile(args.authzToken, args.userProfile, args.clientId, args.clientSecret);
+ result.success = iface.updateUserProfile(args.authzToken, args.userProfile);
} catch (org.apache.custos.profile.user.cpi.exception.UserProfileServiceException upe) {
result.upe = upe;
}
@@ -1085,7 +1069,7 @@ public class UserProfileService {
}
public void start(I iface, addUserProfile_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException {
- iface.addUserProfile(args.authzToken, args.userProfile, args.clientId, args.clientSecret,resultHandler);
+ iface.addUserProfile(args.authzToken, args.userProfile,resultHandler);
}
}
@@ -1150,7 +1134,7 @@ public class UserProfileService {
}
public void start(I iface, updateUserProfile_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.profile.model.user.UserProfile> resultHandler) throws org.apache.thrift.TException {
- iface.updateUserProfile(args.authzToken, args.userProfile, args.clientId, args.clientSecret,resultHandler);
+ iface.updateUserProfile(args.authzToken, args.userProfile,resultHandler);
}
}
@@ -2994,23 +2978,17 @@ public class UserProfileService {
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 USER_PROFILE_FIELD_DESC = new org.apache.thrift.protocol.TField("userProfile", org.apache.thrift.protocol.TType.STRUCT, (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 addUserProfile_argsStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new addUserProfile_argsTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
public @org.apache.thrift.annotation.Nullable org.apache.custos.profile.model.user.UserProfile userProfile; // 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"),
- USER_PROFILE((short)2, "userProfile"),
- CLIENT_ID((short)3, "clientId"),
- CLIENT_SECRET((short)4, "clientSecret");
+ USER_PROFILE((short)2, "userProfile");
private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
@@ -3030,10 +3008,6 @@ public class UserProfileService {
return AUTHZ_TOKEN;
case 2: // USER_PROFILE
return USER_PROFILE;
- case 3: // CLIENT_ID
- return CLIENT_ID;
- case 4: // CLIENT_SECRET
- return CLIENT_SECRET;
default:
return null;
}
@@ -3082,10 +3056,6 @@ public class UserProfileService {
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
tmpMap.put(_Fields.USER_PROFILE, new org.apache.thrift.meta_data.FieldMetaData("userProfile", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.profile.model.user.UserProfile.class)));
- 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(addUserProfile_args.class, metaDataMap);
}
@@ -3095,15 +3065,11 @@ public class UserProfileService {
public addUserProfile_args(
org.apache.custos.commons.model.security.AuthzToken authzToken,
- org.apache.custos.profile.model.user.UserProfile userProfile,
- String clientId,
- String clientSecret)
+ org.apache.custos.profile.model.user.UserProfile userProfile)
{
this();
this.authzToken = authzToken;
this.userProfile = userProfile;
- this.clientId = clientId;
- this.clientSecret = clientSecret;
}
/**
@@ -3116,12 +3082,6 @@ public class UserProfileService {
if (other.isSetUserProfile()) {
this.userProfile = new org.apache.custos.profile.model.user.UserProfile(other.userProfile);
}
- if (other.isSetClientId()) {
- this.clientId = other.clientId;
- }
- if (other.isSetClientSecret()) {
- this.clientSecret = other.clientSecret;
- }
}
public addUserProfile_args deepCopy() {
@@ -3132,8 +3092,6 @@ public class UserProfileService {
public void clear() {
this.authzToken = null;
this.userProfile = null;
- this.clientId = null;
- this.clientSecret = null;
}
@org.apache.thrift.annotation.Nullable
@@ -3186,56 +3144,6 @@ public class UserProfileService {
}
}
- @org.apache.thrift.annotation.Nullable
- public String getClientId() {
- return this.clientId;
- }
-
- public addUserProfile_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 addUserProfile_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:
@@ -3254,22 +3162,6 @@ public class UserProfileService {
}
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;
-
}
}
@@ -3282,12 +3174,6 @@ public class UserProfileService {
case USER_PROFILE:
return getUserProfile();
- case CLIENT_ID:
- return getClientId();
-
- case CLIENT_SECRET:
- return getClientSecret();
-
}
throw new IllegalStateException();
}
@@ -3303,10 +3189,6 @@ public class UserProfileService {
return isSetAuthzToken();
case USER_PROFILE:
return isSetUserProfile();
- case CLIENT_ID:
- return isSetClientId();
- case CLIENT_SECRET:
- return isSetClientSecret();
}
throw new IllegalStateException();
}
@@ -3344,24 +3226,6 @@ public class UserProfileService {
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;
}
@@ -3377,14 +3241,6 @@ public class UserProfileService {
if (isSetUserProfile())
hashCode = hashCode * 8191 + userProfile.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;
}
@@ -3416,26 +3272,6 @@ public class UserProfileService {
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;
}
@@ -3472,22 +3308,6 @@ public class UserProfileService {
sb.append(this.userProfile);
}
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();
}
@@ -3500,12 +3320,6 @@ public class UserProfileService {
if (userProfile == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'userProfile' 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();
@@ -3567,22 +3381,6 @@ public class UserProfileService {
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;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -3608,16 +3406,6 @@ public class UserProfileService {
struct.userProfile.write(oprot);
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();
}
@@ -3637,8 +3425,6 @@ public class UserProfileService {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
struct.authzToken.write(oprot);
struct.userProfile.write(oprot);
- oprot.writeString(struct.clientId);
- oprot.writeString(struct.clientSecret);
}
@Override
@@ -3650,10 +3436,6 @@ public class UserProfileService {
struct.userProfile = new org.apache.custos.profile.model.user.UserProfile();
struct.userProfile.read(iprot);
struct.setUserProfileIsSet(true);
- struct.clientId = iprot.readString();
- struct.setClientIdIsSet(true);
- struct.clientSecret = iprot.readString();
- struct.setClientSecretIsSet(true);
}
}
@@ -4146,23 +3928,17 @@ public class UserProfileService {
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 USER_PROFILE_FIELD_DESC = new org.apache.thrift.protocol.TField("userProfile", org.apache.thrift.protocol.TType.STRUCT, (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 updateUserProfile_argsStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new updateUserProfile_argsTupleSchemeFactory();
public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
public @org.apache.thrift.annotation.Nullable org.apache.custos.profile.model.user.UserProfile userProfile; // 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"),
- USER_PROFILE((short)2, "userProfile"),
- CLIENT_ID((short)3, "clientId"),
- CLIENT_SECRET((short)4, "clientSecret");
+ USER_PROFILE((short)2, "userProfile");
private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
@@ -4182,10 +3958,6 @@ public class UserProfileService {
return AUTHZ_TOKEN;
case 2: // USER_PROFILE
return USER_PROFILE;
- case 3: // CLIENT_ID
- return CLIENT_ID;
- case 4: // CLIENT_SECRET
- return CLIENT_SECRET;
default:
return null;
}
@@ -4234,10 +4006,6 @@ public class UserProfileService {
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
tmpMap.put(_Fields.USER_PROFILE, new org.apache.thrift.meta_data.FieldMetaData("userProfile", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.profile.model.user.UserProfile.class)));
- 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(updateUserProfile_args.class, metaDataMap);
}
@@ -4247,15 +4015,11 @@ public class UserProfileService {
public updateUserProfile_args(
org.apache.custos.commons.model.security.AuthzToken authzToken,
- org.apache.custos.profile.model.user.UserProfile userProfile,
- String clientId,
- String clientSecret)
+ org.apache.custos.profile.model.user.UserProfile userProfile)
{
this();
this.authzToken = authzToken;
this.userProfile = userProfile;
- this.clientId = clientId;
- this.clientSecret = clientSecret;
}
/**
@@ -4268,12 +4032,6 @@ public class UserProfileService {
if (other.isSetUserProfile()) {
this.userProfile = new org.apache.custos.profile.model.user.UserProfile(other.userProfile);
}
- if (other.isSetClientId()) {
- this.clientId = other.clientId;
- }
- if (other.isSetClientSecret()) {
- this.clientSecret = other.clientSecret;
- }
}
public updateUserProfile_args deepCopy() {
@@ -4284,8 +4042,6 @@ public class UserProfileService {
public void clear() {
this.authzToken = null;
this.userProfile = null;
- this.clientId = null;
- this.clientSecret = null;
}
@org.apache.thrift.annotation.Nullable
@@ -4338,56 +4094,6 @@ public class UserProfileService {
}
}
- @org.apache.thrift.annotation.Nullable
- public String getClientId() {
- return this.clientId;
- }
-
- public updateUserProfile_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 updateUserProfile_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:
@@ -4406,22 +4112,6 @@ public class UserProfileService {
}
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;
-
}
}
@@ -4434,12 +4124,6 @@ public class UserProfileService {
case USER_PROFILE:
return getUserProfile();
- case CLIENT_ID:
- return getClientId();
-
- case CLIENT_SECRET:
- return getClientSecret();
-
}
throw new IllegalStateException();
}
@@ -4455,10 +4139,6 @@ public class UserProfileService {
return isSetAuthzToken();
case USER_PROFILE:
return isSetUserProfile();
- case CLIENT_ID:
- return isSetClientId();
- case CLIENT_SECRET:
- return isSetClientSecret();
}
throw new IllegalStateException();
}
@@ -4496,24 +4176,6 @@ public class UserProfileService {
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;
}
@@ -4529,14 +4191,6 @@ public class UserProfileService {
if (isSetUserProfile())
hashCode = hashCode * 8191 + userProfile.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;
}
@@ -4568,26 +4222,6 @@ public class UserProfileService {
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;
}
@@ -4624,22 +4258,6 @@ public class UserProfileService {
sb.append(this.userProfile);
}
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();
}
@@ -4652,12 +4270,6 @@ public class UserProfileService {
if (userProfile == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'userProfile' 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();
@@ -4719,22 +4331,6 @@ public class UserProfileService {
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;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -4760,16 +4356,6 @@ public class UserProfileService {
struct.userProfile.write(oprot);
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();
}
@@ -4789,8 +4375,6 @@ public class UserProfileService {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
struct.authzToken.write(oprot);
struct.userProfile.write(oprot);
- oprot.writeString(struct.clientId);
- oprot.writeString(struct.clientSecret);
}
@Override
@@ -4802,10 +4386,6 @@ public class UserProfileService {
struct.userProfile = new org.apache.custos.profile.model.user.UserProfile();
struct.userProfile.read(iprot);
struct.setUserProfileIsSet(true);
- struct.clientId = iprot.readString();
- struct.setClientIdIsSet(true);
- struct.clientSecret = iprot.readString();
- struct.setClientSecretIsSet(true);
}
}
diff --git a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/handler/UserProfileServiceHandler.java b/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/handler/UserProfileServiceHandler.java
index e72677c..317eb51 100644
--- a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/handler/UserProfileServiceHandler.java
+++ b/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/handler/UserProfileServiceHandler.java
@@ -33,7 +33,7 @@ import org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServic
import org.apache.custos.profile.model.user.Status;
import org.apache.custos.profile.model.user.UserProfile;
import org.apache.custos.profile.model.user.user_profile_modelConstants;
-import org.apache.custos.profile.user.core.repositories.UserProfileRepository;
+import org.apache.custos.profile.commons.repositories.UserProfileRepository;
import org.apache.custos.profile.user.cpi.UserProfileService;
import org.apache.custos.profile.user.cpi.exception.UserProfileServiceException;
import org.apache.custos.security.manager.CustosSecurityManager;
@@ -101,13 +101,12 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
@Override
//@SecurityCheck
- //TODO: need to find alternative for clientId and clientSecret
- public UserProfile addUserProfile(AuthzToken authzToken, UserProfile userProfile, String clientId, String clientSecret) throws UserProfileServiceException {
+ public UserProfile addUserProfile(AuthzToken authzToken, UserProfile userProfile) throws UserProfileServiceException {
try{
// Lowercase user id and internal id
userProfile.setUserId(userProfile.getUserId().toLowerCase());
userProfile.setCustosInternalUserId(userProfile.getUserId() + "@" + userProfile.getGatewayId());
- userProfile = userProfileRepository.updateUserProfile(userProfile, getIAMUserProfileUpdater(authzToken, userProfile, clientId, clientSecret));
+ userProfile = userProfileRepository.updateUserProfile(userProfile, getIAMUserProfileUpdater(authzToken, userProfile));
if (null != userProfile) {
logger.info("Added UserProfile with userId: " + userProfile.getUserId());
return userProfile;
@@ -124,13 +123,12 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
@Override
//@SecurityCheck
- //TODO: need to find alternative for clientId and secret
- public UserProfile updateUserProfile(AuthzToken authzToken, UserProfile userProfile, String clientId, String clientSecret) throws UserProfileServiceException {
+ public UserProfile updateUserProfile(AuthzToken authzToken, UserProfile userProfile) throws UserProfileServiceException {
try {
// After updating the user profile in the database but before committing the transaction, the
// following will update the user profile in the IAM service also. If the update in the IAM service
// fails then the transaction will be rolled back.
- Runnable iamUserProfileUpdater = getIAMUserProfileUpdater(authzToken, userProfile, clientId, clientSecret);
+ Runnable iamUserProfileUpdater = getIAMUserProfileUpdater(authzToken, userProfile);
if(userProfileRepository.updateUserProfile(userProfile, iamUserProfileUpdater) != null) {
logger.info("Updated UserProfile with userId: " + userProfile.getUserId());
return userProfile;
@@ -144,12 +142,12 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
throw new UserProfileServiceException("User update failed. Please try again.");
}
- private Runnable getIAMUserProfileUpdater(AuthzToken authzToken, UserProfile userProfile, String clientId, String clientSecret) throws UserProfileServiceException {
+ private Runnable getIAMUserProfileUpdater(AuthzToken authzToken, UserProfile userProfile) throws UserProfileServiceException {
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
return () -> {
try {
CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
- AuthzToken serviceAccountAuthzToken = securityManager.getUserManagementServiceAccountAuthzToken(authzToken,gatewayId, clientId, clientSecret);
+ AuthzToken serviceAccountAuthzToken = securityManager.getUserManagementServiceAccountAuthzToken(authzToken,gatewayId);
IamAdminServices.Client iamAdminServicesClient = getIamAdminServicesClient();
iamAdminServicesClient.updateUserProfile(serviceAccountAuthzToken, userProfile);
} catch (CustosSecurityException |TException e) {
diff --git a/thrift-interfaces/authentication-service/authentication-service-cpi.thrift b/thrift-interfaces/authentication-service/authentication-service-cpi.thrift
index ab6e3a8..b422f42 100644
--- a/thrift-interfaces/authentication-service/authentication-service-cpi.thrift
+++ b/thrift-interfaces/authentication-service/authentication-service-cpi.thrift
@@ -10,5 +10,5 @@ service CustosAuthenticationService {
bool isUserAuthenticated(1: required security_model.AuthzToken authzToken)
throws (1: authentication_service_cpi_errors.CustosAuthenticationServiceException ae)
userInfo_model.UserInfo getUserInfoFromAuthzToken(1: required security_model.AuthzToken authzToken) throws (1: authentication_service_cpi_errors.CustosAuthenticationServiceException ae)
- security_model.AuthzToken getUserManagementServiceAccountAuthzToken(1: required security_model.AuthzToken authzToken, 2: required string gatewayId, 3:required string clientId, 4: required string clientSecret ) throws (1: authentication_service_cpi_errors.CustosAuthenticationServiceException ae)
+ security_model.AuthzToken getUserManagementServiceAccountAuthzToken(1: required security_model.AuthzToken authzToken, 2: required string gatewayId) throws (1: authentication_service_cpi_errors.CustosAuthenticationServiceException ae)
}
diff --git a/thrift-interfaces/profile-service/iam-admin-services/iam-admin-services-cpi.thrift b/thrift-interfaces/profile-service/iam-admin-services/iam-admin-services-cpi.thrift
index 051d645..f028ab1 100644
--- a/thrift-interfaces/profile-service/iam-admin-services/iam-admin-services-cpi.thrift
+++ b/thrift-interfaces/profile-service/iam-admin-services/iam-admin-services-cpi.thrift
@@ -61,7 +61,11 @@ service IamAdminServices {
6: required string newPassword)
throws (1: iam_admin_services_cpi_errors.IamAdminServicesException Idse)
- bool enableUser(1: required security_model.AuthzToken authzToken,
+ bool deleteUser(1: required security_model.AuthzToken authzToken,
+ 2: required string username)
+ throws (1: iam_admin_services_cpi_errors.IamAdminServicesException Idse)
+
+ user_profile_model.UserProfile enableUser(1: required security_model.AuthzToken authzToken,
2: required string username)
throws (1: iam_admin_services_cpi_errors.IamAdminServicesException Idse)
diff --git a/thrift-interfaces/profile-service/profile-tenant/profile-tenant-cpi.thrift b/thrift-interfaces/profile-service/profile-tenant/profile-tenant-cpi.thrift
index c904418..7f7ddd2 100644
--- a/thrift-interfaces/profile-service/profile-tenant/profile-tenant-cpi.thrift
+++ b/thrift-interfaces/profile-service/profile-tenant/profile-tenant-cpi.thrift
@@ -53,6 +53,10 @@ service TenantProfileService {
2: required string custosInternalGatewayId)
throws (1: profile_tenant_cpi_errors.TenantProfileServiceException tpe)
+ workspace_model.Gateway getGatewayUsingGatewayId (1: required security_model.AuthzToken authzToken,
+ 2: required string gatewayId)
+ throws (1: profile_tenant_cpi_errors.TenantProfileServiceException tpe)
+
workspace_model.Gateway deleteGateway (1: required security_model.AuthzToken authzToken,
2: required string custosInternalGatewayId,
3: required string gatewayId)
diff --git a/thrift-interfaces/profile-service/profile-user/profile-user-cpi.thrift b/thrift-interfaces/profile-service/profile-user/profile-user-cpi.thrift
index efd2abd..b4405d0 100644
--- a/thrift-interfaces/profile-service/profile-user/profile-user-cpi.thrift
+++ b/thrift-interfaces/profile-service/profile-user/profile-user-cpi.thrift
@@ -48,15 +48,11 @@ service UserProfileService {
throws (1: profile_user_cpi_errors.UserProfileServiceException upe);
user_profile_model.UserProfile addUserProfile (1: required security_model.AuthzToken authzToken,
- 2: required user_profile_model.UserProfile userProfile,
- 3: required string clientId,
- 4: required string clientSecret)
+ 2: required user_profile_model.UserProfile userProfile)
throws (1: profile_user_cpi_errors.UserProfileServiceException upe);
user_profile_model.UserProfile updateUserProfile (1: required security_model.AuthzToken authzToken,
- 2: required user_profile_model.UserProfile userProfile,
- 3: required string clientId,
- 4: required string clientSecret)
+ 2: required user_profile_model.UserProfile userProfile)
throws (1: profile_user_cpi_errors.UserProfileServiceException upe);
user_profile_model.UserProfile getUserProfileById (1: required security_model.AuthzToken authzToken,