You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2019/09/03 13:43:03 UTC

[airavata-custos] 08/45: added authentication 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 6563e2c7537e2ad5f8f0983e5f2a307062bfe19a
Author: Aarushi <aa...@gmail.com>
AuthorDate: Mon Jul 8 17:11:25 2019 -0400

    added authentication service
---
 .gitignore                                         |   37 +
 {custos-client => custos-authentication}/pom.xml   |   15 +-
 .../CustosAuthenticationService.java               | 3198 ++++++++++++++++++++
 .../cpi/CustosAuthenticationService.java           | 3198 ++++++++++++++++++++
 .../CustosAuthenticationServiceException.java      |  370 +++
 .../handler/CustosAuthenticationHandler.java       |   57 +
 .../server/CustosAuthenticationServer.java         |  137 +
 custos-client/pom.xml                              |    9 +-
 .../service/AuthenticationServiceClient.java       |   25 +
 ...java => CustosProfileServiceClientFactory.java} |    8 +-
 .../custos/commons/model/security/UserInfo.java    |  875 ++++++
 .../custos/commons/utils/ApplicationSettings.java  |    8 +
 .../custos/commons/utils/ServerSettings.java       |   11 +-
 custos-connectors/pom.xml                          |    6 -
 .../interceptor/SecurityInterceptor.java           |    2 +-
 .../manager/CustosSecurityManager.java             |    6 +-
 .../manager/KeyCloakSecurityManager.java           |   23 +-
 .../manager/UserInfo.java                          |   84 -
 .../handlers/TenantProfileServiceHandler.java      |   15 +-
 .../handlers/UserProfileServiceHandler.java        |   22 +-
 .../profile/server/ProfileServiceServer.java       |    4 +-
 .../client}/ProfileServiceClientFactory.java       |   17 +-
 .../profile/tenant.cpi/TenantProfileService.java   |  140 +-
 pom.xml                                            |    1 +
 .../authentication-service-cpi.thrift              |   14 +
 .../authentication_service_cpi_errors.thrift       |   27 +
 .../custos-apis/userInfo_model.thrift              |   33 +
 .../profile-tenant/profile-tenant-cpi.thrift       |    6 +-
 28 files changed, 8167 insertions(+), 181 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f2d127f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,37 @@
+# From https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
+
+## Directory-based project format
+.idea/
+# if you remove the above rule, at least ignore user-specific stuff:
+# .idea/workspace.xml
+# .idea/tasks.xml
+# and these sensitive or high-churn files:
+# .idea/dataSources.ids
+# .idea/dataSources.xml
+# .idea/sqlDataSources.xml
+# .idea/dynamic.xml
+
+## File-based project format
+*.ipr
+*.iws
+*.iml
+*target
+## Additional for IntelliJ
+out/
+
+# generated by mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# generated by JIRA plugin
+atlassian-ide-plugin.xml
+
+# generated by Crashlytics plugin (for Android Studio and Intellij)
+com_crashlytics_export_strings.xml
+
+.DS_Store
+.project
+.vscode
+.settings
+.classpath
+.factorypath
diff --git a/custos-client/pom.xml b/custos-authentication/pom.xml
similarity index 66%
copy from custos-client/pom.xml
copy to custos-authentication/pom.xml
index cc6d67b..c8f8cf3 100644
--- a/custos-client/pom.xml
+++ b/custos-authentication/pom.xml
@@ -8,19 +8,22 @@
         <version>1.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>custos-authentication</artifactId>
     <dependencies>
         <dependency>
             <groupId>org.apache.custos</groupId>
-            <artifactId>profile-service-stubs</artifactId>
+            <artifactId>custos-commons</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.custos</groupId>
+            <artifactId>custos-connectors</artifactId>
             <version>1.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
     </dependencies>
-    <properties>
-        <maven.compiler.source>1.8</maven.compiler.source>
-        <maven.compiler.target>1.8</maven.compiler.target>
-    </properties>
-    <artifactId>custos-client</artifactId>
 
 
 </project>
\ No newline at end of file
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/CustosAuthenticationService.java b/custos-authentication/src/main/java/org/apache/custos/authentication/CustosAuthenticationService.java
new file mode 100644
index 0000000..115c3e3
--- /dev/null
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/CustosAuthenticationService.java
@@ -0,0 +1,3198 @@
+/**
+ * Autogenerated by Thrift Compiler (0.12.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.custos.authentication;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-08")
+public class CustosAuthenticationService {
+
+  public interface Iface {
+
+    public boolean isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
+
+    public org.apache.custos.commons.model.security.UserInfo getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
+
+    public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
+
+  }
+
+  public interface AsyncIface {
+
+    public void isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException;
+
+    public void getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException;
+
+    public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException;
+
+  }
+
+  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+      public Factory() {}
+      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+        return new Client(prot);
+      }
+      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+        return new Client(iprot, oprot);
+      }
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol prot)
+    {
+      super(prot, prot);
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+      super(iprot, oprot);
+    }
+
+    public boolean isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      send_isUserAuthenticated(authzToken);
+      return recv_isUserAuthenticated();
+    }
+
+    public void send_isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.thrift.TException
+    {
+      isUserAuthenticated_args args = new isUserAuthenticated_args();
+      args.setAuthzToken(authzToken);
+      sendBase("isUserAuthenticated", args);
+    }
+
+    public boolean recv_isUserAuthenticated() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      isUserAuthenticated_result result = new isUserAuthenticated_result();
+      receiveBase(result, "isUserAuthenticated");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.ae != null) {
+        throw result.ae;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isUserAuthenticated failed: unknown result");
+    }
+
+    public org.apache.custos.commons.model.security.UserInfo getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      send_getUserInfoFromAuthzToken(authzToken);
+      return recv_getUserInfoFromAuthzToken();
+    }
+
+    public void send_getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.thrift.TException
+    {
+      getUserInfoFromAuthzToken_args args = new getUserInfoFromAuthzToken_args();
+      args.setAuthzToken(authzToken);
+      sendBase("getUserInfoFromAuthzToken", args);
+    }
+
+    public org.apache.custos.commons.model.security.UserInfo recv_getUserInfoFromAuthzToken() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
+      receiveBase(result, "getUserInfoFromAuthzToken");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.ae != null) {
+        throw result.ae;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserInfoFromAuthzToken failed: unknown result");
+    }
+
+    public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
+      return recv_getUserManagementServiceAccountAuthzToken();
+    }
+
+    public void send_getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.thrift.TException
+    {
+      getUserManagementServiceAccountAuthzToken_args args = new getUserManagementServiceAccountAuthzToken_args();
+      args.setAuthzToken(authzToken);
+      args.setGatewayId(gatewayId);
+      sendBase("getUserManagementServiceAccountAuthzToken", args);
+    }
+
+    public org.apache.custos.commons.model.security.AuthzToken recv_getUserManagementServiceAccountAuthzToken() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
+      receiveBase(result, "getUserManagementServiceAccountAuthzToken");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.ae != null) {
+        throw result.ae;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserManagementServiceAccountAuthzToken failed: unknown result");
+    }
+
+  }
+  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
+    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
+      private org.apache.thrift.async.TAsyncClientManager clientManager;
+      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+        this.clientManager = clientManager;
+        this.protocolFactory = protocolFactory;
+      }
+      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+        return new AsyncClient(protocolFactory, clientManager, transport);
+      }
+    }
+
+    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+      super(protocolFactory, clientManager, transport);
+    }
+
+    public void isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      isUserAuthenticated_call method_call = new isUserAuthenticated_call(authzToken, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class isUserAuthenticated_call extends org.apache.thrift.async.TAsyncMethodCall<Boolean> {
+      private org.apache.custos.commons.model.security.AuthzToken authzToken;
+      public isUserAuthenticated_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.authzToken = authzToken;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isUserAuthenticated", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        isUserAuthenticated_args args = new isUserAuthenticated_args();
+        args.setAuthzToken(authzToken);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public Boolean getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_isUserAuthenticated();
+      }
+    }
+
+    public void getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getUserInfoFromAuthzToken_call method_call = new getUserInfoFromAuthzToken_call(authzToken, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getUserInfoFromAuthzToken_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.commons.model.security.UserInfo> {
+      private org.apache.custos.commons.model.security.AuthzToken authzToken;
+      public getUserInfoFromAuthzToken_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.authzToken = authzToken;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserInfoFromAuthzToken", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getUserInfoFromAuthzToken_args args = new getUserInfoFromAuthzToken_args();
+        args.setAuthzToken(authzToken);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.custos.commons.model.security.UserInfo getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getUserInfoFromAuthzToken();
+      }
+    }
+
+    public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getUserManagementServiceAccountAuthzToken_call method_call = new getUserManagementServiceAccountAuthzToken_call(authzToken, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getUserManagementServiceAccountAuthzToken_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.commons.model.security.AuthzToken> {
+      private org.apache.custos.commons.model.security.AuthzToken authzToken;
+      private String gatewayId;
+      public getUserManagementServiceAccountAuthzToken_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.authzToken = authzToken;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserManagementServiceAccountAuthzToken", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getUserManagementServiceAccountAuthzToken_args args = new getUserManagementServiceAccountAuthzToken_args();
+        args.setAuthzToken(authzToken);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.custos.commons.model.security.AuthzToken getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getUserManagementServiceAccountAuthzToken();
+      }
+    }
+
+  }
+
+  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+    private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
+    public Processor(I iface) {
+      super(iface, getProcessMap(new java.util.HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+    }
+
+    protected Processor(I iface, java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends Iface> java.util.Map<String,  org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      processMap.put("isUserAuthenticated", new isUserAuthenticated());
+      processMap.put("getUserInfoFromAuthzToken", new getUserInfoFromAuthzToken());
+      processMap.put("getUserManagementServiceAccountAuthzToken", new getUserManagementServiceAccountAuthzToken());
+      return processMap;
+    }
+
+    public static class isUserAuthenticated<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isUserAuthenticated_args> {
+      public isUserAuthenticated() {
+        super("isUserAuthenticated");
+      }
+
+      public isUserAuthenticated_args getEmptyArgsInstance() {
+        return new isUserAuthenticated_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      @Override
+      protected boolean rethrowUnhandledExceptions() {
+        return false;
+      }
+
+      public isUserAuthenticated_result getResult(I iface, isUserAuthenticated_args args) throws org.apache.thrift.TException {
+        isUserAuthenticated_result result = new isUserAuthenticated_result();
+        try {
+          result.success = iface.isUserAuthenticated(args.authzToken);
+          result.setSuccessIsSet(true);
+        } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+          result.ae = ae;
+        }
+        return result;
+      }
+    }
+
+    public static class getUserInfoFromAuthzToken<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserInfoFromAuthzToken_args> {
+      public getUserInfoFromAuthzToken() {
+        super("getUserInfoFromAuthzToken");
+      }
+
+      public getUserInfoFromAuthzToken_args getEmptyArgsInstance() {
+        return new getUserInfoFromAuthzToken_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      @Override
+      protected boolean rethrowUnhandledExceptions() {
+        return false;
+      }
+
+      public getUserInfoFromAuthzToken_result getResult(I iface, getUserInfoFromAuthzToken_args args) throws org.apache.thrift.TException {
+        getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
+        try {
+          result.success = iface.getUserInfoFromAuthzToken(args.authzToken);
+        } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+          result.ae = ae;
+        }
+        return result;
+      }
+    }
+
+    public static class getUserManagementServiceAccountAuthzToken<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserManagementServiceAccountAuthzToken_args> {
+      public getUserManagementServiceAccountAuthzToken() {
+        super("getUserManagementServiceAccountAuthzToken");
+      }
+
+      public getUserManagementServiceAccountAuthzToken_args getEmptyArgsInstance() {
+        return new getUserManagementServiceAccountAuthzToken_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      @Override
+      protected boolean rethrowUnhandledExceptions() {
+        return false;
+      }
+
+      public getUserManagementServiceAccountAuthzToken_result getResult(I iface, getUserManagementServiceAccountAuthzToken_args args) throws org.apache.thrift.TException {
+        getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
+        try {
+          result.success = iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId);
+        } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+          result.ae = ae;
+        }
+        return result;
+      }
+    }
+
+  }
+
+  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+    private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());
+    public AsyncProcessor(I iface) {
+      super(iface, getProcessMap(new java.util.HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+    }
+
+    protected AsyncProcessor(I iface, java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends AsyncIface> java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      processMap.put("isUserAuthenticated", new isUserAuthenticated());
+      processMap.put("getUserInfoFromAuthzToken", new getUserInfoFromAuthzToken());
+      processMap.put("getUserManagementServiceAccountAuthzToken", new getUserManagementServiceAccountAuthzToken());
+      return processMap;
+    }
+
+    public static class isUserAuthenticated<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, isUserAuthenticated_args, Boolean> {
+      public isUserAuthenticated() {
+        super("isUserAuthenticated");
+      }
+
+      public isUserAuthenticated_args getEmptyArgsInstance() {
+        return new isUserAuthenticated_args();
+      }
+
+      public org.apache.thrift.async.AsyncMethodCallback<Boolean> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new org.apache.thrift.async.AsyncMethodCallback<Boolean>() {
+          public void onComplete(Boolean o) {
+            isUserAuthenticated_result result = new isUserAuthenticated_result();
+            result.success = o;
+            result.setSuccessIsSet(true);
+            try {
+              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+            } catch (org.apache.thrift.transport.TTransportException e) {
+              _LOGGER.error("TTransportException writing to internal frame buffer", e);
+              fb.close();
+            } catch (Exception e) {
+              _LOGGER.error("Exception writing to internal frame buffer", e);
+              onError(e);
+            }
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TSerializable msg;
+            isUserAuthenticated_result result = new isUserAuthenticated_result();
+            if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
+              result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
+              result.setAeIsSet(true);
+              msg = result;
+            } else if (e instanceof org.apache.thrift.transport.TTransportException) {
+              _LOGGER.error("TTransportException inside handler", e);
+              fb.close();
+              return;
+            } else if (e instanceof org.apache.thrift.TApplicationException) {
+              _LOGGER.error("TApplicationException inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TApplicationException)e;
+            } else {
+              _LOGGER.error("Exception inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+            } catch (Exception ex) {
+              _LOGGER.error("Exception writing to internal frame buffer", ex);
+              fb.close();
+            }
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, isUserAuthenticated_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
+        iface.isUserAuthenticated(args.authzToken,resultHandler);
+      }
+    }
+
+    public static class getUserInfoFromAuthzToken<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserInfoFromAuthzToken_args, org.apache.custos.commons.model.security.UserInfo> {
+      public getUserInfoFromAuthzToken() {
+        super("getUserInfoFromAuthzToken");
+      }
+
+      public getUserInfoFromAuthzToken_args getEmptyArgsInstance() {
+        return new getUserInfoFromAuthzToken_args();
+      }
+
+      public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo>() { 
+          public void onComplete(org.apache.custos.commons.model.security.UserInfo o) {
+            getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+            } catch (org.apache.thrift.transport.TTransportException e) {
+              _LOGGER.error("TTransportException writing to internal frame buffer", e);
+              fb.close();
+            } catch (Exception e) {
+              _LOGGER.error("Exception writing to internal frame buffer", e);
+              onError(e);
+            }
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TSerializable msg;
+            getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
+            if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
+              result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
+              result.setAeIsSet(true);
+              msg = result;
+            } else if (e instanceof org.apache.thrift.transport.TTransportException) {
+              _LOGGER.error("TTransportException inside handler", e);
+              fb.close();
+              return;
+            } else if (e instanceof org.apache.thrift.TApplicationException) {
+              _LOGGER.error("TApplicationException inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TApplicationException)e;
+            } else {
+              _LOGGER.error("Exception inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+            } catch (Exception ex) {
+              _LOGGER.error("Exception writing to internal frame buffer", ex);
+              fb.close();
+            }
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getUserInfoFromAuthzToken_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException {
+        iface.getUserInfoFromAuthzToken(args.authzToken,resultHandler);
+      }
+    }
+
+    public static class getUserManagementServiceAccountAuthzToken<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserManagementServiceAccountAuthzToken_args, org.apache.custos.commons.model.security.AuthzToken> {
+      public getUserManagementServiceAccountAuthzToken() {
+        super("getUserManagementServiceAccountAuthzToken");
+      }
+
+      public getUserManagementServiceAccountAuthzToken_args getEmptyArgsInstance() {
+        return new getUserManagementServiceAccountAuthzToken_args();
+      }
+
+      public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken>() { 
+          public void onComplete(org.apache.custos.commons.model.security.AuthzToken o) {
+            getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+            } catch (org.apache.thrift.transport.TTransportException e) {
+              _LOGGER.error("TTransportException writing to internal frame buffer", e);
+              fb.close();
+            } catch (Exception e) {
+              _LOGGER.error("Exception writing to internal frame buffer", e);
+              onError(e);
+            }
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TSerializable msg;
+            getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
+            if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
+              result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
+              result.setAeIsSet(true);
+              msg = result;
+            } else if (e instanceof org.apache.thrift.transport.TTransportException) {
+              _LOGGER.error("TTransportException inside handler", e);
+              fb.close();
+              return;
+            } else if (e instanceof org.apache.thrift.TApplicationException) {
+              _LOGGER.error("TApplicationException inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TApplicationException)e;
+            } else {
+              _LOGGER.error("Exception inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+            } catch (Exception ex) {
+              _LOGGER.error("Exception writing to internal frame buffer", ex);
+              fb.close();
+            }
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getUserManagementServiceAccountAuthzToken_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
+        iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId,resultHandler);
+      }
+    }
+
+  }
+
+  public static class isUserAuthenticated_args implements org.apache.thrift.TBase<isUserAuthenticated_args, isUserAuthenticated_args._Fields>, java.io.Serializable, Cloneable, Comparable<isUserAuthenticated_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isUserAuthenticated_args");
+
+    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new isUserAuthenticated_argsStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new isUserAuthenticated_argsTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      AUTHZ_TOKEN((short)1, "authzToken");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isUserAuthenticated_args.class, metaDataMap);
+    }
+
+    public isUserAuthenticated_args() {
+    }
+
+    public isUserAuthenticated_args(
+      org.apache.custos.commons.model.security.AuthzToken authzToken)
+    {
+      this();
+      this.authzToken = authzToken;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public isUserAuthenticated_args(isUserAuthenticated_args other) {
+      if (other.isSetAuthzToken()) {
+        this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
+      }
+    }
+
+    public isUserAuthenticated_args deepCopy() {
+      return new isUserAuthenticated_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.authzToken = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
+      return this.authzToken;
+    }
+
+    public isUserAuthenticated_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
+      this.authzToken = authzToken;
+      return this;
+    }
+
+    public void unsetAuthzToken() {
+      this.authzToken = null;
+    }
+
+    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAuthzToken() {
+      return this.authzToken != null;
+    }
+
+    public void setAuthzTokenIsSet(boolean value) {
+      if (!value) {
+        this.authzToken = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        if (value == null) {
+          unsetAuthzToken();
+        } else {
+          setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof isUserAuthenticated_args)
+        return this.equals((isUserAuthenticated_args)that);
+      return false;
+    }
+
+    public boolean equals(isUserAuthenticated_args that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_authzToken = true && this.isSetAuthzToken();
+      boolean that_present_authzToken = true && that.isSetAuthzToken();
+      if (this_present_authzToken || that_present_authzToken) {
+        if (!(this_present_authzToken && that_present_authzToken))
+          return false;
+        if (!this.authzToken.equals(that.authzToken))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
+      if (isSetAuthzToken())
+        hashCode = hashCode * 8191 + authzToken.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(isUserAuthenticated_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAuthzToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("isUserAuthenticated_args(");
+      boolean first = true;
+
+      sb.append("authzToken:");
+      if (this.authzToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authzToken);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (authzToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (authzToken != null) {
+        authzToken.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class isUserAuthenticated_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public isUserAuthenticated_argsStandardScheme getScheme() {
+        return new isUserAuthenticated_argsStandardScheme();
+      }
+    }
+
+    private static class isUserAuthenticated_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<isUserAuthenticated_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AUTHZ_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+                struct.authzToken.read(iprot);
+                struct.setAuthzTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.authzToken != null) {
+          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+          struct.authzToken.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class isUserAuthenticated_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public isUserAuthenticated_argsTupleScheme getScheme() {
+        return new isUserAuthenticated_argsTupleScheme();
+      }
+    }
+
+    private static class isUserAuthenticated_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<isUserAuthenticated_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken.write(oprot);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+        struct.authzToken.read(iprot);
+        struct.setAuthzTokenIsSet(true);
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class isUserAuthenticated_result implements org.apache.thrift.TBase<isUserAuthenticated_result, isUserAuthenticated_result._Fields>, java.io.Serializable, Cloneable, Comparable<isUserAuthenticated_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isUserAuthenticated_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
+    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new isUserAuthenticated_resultStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new isUserAuthenticated_resultTupleSchemeFactory();
+
+    public boolean success; // required
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      AE((short)1, "ae");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // AE
+            return AE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    private static final int __SUCCESS_ISSET_ID = 0;
+    private byte __isset_bitfield = 0;
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+      tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isUserAuthenticated_result.class, metaDataMap);
+    }
+
+    public isUserAuthenticated_result() {
+    }
+
+    public isUserAuthenticated_result(
+      boolean success,
+      org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+    {
+      this();
+      this.success = success;
+      setSuccessIsSet(true);
+      this.ae = ae;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public isUserAuthenticated_result(isUserAuthenticated_result other) {
+      __isset_bitfield = other.__isset_bitfield;
+      this.success = other.success;
+      if (other.isSetAe()) {
+        this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
+      }
+    }
+
+    public isUserAuthenticated_result deepCopy() {
+      return new isUserAuthenticated_result(this);
+    }
+
+    @Override
+    public void clear() {
+      setSuccessIsSet(false);
+      this.success = false;
+      this.ae = null;
+    }
+
+    public boolean isSuccess() {
+      return this.success;
+    }
+
+    public isUserAuthenticated_result setSuccess(boolean success) {
+      this.success = success;
+      setSuccessIsSet(true);
+      return this;
+    }
+
+    public void unsetSuccess() {
+      __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
+      return this.ae;
+    }
+
+    public isUserAuthenticated_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+      this.ae = ae;
+      return this;
+    }
+
+    public void unsetAe() {
+      this.ae = null;
+    }
+
+    /** Returns true if field ae is set (has been assigned a value) and false otherwise */
+    public boolean isSetAe() {
+      return this.ae != null;
+    }
+
+    public void setAeIsSet(boolean value) {
+      if (!value) {
+        this.ae = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((Boolean)value);
+        }
+        break;
+
+      case AE:
+        if (value == null) {
+          unsetAe();
+        } else {
+          setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return isSuccess();
+
+      case AE:
+        return getAe();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      case AE:
+        return isSetAe();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof isUserAuthenticated_result)
+        return this.equals((isUserAuthenticated_result)that);
+      return false;
+    }
+
+    public boolean equals(isUserAuthenticated_result that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_success = true;
+      boolean that_present_success = true;
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (this.success != that.success)
+          return false;
+      }
+
+      boolean this_present_ae = true && this.isSetAe();
+      boolean that_present_ae = true && that.isSetAe();
+      if (this_present_ae || that_present_ae) {
+        if (!(this_present_ae && that_present_ae))
+          return false;
+        if (!this.ae.equals(that.ae))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((success) ? 131071 : 524287);
+
+      hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
+      if (isSetAe())
+        hashCode = hashCode * 8191 + ae.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(isUserAuthenticated_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAe()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("isUserAuthenticated_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      sb.append(this.success);
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ae:");
+      if (this.ae == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ae);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+        __isset_bitfield = 0;
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class isUserAuthenticated_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public isUserAuthenticated_resultStandardScheme getScheme() {
+        return new isUserAuthenticated_resultStandardScheme();
+      }
+    }
+
+    private static class isUserAuthenticated_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<isUserAuthenticated_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+                struct.success = iprot.readBool();
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 1: // AE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+                struct.ae.read(iprot);
+                struct.setAeIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.isSetSuccess()) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          oprot.writeBool(struct.success);
+          oprot.writeFieldEnd();
+        }
+        if (struct.ae != null) {
+          oprot.writeFieldBegin(AE_FIELD_DESC);
+          struct.ae.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class isUserAuthenticated_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public isUserAuthenticated_resultTupleScheme getScheme() {
+        return new isUserAuthenticated_resultTupleScheme();
+      }
+    }
+
+    private static class isUserAuthenticated_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<isUserAuthenticated_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet optionals = new java.util.BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        if (struct.isSetAe()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetSuccess()) {
+          oprot.writeBool(struct.success);
+        }
+        if (struct.isSetAe()) {
+          struct.ae.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet incoming = iprot.readBitSet(2);
+        if (incoming.get(0)) {
+          struct.success = iprot.readBool();
+          struct.setSuccessIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+          struct.ae.read(iprot);
+          struct.setAeIsSet(true);
+        }
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class getUserInfoFromAuthzToken_args implements org.apache.thrift.TBase<getUserInfoFromAuthzToken_args, getUserInfoFromAuthzToken_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUserInfoFromAuthzToken_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserInfoFromAuthzToken_args");
+
+    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserInfoFromAuthzToken_argsStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserInfoFromAuthzToken_argsTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      AUTHZ_TOKEN((short)1, "authzToken");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserInfoFromAuthzToken_args.class, metaDataMap);
+    }
+
+    public getUserInfoFromAuthzToken_args() {
+    }
+
+    public getUserInfoFromAuthzToken_args(
+      org.apache.custos.commons.model.security.AuthzToken authzToken)
+    {
+      this();
+      this.authzToken = authzToken;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getUserInfoFromAuthzToken_args(getUserInfoFromAuthzToken_args other) {
+      if (other.isSetAuthzToken()) {
+        this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
+      }
+    }
+
+    public getUserInfoFromAuthzToken_args deepCopy() {
+      return new getUserInfoFromAuthzToken_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.authzToken = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
+      return this.authzToken;
+    }
+
+    public getUserInfoFromAuthzToken_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
+      this.authzToken = authzToken;
+      return this;
+    }
+
+    public void unsetAuthzToken() {
+      this.authzToken = null;
+    }
+
+    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAuthzToken() {
+      return this.authzToken != null;
+    }
+
+    public void setAuthzTokenIsSet(boolean value) {
+      if (!value) {
+        this.authzToken = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        if (value == null) {
+          unsetAuthzToken();
+        } else {
+          setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getUserInfoFromAuthzToken_args)
+        return this.equals((getUserInfoFromAuthzToken_args)that);
+      return false;
+    }
+
+    public boolean equals(getUserInfoFromAuthzToken_args that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_authzToken = true && this.isSetAuthzToken();
+      boolean that_present_authzToken = true && that.isSetAuthzToken();
+      if (this_present_authzToken || that_present_authzToken) {
+        if (!(this_present_authzToken && that_present_authzToken))
+          return false;
+        if (!this.authzToken.equals(that.authzToken))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
+      if (isSetAuthzToken())
+        hashCode = hashCode * 8191 + authzToken.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(getUserInfoFromAuthzToken_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAuthzToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getUserInfoFromAuthzToken_args(");
+      boolean first = true;
+
+      sb.append("authzToken:");
+      if (this.authzToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authzToken);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (authzToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (authzToken != null) {
+        authzToken.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserInfoFromAuthzToken_argsStandardScheme getScheme() {
+        return new getUserInfoFromAuthzToken_argsStandardScheme();
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserInfoFromAuthzToken_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AUTHZ_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+                struct.authzToken.read(iprot);
+                struct.setAuthzTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.authzToken != null) {
+          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+          struct.authzToken.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getUserInfoFromAuthzToken_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserInfoFromAuthzToken_argsTupleScheme getScheme() {
+        return new getUserInfoFromAuthzToken_argsTupleScheme();
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserInfoFromAuthzToken_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken.write(oprot);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+        struct.authzToken.read(iprot);
+        struct.setAuthzTokenIsSet(true);
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class getUserInfoFromAuthzToken_result implements org.apache.thrift.TBase<getUserInfoFromAuthzToken_result, getUserInfoFromAuthzToken_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUserInfoFromAuthzToken_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserInfoFromAuthzToken_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserInfoFromAuthzToken_resultStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserInfoFromAuthzToken_resultTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.UserInfo success; // required
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      AE((short)1, "ae");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // AE
+            return AE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.UserInfo.class)));
+      tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserInfoFromAuthzToken_result.class, metaDataMap);
+    }
+
+    public getUserInfoFromAuthzToken_result() {
+    }
+
+    public getUserInfoFromAuthzToken_result(
+      org.apache.custos.commons.model.security.UserInfo success,
+      org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+    {
+      this();
+      this.success = success;
+      this.ae = ae;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getUserInfoFromAuthzToken_result(getUserInfoFromAuthzToken_result other) {
+      if (other.isSetSuccess()) {
+        this.success = new org.apache.custos.commons.model.security.UserInfo(other.success);
+      }
+      if (other.isSetAe()) {
+        this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
+      }
+    }
+
+    public getUserInfoFromAuthzToken_result deepCopy() {
+      return new getUserInfoFromAuthzToken_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+      this.ae = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.UserInfo getSuccess() {
+      return this.success;
+    }
+
+    public getUserInfoFromAuthzToken_result setSuccess(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.UserInfo success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
+      return this.ae;
+    }
+
+    public getUserInfoFromAuthzToken_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+      this.ae = ae;
+      return this;
+    }
+
+    public void unsetAe() {
+      this.ae = null;
+    }
+
+    /** Returns true if field ae is set (has been assigned a value) and false otherwise */
+    public boolean isSetAe() {
+      return this.ae != null;
+    }
+
+    public void setAeIsSet(boolean value) {
+      if (!value) {
+        this.ae = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((org.apache.custos.commons.model.security.UserInfo)value);
+        }
+        break;
+
+      case AE:
+        if (value == null) {
+          unsetAe();
+        } else {
+          setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      case AE:
+        return getAe();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      case AE:
+        return isSetAe();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getUserInfoFromAuthzToken_result)
+        return this.equals((getUserInfoFromAuthzToken_result)that);
+      return false;
+    }
+
+    public boolean equals(getUserInfoFromAuthzToken_result that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      boolean this_present_ae = true && this.isSetAe();
+      boolean that_present_ae = true && that.isSetAe();
+      if (this_present_ae || that_present_ae) {
+        if (!(this_present_ae && that_present_ae))
+          return false;
+        if (!this.ae.equals(that.ae))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
+      if (isSetSuccess())
+        hashCode = hashCode * 8191 + success.hashCode();
+
+      hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
+      if (isSetAe())
+        hashCode = hashCode * 8191 + ae.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(getUserInfoFromAuthzToken_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAe()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getUserInfoFromAuthzToken_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ae:");
+      if (this.ae == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ae);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+      if (success != null) {
+        success.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserInfoFromAuthzToken_resultStandardScheme getScheme() {
+        return new getUserInfoFromAuthzToken_resultStandardScheme();
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserInfoFromAuthzToken_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.success = new org.apache.custos.commons.model.security.UserInfo();
+                struct.success.read(iprot);
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 1: // AE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+                struct.ae.read(iprot);
+                struct.setAeIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          struct.success.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        if (struct.ae != null) {
+          oprot.writeFieldBegin(AE_FIELD_DESC);
+          struct.ae.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getUserInfoFromAuthzToken_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserInfoFromAuthzToken_resultTupleScheme getScheme() {
+        return new getUserInfoFromAuthzToken_resultTupleScheme();
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserInfoFromAuthzToken_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet optionals = new java.util.BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        if (struct.isSetAe()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetSuccess()) {
+          struct.success.write(oprot);
+        }
+        if (struct.isSetAe()) {
+          struct.ae.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet incoming = iprot.readBitSet(2);
+        if (incoming.get(0)) {
+          struct.success = new org.apache.custos.commons.model.security.UserInfo();
+          struct.success.read(iprot);
+          struct.setSuccessIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+          struct.ae.read(iprot);
+          struct.setAeIsSet(true);
+        }
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class getUserManagementServiceAccountAuthzToken_args implements org.apache.thrift.TBase<getUserManagementServiceAccountAuthzToken_args, getUserManagementServiceAccountAuthzToken_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUserManagementServiceAccountAuthzToken_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserManagementServiceAccountAuthzToken_args");
+
+    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+    private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_argsStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_argsTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
+    public @org.apache.thrift.annotation.Nullable String gatewayId; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      AUTHZ_TOKEN((short)1, "authzToken"),
+      GATEWAY_ID((short)2, "gatewayId");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          case 2: // GATEWAY_ID
+            return GATEWAY_ID;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+      tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserManagementServiceAccountAuthzToken_args.class, metaDataMap);
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args() {
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args(
+      org.apache.custos.commons.model.security.AuthzToken authzToken,
+      String gatewayId)
+    {
+      this();
+      this.authzToken = authzToken;
+      this.gatewayId = gatewayId;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getUserManagementServiceAccountAuthzToken_args(getUserManagementServiceAccountAuthzToken_args other) {
+      if (other.isSetAuthzToken()) {
+        this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
+      }
+      if (other.isSetGatewayId()) {
+        this.gatewayId = other.gatewayId;
+      }
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args deepCopy() {
+      return new getUserManagementServiceAccountAuthzToken_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.authzToken = null;
+      this.gatewayId = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
+      return this.authzToken;
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
+      this.authzToken = authzToken;
+      return this;
+    }
+
+    public void unsetAuthzToken() {
+      this.authzToken = null;
+    }
+
+    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAuthzToken() {
+      return this.authzToken != null;
+    }
+
+    public void setAuthzTokenIsSet(boolean value) {
+      if (!value) {
+        this.authzToken = null;
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public String getGatewayId() {
+      return this.gatewayId;
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args setGatewayId(@org.apache.thrift.annotation.Nullable String gatewayId) {
+      this.gatewayId = gatewayId;
+      return this;
+    }
+
+    public void unsetGatewayId() {
+      this.gatewayId = null;
+    }
+
+    /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */
+    public boolean isSetGatewayId() {
+      return this.gatewayId != null;
+    }
+
+    public void setGatewayIdIsSet(boolean value) {
+      if (!value) {
+        this.gatewayId = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        if (value == null) {
+          unsetAuthzToken();
+        } else {
+          setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+        }
+        break;
+
+      case GATEWAY_ID:
+        if (value == null) {
+          unsetGatewayId();
+        } else {
+          setGatewayId((String)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
+      case GATEWAY_ID:
+        return getGatewayId();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
+      case GATEWAY_ID:
+        return isSetGatewayId();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getUserManagementServiceAccountAuthzToken_args)
+        return this.equals((getUserManagementServiceAccountAuthzToken_args)that);
+      return false;
+    }
+
+    public boolean equals(getUserManagementServiceAccountAuthzToken_args that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_authzToken = true && this.isSetAuthzToken();
+      boolean that_present_authzToken = true && that.isSetAuthzToken();
+      if (this_present_authzToken || that_present_authzToken) {
+        if (!(this_present_authzToken && that_present_authzToken))
+          return false;
+        if (!this.authzToken.equals(that.authzToken))
+          return false;
+      }
+
+      boolean this_present_gatewayId = true && this.isSetGatewayId();
+      boolean that_present_gatewayId = true && that.isSetGatewayId();
+      if (this_present_gatewayId || that_present_gatewayId) {
+        if (!(this_present_gatewayId && that_present_gatewayId))
+          return false;
+        if (!this.gatewayId.equals(that.gatewayId))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
+      if (isSetAuthzToken())
+        hashCode = hashCode * 8191 + authzToken.hashCode();
+
+      hashCode = hashCode * 8191 + ((isSetGatewayId()) ? 131071 : 524287);
+      if (isSetGatewayId())
+        hashCode = hashCode * 8191 + gatewayId.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(getUserManagementServiceAccountAuthzToken_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAuthzToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetGatewayId()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getUserManagementServiceAccountAuthzToken_args(");
+      boolean first = true;
+
+      sb.append("authzToken:");
+      if (this.authzToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authzToken);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("gatewayId:");
+      if (this.gatewayId == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.gatewayId);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (authzToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+      }
+      if (gatewayId == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (authzToken != null) {
+        authzToken.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserManagementServiceAccountAuthzToken_argsStandardScheme getScheme() {
+        return new getUserManagementServiceAccountAuthzToken_argsStandardScheme();
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserManagementServiceAccountAuthzToken_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AUTHZ_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+                struct.authzToken.read(iprot);
+                struct.setAuthzTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 2: // GATEWAY_ID
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.gatewayId = iprot.readString();
+                struct.setGatewayIdIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.authzToken != null) {
+          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+          struct.authzToken.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        if (struct.gatewayId != null) {
+          oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
+          oprot.writeString(struct.gatewayId);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserManagementServiceAccountAuthzToken_argsTupleScheme getScheme() {
+        return new getUserManagementServiceAccountAuthzToken_argsTupleScheme();
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserManagementServiceAccountAuthzToken_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken.write(oprot);
+        oprot.writeString(struct.gatewayId);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+        struct.authzToken.read(iprot);
+        struct.setAuthzTokenIsSet(true);
+        struct.gatewayId = iprot.readString();
+        struct.setGatewayIdIsSet(true);
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class getUserManagementServiceAccountAuthzToken_result implements org.apache.thrift.TBase<getUserManagementServiceAccountAuthzToken_result, getUserManagementServiceAccountAuthzToken_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUserManagementServiceAccountAuthzToken_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserManagementServiceAccountAuthzToken_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_resultStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_resultTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken success; // required
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      AE((short)1, "ae");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // AE
+            return AE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+      tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserManagementServiceAccountAuthzToken_result.class, metaDataMap);
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result() {
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result(
+      org.apache.custos.commons.model.security.AuthzToken success,
+      org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+    {
+      this();
+      this.success = success;
+      this.ae = ae;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getUserManagementServiceAccountAuthzToken_result(getUserManagementServiceAccountAuthzToken_result other) {
+      if (other.isSetSuccess()) {
+        this.success = new org.apache.custos.commons.model.security.AuthzToken(other.success);
+      }
+      if (other.isSetAe()) {
+        this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
+      }
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result deepCopy() {
+      return new getUserManagementServiceAccountAuthzToken_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+      this.ae = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.AuthzToken getSuccess() {
+      return this.success;
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result setSuccess(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
+      return this.ae;
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+      this.ae = ae;
+      return this;
+    }
+
+    public void unsetAe() {
+      this.ae = null;
+    }
+
+    /** Returns true if field ae is set (has been assigned a value) and false otherwise */
+    public boolean isSetAe() {
+      return this.ae != null;
+    }
+
+    public void setAeIsSet(boolean value) {
+      if (!value) {
+        this.ae = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((org.apache.custos.commons.model.security.AuthzToken)value);
+        }
+        break;
+
+      case AE:
+        if (value == null) {
+          unsetAe();
+        } else {
+          setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      case AE:
+        return getAe();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      case AE:
+        return isSetAe();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getUserManagementServiceAccountAuthzToken_result)
+        return this.equals((getUserManagementServiceAccountAuthzToken_result)that);
+      return false;
+    }
+
+    public boolean equals(getUserManagementServiceAccountAuthzToken_result that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      boolean this_present_ae = true && this.isSetAe();
+      boolean that_present_ae = true && that.isSetAe();
+      if (this_present_ae || that_present_ae) {
+        if (!(this_present_ae && that_present_ae))
+          return false;
+        if (!this.ae.equals(that.ae))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
+      if (isSetSuccess())
+        hashCode = hashCode * 8191 + success.hashCode();
+
+      hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
+      if (isSetAe())
+        hashCode = hashCode * 8191 + ae.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(getUserManagementServiceAccountAuthzToken_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAe()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getUserManagementServiceAccountAuthzToken_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ae:");
+      if (this.ae == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ae);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+      if (success != null) {
+        success.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserManagementServiceAccountAuthzToken_resultStandardScheme getScheme() {
+        return new getUserManagementServiceAccountAuthzToken_resultStandardScheme();
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserManagementServiceAccountAuthzToken_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.success = new org.apache.custos.commons.model.security.AuthzToken();
+                struct.success.read(iprot);
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 1: // AE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+                struct.ae.read(iprot);
+                struct.setAeIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          struct.success.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        if (struct.ae != null) {
+          oprot.writeFieldBegin(AE_FIELD_DESC);
+          struct.ae.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserManagementServiceAccountAuthzToken_resultTupleScheme getScheme() {
+        return new getUserManagementServiceAccountAuthzToken_resultTupleScheme();
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserManagementServiceAccountAuthzToken_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet optionals = new java.util.BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        if (struct.isSetAe()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetSuccess()) {
+          struct.success.write(oprot);
+        }
+        if (struct.isSetAe()) {
+          struct.ae.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet incoming = iprot.readBitSet(2);
+        if (incoming.get(0)) {
+          struct.success = new org.apache.custos.commons.model.security.AuthzToken();
+          struct.success.read(iprot);
+          struct.setSuccessIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+          struct.ae.read(iprot);
+          struct.setAeIsSet(true);
+        }
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+}
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java b/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java
new file mode 100644
index 0000000..9c4b981
--- /dev/null
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/CustosAuthenticationService.java
@@ -0,0 +1,3198 @@
+/**
+ * Autogenerated by Thrift Compiler (0.12.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.custos.authentication.cpi;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-08")
+public class CustosAuthenticationService {
+
+  public interface Iface {
+
+    public boolean isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
+
+    public org.apache.custos.commons.model.security.UserInfo getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
+
+    public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException;
+
+  }
+
+  public interface AsyncIface {
+
+    public void isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException;
+
+    public void getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException;
+
+    public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException;
+
+  }
+
+  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
+    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
+      public Factory() {}
+      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
+        return new Client(prot);
+      }
+      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+        return new Client(iprot, oprot);
+      }
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol prot)
+    {
+      super(prot, prot);
+    }
+
+    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
+      super(iprot, oprot);
+    }
+
+    public boolean isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      send_isUserAuthenticated(authzToken);
+      return recv_isUserAuthenticated();
+    }
+
+    public void send_isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.thrift.TException
+    {
+      isUserAuthenticated_args args = new isUserAuthenticated_args();
+      args.setAuthzToken(authzToken);
+      sendBase("isUserAuthenticated", args);
+    }
+
+    public boolean recv_isUserAuthenticated() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      isUserAuthenticated_result result = new isUserAuthenticated_result();
+      receiveBase(result, "isUserAuthenticated");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.ae != null) {
+        throw result.ae;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "isUserAuthenticated failed: unknown result");
+    }
+
+    public org.apache.custos.commons.model.security.UserInfo getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      send_getUserInfoFromAuthzToken(authzToken);
+      return recv_getUserInfoFromAuthzToken();
+    }
+
+    public void send_getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken) throws org.apache.thrift.TException
+    {
+      getUserInfoFromAuthzToken_args args = new getUserInfoFromAuthzToken_args();
+      args.setAuthzToken(authzToken);
+      sendBase("getUserInfoFromAuthzToken", args);
+    }
+
+    public org.apache.custos.commons.model.security.UserInfo recv_getUserInfoFromAuthzToken() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
+      receiveBase(result, "getUserInfoFromAuthzToken");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.ae != null) {
+        throw result.ae;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserInfoFromAuthzToken failed: unknown result");
+    }
+
+    public org.apache.custos.commons.model.security.AuthzToken getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      send_getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
+      return recv_getUserManagementServiceAccountAuthzToken();
+    }
+
+    public void send_getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId) throws org.apache.thrift.TException
+    {
+      getUserManagementServiceAccountAuthzToken_args args = new getUserManagementServiceAccountAuthzToken_args();
+      args.setAuthzToken(authzToken);
+      args.setGatewayId(gatewayId);
+      sendBase("getUserManagementServiceAccountAuthzToken", args);
+    }
+
+    public org.apache.custos.commons.model.security.AuthzToken recv_getUserManagementServiceAccountAuthzToken() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException
+    {
+      getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
+      receiveBase(result, "getUserManagementServiceAccountAuthzToken");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.ae != null) {
+        throw result.ae;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getUserManagementServiceAccountAuthzToken failed: unknown result");
+    }
+
+  }
+  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
+    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
+      private org.apache.thrift.async.TAsyncClientManager clientManager;
+      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
+      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
+        this.clientManager = clientManager;
+        this.protocolFactory = protocolFactory;
+      }
+      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
+        return new AsyncClient(protocolFactory, clientManager, transport);
+      }
+    }
+
+    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
+      super(protocolFactory, clientManager, transport);
+    }
+
+    public void isUserAuthenticated(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      isUserAuthenticated_call method_call = new isUserAuthenticated_call(authzToken, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class isUserAuthenticated_call extends org.apache.thrift.async.TAsyncMethodCall<Boolean> {
+      private org.apache.custos.commons.model.security.AuthzToken authzToken;
+      public isUserAuthenticated_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.authzToken = authzToken;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("isUserAuthenticated", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        isUserAuthenticated_args args = new isUserAuthenticated_args();
+        args.setAuthzToken(authzToken);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public Boolean getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_isUserAuthenticated();
+      }
+    }
+
+    public void getUserInfoFromAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getUserInfoFromAuthzToken_call method_call = new getUserInfoFromAuthzToken_call(authzToken, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getUserInfoFromAuthzToken_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.commons.model.security.UserInfo> {
+      private org.apache.custos.commons.model.security.AuthzToken authzToken;
+      public getUserInfoFromAuthzToken_call(org.apache.custos.commons.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.authzToken = authzToken;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserInfoFromAuthzToken", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getUserInfoFromAuthzToken_args args = new getUserInfoFromAuthzToken_args();
+        args.setAuthzToken(authzToken);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.custos.commons.model.security.UserInfo getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getUserInfoFromAuthzToken();
+      }
+    }
+
+    public void getUserManagementServiceAccountAuthzToken(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      getUserManagementServiceAccountAuthzToken_call method_call = new getUserManagementServiceAccountAuthzToken_call(authzToken, gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class getUserManagementServiceAccountAuthzToken_call extends org.apache.thrift.async.TAsyncMethodCall<org.apache.custos.commons.model.security.AuthzToken> {
+      private org.apache.custos.commons.model.security.AuthzToken authzToken;
+      private String gatewayId;
+      public getUserManagementServiceAccountAuthzToken_call(org.apache.custos.commons.model.security.AuthzToken authzToken, String gatewayId, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.authzToken = authzToken;
+        this.gatewayId = gatewayId;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getUserManagementServiceAccountAuthzToken", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        getUserManagementServiceAccountAuthzToken_args args = new getUserManagementServiceAccountAuthzToken_args();
+        args.setAuthzToken(authzToken);
+        args.setGatewayId(gatewayId);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public org.apache.custos.commons.model.security.AuthzToken getResult() throws org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException, org.apache.thrift.TException {
+        if (getState() != State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_getUserManagementServiceAccountAuthzToken();
+      }
+    }
+
+  }
+
+  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
+    private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
+    public Processor(I iface) {
+      super(iface, getProcessMap(new java.util.HashMap<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
+    }
+
+    protected Processor(I iface, java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends Iface> java.util.Map<String,  org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(java.util.Map<String, org.apache.thrift.ProcessFunction<I, ? extends  org.apache.thrift.TBase>> processMap) {
+      processMap.put("isUserAuthenticated", new isUserAuthenticated());
+      processMap.put("getUserInfoFromAuthzToken", new getUserInfoFromAuthzToken());
+      processMap.put("getUserManagementServiceAccountAuthzToken", new getUserManagementServiceAccountAuthzToken());
+      return processMap;
+    }
+
+    public static class isUserAuthenticated<I extends Iface> extends org.apache.thrift.ProcessFunction<I, isUserAuthenticated_args> {
+      public isUserAuthenticated() {
+        super("isUserAuthenticated");
+      }
+
+      public isUserAuthenticated_args getEmptyArgsInstance() {
+        return new isUserAuthenticated_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      @Override
+      protected boolean rethrowUnhandledExceptions() {
+        return false;
+      }
+
+      public isUserAuthenticated_result getResult(I iface, isUserAuthenticated_args args) throws org.apache.thrift.TException {
+        isUserAuthenticated_result result = new isUserAuthenticated_result();
+        try {
+          result.success = iface.isUserAuthenticated(args.authzToken);
+          result.setSuccessIsSet(true);
+        } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+          result.ae = ae;
+        }
+        return result;
+      }
+    }
+
+    public static class getUserInfoFromAuthzToken<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserInfoFromAuthzToken_args> {
+      public getUserInfoFromAuthzToken() {
+        super("getUserInfoFromAuthzToken");
+      }
+
+      public getUserInfoFromAuthzToken_args getEmptyArgsInstance() {
+        return new getUserInfoFromAuthzToken_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      @Override
+      protected boolean rethrowUnhandledExceptions() {
+        return false;
+      }
+
+      public getUserInfoFromAuthzToken_result getResult(I iface, getUserInfoFromAuthzToken_args args) throws org.apache.thrift.TException {
+        getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
+        try {
+          result.success = iface.getUserInfoFromAuthzToken(args.authzToken);
+        } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+          result.ae = ae;
+        }
+        return result;
+      }
+    }
+
+    public static class getUserManagementServiceAccountAuthzToken<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getUserManagementServiceAccountAuthzToken_args> {
+      public getUserManagementServiceAccountAuthzToken() {
+        super("getUserManagementServiceAccountAuthzToken");
+      }
+
+      public getUserManagementServiceAccountAuthzToken_args getEmptyArgsInstance() {
+        return new getUserManagementServiceAccountAuthzToken_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      @Override
+      protected boolean rethrowUnhandledExceptions() {
+        return false;
+      }
+
+      public getUserManagementServiceAccountAuthzToken_result getResult(I iface, getUserManagementServiceAccountAuthzToken_args args) throws org.apache.thrift.TException {
+        getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
+        try {
+          result.success = iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId);
+        } catch (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+          result.ae = ae;
+        }
+        return result;
+      }
+    }
+
+  }
+
+  public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
+    private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());
+    public AsyncProcessor(I iface) {
+      super(iface, getProcessMap(new java.util.HashMap<String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
+    }
+
+    protected AsyncProcessor(I iface, java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      super(iface, getProcessMap(processMap));
+    }
+
+    private static <I extends AsyncIface> java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase,?>> getProcessMap(java.util.Map<String,  org.apache.thrift.AsyncProcessFunction<I, ? extends  org.apache.thrift.TBase, ?>> processMap) {
+      processMap.put("isUserAuthenticated", new isUserAuthenticated());
+      processMap.put("getUserInfoFromAuthzToken", new getUserInfoFromAuthzToken());
+      processMap.put("getUserManagementServiceAccountAuthzToken", new getUserManagementServiceAccountAuthzToken());
+      return processMap;
+    }
+
+    public static class isUserAuthenticated<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, isUserAuthenticated_args, Boolean> {
+      public isUserAuthenticated() {
+        super("isUserAuthenticated");
+      }
+
+      public isUserAuthenticated_args getEmptyArgsInstance() {
+        return new isUserAuthenticated_args();
+      }
+
+      public org.apache.thrift.async.AsyncMethodCallback<Boolean> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new org.apache.thrift.async.AsyncMethodCallback<Boolean>() {
+          public void onComplete(Boolean o) {
+            isUserAuthenticated_result result = new isUserAuthenticated_result();
+            result.success = o;
+            result.setSuccessIsSet(true);
+            try {
+              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+            } catch (org.apache.thrift.transport.TTransportException e) {
+              _LOGGER.error("TTransportException writing to internal frame buffer", e);
+              fb.close();
+            } catch (Exception e) {
+              _LOGGER.error("Exception writing to internal frame buffer", e);
+              onError(e);
+            }
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TSerializable msg;
+            isUserAuthenticated_result result = new isUserAuthenticated_result();
+            if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
+              result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
+              result.setAeIsSet(true);
+              msg = result;
+            } else if (e instanceof org.apache.thrift.transport.TTransportException) {
+              _LOGGER.error("TTransportException inside handler", e);
+              fb.close();
+              return;
+            } else if (e instanceof org.apache.thrift.TApplicationException) {
+              _LOGGER.error("TApplicationException inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TApplicationException)e;
+            } else {
+              _LOGGER.error("Exception inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+            } catch (Exception ex) {
+              _LOGGER.error("Exception writing to internal frame buffer", ex);
+              fb.close();
+            }
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, isUserAuthenticated_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws org.apache.thrift.TException {
+        iface.isUserAuthenticated(args.authzToken,resultHandler);
+      }
+    }
+
+    public static class getUserInfoFromAuthzToken<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserInfoFromAuthzToken_args, org.apache.custos.commons.model.security.UserInfo> {
+      public getUserInfoFromAuthzToken() {
+        super("getUserInfoFromAuthzToken");
+      }
+
+      public getUserInfoFromAuthzToken_args getEmptyArgsInstance() {
+        return new getUserInfoFromAuthzToken_args();
+      }
+
+      public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo>() { 
+          public void onComplete(org.apache.custos.commons.model.security.UserInfo o) {
+            getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+            } catch (org.apache.thrift.transport.TTransportException e) {
+              _LOGGER.error("TTransportException writing to internal frame buffer", e);
+              fb.close();
+            } catch (Exception e) {
+              _LOGGER.error("Exception writing to internal frame buffer", e);
+              onError(e);
+            }
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TSerializable msg;
+            getUserInfoFromAuthzToken_result result = new getUserInfoFromAuthzToken_result();
+            if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
+              result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
+              result.setAeIsSet(true);
+              msg = result;
+            } else if (e instanceof org.apache.thrift.transport.TTransportException) {
+              _LOGGER.error("TTransportException inside handler", e);
+              fb.close();
+              return;
+            } else if (e instanceof org.apache.thrift.TApplicationException) {
+              _LOGGER.error("TApplicationException inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TApplicationException)e;
+            } else {
+              _LOGGER.error("Exception inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+            } catch (Exception ex) {
+              _LOGGER.error("Exception writing to internal frame buffer", ex);
+              fb.close();
+            }
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getUserInfoFromAuthzToken_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.UserInfo> resultHandler) throws org.apache.thrift.TException {
+        iface.getUserInfoFromAuthzToken(args.authzToken,resultHandler);
+      }
+    }
+
+    public static class getUserManagementServiceAccountAuthzToken<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getUserManagementServiceAccountAuthzToken_args, org.apache.custos.commons.model.security.AuthzToken> {
+      public getUserManagementServiceAccountAuthzToken() {
+        super("getUserManagementServiceAccountAuthzToken");
+      }
+
+      public getUserManagementServiceAccountAuthzToken_args getEmptyArgsInstance() {
+        return new getUserManagementServiceAccountAuthzToken_args();
+      }
+
+      public org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken>() { 
+          public void onComplete(org.apache.custos.commons.model.security.AuthzToken o) {
+            getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
+            result.success = o;
+            try {
+              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+            } catch (org.apache.thrift.transport.TTransportException e) {
+              _LOGGER.error("TTransportException writing to internal frame buffer", e);
+              fb.close();
+            } catch (Exception e) {
+              _LOGGER.error("Exception writing to internal frame buffer", e);
+              onError(e);
+            }
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TSerializable msg;
+            getUserManagementServiceAccountAuthzToken_result result = new getUserManagementServiceAccountAuthzToken_result();
+            if (e instanceof org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) {
+              result.ae = (org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException) e;
+              result.setAeIsSet(true);
+              msg = result;
+            } else if (e instanceof org.apache.thrift.transport.TTransportException) {
+              _LOGGER.error("TTransportException inside handler", e);
+              fb.close();
+              return;
+            } else if (e instanceof org.apache.thrift.TApplicationException) {
+              _LOGGER.error("TApplicationException inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TApplicationException)e;
+            } else {
+              _LOGGER.error("Exception inside handler", e);
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+            } catch (Exception ex) {
+              _LOGGER.error("Exception writing to internal frame buffer", ex);
+              fb.close();
+            }
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, getUserManagementServiceAccountAuthzToken_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.custos.commons.model.security.AuthzToken> resultHandler) throws org.apache.thrift.TException {
+        iface.getUserManagementServiceAccountAuthzToken(args.authzToken, args.gatewayId,resultHandler);
+      }
+    }
+
+  }
+
+  public static class isUserAuthenticated_args implements org.apache.thrift.TBase<isUserAuthenticated_args, isUserAuthenticated_args._Fields>, java.io.Serializable, Cloneable, Comparable<isUserAuthenticated_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isUserAuthenticated_args");
+
+    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new isUserAuthenticated_argsStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new isUserAuthenticated_argsTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      AUTHZ_TOKEN((short)1, "authzToken");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isUserAuthenticated_args.class, metaDataMap);
+    }
+
+    public isUserAuthenticated_args() {
+    }
+
+    public isUserAuthenticated_args(
+      org.apache.custos.commons.model.security.AuthzToken authzToken)
+    {
+      this();
+      this.authzToken = authzToken;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public isUserAuthenticated_args(isUserAuthenticated_args other) {
+      if (other.isSetAuthzToken()) {
+        this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
+      }
+    }
+
+    public isUserAuthenticated_args deepCopy() {
+      return new isUserAuthenticated_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.authzToken = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
+      return this.authzToken;
+    }
+
+    public isUserAuthenticated_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
+      this.authzToken = authzToken;
+      return this;
+    }
+
+    public void unsetAuthzToken() {
+      this.authzToken = null;
+    }
+
+    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAuthzToken() {
+      return this.authzToken != null;
+    }
+
+    public void setAuthzTokenIsSet(boolean value) {
+      if (!value) {
+        this.authzToken = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        if (value == null) {
+          unsetAuthzToken();
+        } else {
+          setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof isUserAuthenticated_args)
+        return this.equals((isUserAuthenticated_args)that);
+      return false;
+    }
+
+    public boolean equals(isUserAuthenticated_args that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_authzToken = true && this.isSetAuthzToken();
+      boolean that_present_authzToken = true && that.isSetAuthzToken();
+      if (this_present_authzToken || that_present_authzToken) {
+        if (!(this_present_authzToken && that_present_authzToken))
+          return false;
+        if (!this.authzToken.equals(that.authzToken))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
+      if (isSetAuthzToken())
+        hashCode = hashCode * 8191 + authzToken.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(isUserAuthenticated_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAuthzToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("isUserAuthenticated_args(");
+      boolean first = true;
+
+      sb.append("authzToken:");
+      if (this.authzToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authzToken);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (authzToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (authzToken != null) {
+        authzToken.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class isUserAuthenticated_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public isUserAuthenticated_argsStandardScheme getScheme() {
+        return new isUserAuthenticated_argsStandardScheme();
+      }
+    }
+
+    private static class isUserAuthenticated_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<isUserAuthenticated_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AUTHZ_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+                struct.authzToken.read(iprot);
+                struct.setAuthzTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.authzToken != null) {
+          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+          struct.authzToken.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class isUserAuthenticated_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public isUserAuthenticated_argsTupleScheme getScheme() {
+        return new isUserAuthenticated_argsTupleScheme();
+      }
+    }
+
+    private static class isUserAuthenticated_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<isUserAuthenticated_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken.write(oprot);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+        struct.authzToken.read(iprot);
+        struct.setAuthzTokenIsSet(true);
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class isUserAuthenticated_result implements org.apache.thrift.TBase<isUserAuthenticated_result, isUserAuthenticated_result._Fields>, java.io.Serializable, Cloneable, Comparable<isUserAuthenticated_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("isUserAuthenticated_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0);
+    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new isUserAuthenticated_resultStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new isUserAuthenticated_resultTupleSchemeFactory();
+
+    public boolean success; // required
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      AE((short)1, "ae");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // AE
+            return AE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    private static final int __SUCCESS_ISSET_ID = 0;
+    private byte __isset_bitfield = 0;
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+      tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(isUserAuthenticated_result.class, metaDataMap);
+    }
+
+    public isUserAuthenticated_result() {
+    }
+
+    public isUserAuthenticated_result(
+      boolean success,
+      org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+    {
+      this();
+      this.success = success;
+      setSuccessIsSet(true);
+      this.ae = ae;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public isUserAuthenticated_result(isUserAuthenticated_result other) {
+      __isset_bitfield = other.__isset_bitfield;
+      this.success = other.success;
+      if (other.isSetAe()) {
+        this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
+      }
+    }
+
+    public isUserAuthenticated_result deepCopy() {
+      return new isUserAuthenticated_result(this);
+    }
+
+    @Override
+    public void clear() {
+      setSuccessIsSet(false);
+      this.success = false;
+      this.ae = null;
+    }
+
+    public boolean isSuccess() {
+      return this.success;
+    }
+
+    public isUserAuthenticated_result setSuccess(boolean success) {
+      this.success = success;
+      setSuccessIsSet(true);
+      return this;
+    }
+
+    public void unsetSuccess() {
+      __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
+      return this.ae;
+    }
+
+    public isUserAuthenticated_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+      this.ae = ae;
+      return this;
+    }
+
+    public void unsetAe() {
+      this.ae = null;
+    }
+
+    /** Returns true if field ae is set (has been assigned a value) and false otherwise */
+    public boolean isSetAe() {
+      return this.ae != null;
+    }
+
+    public void setAeIsSet(boolean value) {
+      if (!value) {
+        this.ae = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((Boolean)value);
+        }
+        break;
+
+      case AE:
+        if (value == null) {
+          unsetAe();
+        } else {
+          setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return isSuccess();
+
+      case AE:
+        return getAe();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      case AE:
+        return isSetAe();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof isUserAuthenticated_result)
+        return this.equals((isUserAuthenticated_result)that);
+      return false;
+    }
+
+    public boolean equals(isUserAuthenticated_result that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_success = true;
+      boolean that_present_success = true;
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (this.success != that.success)
+          return false;
+      }
+
+      boolean this_present_ae = true && this.isSetAe();
+      boolean that_present_ae = true && that.isSetAe();
+      if (this_present_ae || that_present_ae) {
+        if (!(this_present_ae && that_present_ae))
+          return false;
+        if (!this.ae.equals(that.ae))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((success) ? 131071 : 524287);
+
+      hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
+      if (isSetAe())
+        hashCode = hashCode * 8191 + ae.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(isUserAuthenticated_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAe()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("isUserAuthenticated_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      sb.append(this.success);
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ae:");
+      if (this.ae == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ae);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+        __isset_bitfield = 0;
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class isUserAuthenticated_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public isUserAuthenticated_resultStandardScheme getScheme() {
+        return new isUserAuthenticated_resultStandardScheme();
+      }
+    }
+
+    private static class isUserAuthenticated_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<isUserAuthenticated_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+                struct.success = iprot.readBool();
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 1: // AE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+                struct.ae.read(iprot);
+                struct.setAeIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.isSetSuccess()) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          oprot.writeBool(struct.success);
+          oprot.writeFieldEnd();
+        }
+        if (struct.ae != null) {
+          oprot.writeFieldBegin(AE_FIELD_DESC);
+          struct.ae.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class isUserAuthenticated_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public isUserAuthenticated_resultTupleScheme getScheme() {
+        return new isUserAuthenticated_resultTupleScheme();
+      }
+    }
+
+    private static class isUserAuthenticated_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<isUserAuthenticated_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet optionals = new java.util.BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        if (struct.isSetAe()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetSuccess()) {
+          oprot.writeBool(struct.success);
+        }
+        if (struct.isSetAe()) {
+          struct.ae.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, isUserAuthenticated_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet incoming = iprot.readBitSet(2);
+        if (incoming.get(0)) {
+          struct.success = iprot.readBool();
+          struct.setSuccessIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+          struct.ae.read(iprot);
+          struct.setAeIsSet(true);
+        }
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class getUserInfoFromAuthzToken_args implements org.apache.thrift.TBase<getUserInfoFromAuthzToken_args, getUserInfoFromAuthzToken_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUserInfoFromAuthzToken_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserInfoFromAuthzToken_args");
+
+    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserInfoFromAuthzToken_argsStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserInfoFromAuthzToken_argsTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      AUTHZ_TOKEN((short)1, "authzToken");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserInfoFromAuthzToken_args.class, metaDataMap);
+    }
+
+    public getUserInfoFromAuthzToken_args() {
+    }
+
+    public getUserInfoFromAuthzToken_args(
+      org.apache.custos.commons.model.security.AuthzToken authzToken)
+    {
+      this();
+      this.authzToken = authzToken;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getUserInfoFromAuthzToken_args(getUserInfoFromAuthzToken_args other) {
+      if (other.isSetAuthzToken()) {
+        this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
+      }
+    }
+
+    public getUserInfoFromAuthzToken_args deepCopy() {
+      return new getUserInfoFromAuthzToken_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.authzToken = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
+      return this.authzToken;
+    }
+
+    public getUserInfoFromAuthzToken_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
+      this.authzToken = authzToken;
+      return this;
+    }
+
+    public void unsetAuthzToken() {
+      this.authzToken = null;
+    }
+
+    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAuthzToken() {
+      return this.authzToken != null;
+    }
+
+    public void setAuthzTokenIsSet(boolean value) {
+      if (!value) {
+        this.authzToken = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        if (value == null) {
+          unsetAuthzToken();
+        } else {
+          setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getUserInfoFromAuthzToken_args)
+        return this.equals((getUserInfoFromAuthzToken_args)that);
+      return false;
+    }
+
+    public boolean equals(getUserInfoFromAuthzToken_args that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_authzToken = true && this.isSetAuthzToken();
+      boolean that_present_authzToken = true && that.isSetAuthzToken();
+      if (this_present_authzToken || that_present_authzToken) {
+        if (!(this_present_authzToken && that_present_authzToken))
+          return false;
+        if (!this.authzToken.equals(that.authzToken))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
+      if (isSetAuthzToken())
+        hashCode = hashCode * 8191 + authzToken.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(getUserInfoFromAuthzToken_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAuthzToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getUserInfoFromAuthzToken_args(");
+      boolean first = true;
+
+      sb.append("authzToken:");
+      if (this.authzToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authzToken);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (authzToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (authzToken != null) {
+        authzToken.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserInfoFromAuthzToken_argsStandardScheme getScheme() {
+        return new getUserInfoFromAuthzToken_argsStandardScheme();
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserInfoFromAuthzToken_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AUTHZ_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+                struct.authzToken.read(iprot);
+                struct.setAuthzTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.authzToken != null) {
+          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+          struct.authzToken.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getUserInfoFromAuthzToken_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserInfoFromAuthzToken_argsTupleScheme getScheme() {
+        return new getUserInfoFromAuthzToken_argsTupleScheme();
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserInfoFromAuthzToken_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken.write(oprot);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+        struct.authzToken.read(iprot);
+        struct.setAuthzTokenIsSet(true);
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class getUserInfoFromAuthzToken_result implements org.apache.thrift.TBase<getUserInfoFromAuthzToken_result, getUserInfoFromAuthzToken_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUserInfoFromAuthzToken_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserInfoFromAuthzToken_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserInfoFromAuthzToken_resultStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserInfoFromAuthzToken_resultTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.UserInfo success; // required
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      AE((short)1, "ae");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // AE
+            return AE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.UserInfo.class)));
+      tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserInfoFromAuthzToken_result.class, metaDataMap);
+    }
+
+    public getUserInfoFromAuthzToken_result() {
+    }
+
+    public getUserInfoFromAuthzToken_result(
+      org.apache.custos.commons.model.security.UserInfo success,
+      org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+    {
+      this();
+      this.success = success;
+      this.ae = ae;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getUserInfoFromAuthzToken_result(getUserInfoFromAuthzToken_result other) {
+      if (other.isSetSuccess()) {
+        this.success = new org.apache.custos.commons.model.security.UserInfo(other.success);
+      }
+      if (other.isSetAe()) {
+        this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
+      }
+    }
+
+    public getUserInfoFromAuthzToken_result deepCopy() {
+      return new getUserInfoFromAuthzToken_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+      this.ae = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.UserInfo getSuccess() {
+      return this.success;
+    }
+
+    public getUserInfoFromAuthzToken_result setSuccess(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.UserInfo success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
+      return this.ae;
+    }
+
+    public getUserInfoFromAuthzToken_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+      this.ae = ae;
+      return this;
+    }
+
+    public void unsetAe() {
+      this.ae = null;
+    }
+
+    /** Returns true if field ae is set (has been assigned a value) and false otherwise */
+    public boolean isSetAe() {
+      return this.ae != null;
+    }
+
+    public void setAeIsSet(boolean value) {
+      if (!value) {
+        this.ae = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((org.apache.custos.commons.model.security.UserInfo)value);
+        }
+        break;
+
+      case AE:
+        if (value == null) {
+          unsetAe();
+        } else {
+          setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      case AE:
+        return getAe();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      case AE:
+        return isSetAe();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getUserInfoFromAuthzToken_result)
+        return this.equals((getUserInfoFromAuthzToken_result)that);
+      return false;
+    }
+
+    public boolean equals(getUserInfoFromAuthzToken_result that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      boolean this_present_ae = true && this.isSetAe();
+      boolean that_present_ae = true && that.isSetAe();
+      if (this_present_ae || that_present_ae) {
+        if (!(this_present_ae && that_present_ae))
+          return false;
+        if (!this.ae.equals(that.ae))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
+      if (isSetSuccess())
+        hashCode = hashCode * 8191 + success.hashCode();
+
+      hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
+      if (isSetAe())
+        hashCode = hashCode * 8191 + ae.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(getUserInfoFromAuthzToken_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAe()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getUserInfoFromAuthzToken_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ae:");
+      if (this.ae == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ae);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+      if (success != null) {
+        success.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserInfoFromAuthzToken_resultStandardScheme getScheme() {
+        return new getUserInfoFromAuthzToken_resultStandardScheme();
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserInfoFromAuthzToken_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.success = new org.apache.custos.commons.model.security.UserInfo();
+                struct.success.read(iprot);
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 1: // AE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+                struct.ae.read(iprot);
+                struct.setAeIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          struct.success.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        if (struct.ae != null) {
+          oprot.writeFieldBegin(AE_FIELD_DESC);
+          struct.ae.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getUserInfoFromAuthzToken_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserInfoFromAuthzToken_resultTupleScheme getScheme() {
+        return new getUserInfoFromAuthzToken_resultTupleScheme();
+      }
+    }
+
+    private static class getUserInfoFromAuthzToken_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserInfoFromAuthzToken_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet optionals = new java.util.BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        if (struct.isSetAe()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetSuccess()) {
+          struct.success.write(oprot);
+        }
+        if (struct.isSetAe()) {
+          struct.ae.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getUserInfoFromAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet incoming = iprot.readBitSet(2);
+        if (incoming.get(0)) {
+          struct.success = new org.apache.custos.commons.model.security.UserInfo();
+          struct.success.read(iprot);
+          struct.setSuccessIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+          struct.ae.read(iprot);
+          struct.setAeIsSet(true);
+        }
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class getUserManagementServiceAccountAuthzToken_args implements org.apache.thrift.TBase<getUserManagementServiceAccountAuthzToken_args, getUserManagementServiceAccountAuthzToken_args._Fields>, java.io.Serializable, Cloneable, Comparable<getUserManagementServiceAccountAuthzToken_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserManagementServiceAccountAuthzToken_args");
+
+    private static final org.apache.thrift.protocol.TField AUTHZ_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("authzToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+    private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_argsStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_argsTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken; // required
+    public @org.apache.thrift.annotation.Nullable String gatewayId; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      AUTHZ_TOKEN((short)1, "authzToken"),
+      GATEWAY_ID((short)2, "gatewayId");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          case 2: // GATEWAY_ID
+            return GATEWAY_ID;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.AUTHZ_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("authzToken", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+      tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserManagementServiceAccountAuthzToken_args.class, metaDataMap);
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args() {
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args(
+      org.apache.custos.commons.model.security.AuthzToken authzToken,
+      String gatewayId)
+    {
+      this();
+      this.authzToken = authzToken;
+      this.gatewayId = gatewayId;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getUserManagementServiceAccountAuthzToken_args(getUserManagementServiceAccountAuthzToken_args other) {
+      if (other.isSetAuthzToken()) {
+        this.authzToken = new org.apache.custos.commons.model.security.AuthzToken(other.authzToken);
+      }
+      if (other.isSetGatewayId()) {
+        this.gatewayId = other.gatewayId;
+      }
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args deepCopy() {
+      return new getUserManagementServiceAccountAuthzToken_args(this);
+    }
+
+    @Override
+    public void clear() {
+      this.authzToken = null;
+      this.gatewayId = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.AuthzToken getAuthzToken() {
+      return this.authzToken;
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args setAuthzToken(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken authzToken) {
+      this.authzToken = authzToken;
+      return this;
+    }
+
+    public void unsetAuthzToken() {
+      this.authzToken = null;
+    }
+
+    /** Returns true if field authzToken is set (has been assigned a value) and false otherwise */
+    public boolean isSetAuthzToken() {
+      return this.authzToken != null;
+    }
+
+    public void setAuthzTokenIsSet(boolean value) {
+      if (!value) {
+        this.authzToken = null;
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public String getGatewayId() {
+      return this.gatewayId;
+    }
+
+    public getUserManagementServiceAccountAuthzToken_args setGatewayId(@org.apache.thrift.annotation.Nullable String gatewayId) {
+      this.gatewayId = gatewayId;
+      return this;
+    }
+
+    public void unsetGatewayId() {
+      this.gatewayId = null;
+    }
+
+    /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */
+    public boolean isSetGatewayId() {
+      return this.gatewayId != null;
+    }
+
+    public void setGatewayIdIsSet(boolean value) {
+      if (!value) {
+        this.gatewayId = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        if (value == null) {
+          unsetAuthzToken();
+        } else {
+          setAuthzToken((org.apache.custos.commons.model.security.AuthzToken)value);
+        }
+        break;
+
+      case GATEWAY_ID:
+        if (value == null) {
+          unsetGatewayId();
+        } else {
+          setGatewayId((String)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
+      case GATEWAY_ID:
+        return getGatewayId();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
+      case GATEWAY_ID:
+        return isSetGatewayId();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getUserManagementServiceAccountAuthzToken_args)
+        return this.equals((getUserManagementServiceAccountAuthzToken_args)that);
+      return false;
+    }
+
+    public boolean equals(getUserManagementServiceAccountAuthzToken_args that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_authzToken = true && this.isSetAuthzToken();
+      boolean that_present_authzToken = true && that.isSetAuthzToken();
+      if (this_present_authzToken || that_present_authzToken) {
+        if (!(this_present_authzToken && that_present_authzToken))
+          return false;
+        if (!this.authzToken.equals(that.authzToken))
+          return false;
+      }
+
+      boolean this_present_gatewayId = true && this.isSetGatewayId();
+      boolean that_present_gatewayId = true && that.isSetGatewayId();
+      if (this_present_gatewayId || that_present_gatewayId) {
+        if (!(this_present_gatewayId && that_present_gatewayId))
+          return false;
+        if (!this.gatewayId.equals(that.gatewayId))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetAuthzToken()) ? 131071 : 524287);
+      if (isSetAuthzToken())
+        hashCode = hashCode * 8191 + authzToken.hashCode();
+
+      hashCode = hashCode * 8191 + ((isSetGatewayId()) ? 131071 : 524287);
+      if (isSetGatewayId())
+        hashCode = hashCode * 8191 + gatewayId.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(getUserManagementServiceAccountAuthzToken_args other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetAuthzToken()).compareTo(other.isSetAuthzToken());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAuthzToken()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.authzToken, other.authzToken);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(other.isSetGatewayId());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetGatewayId()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, other.gatewayId);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getUserManagementServiceAccountAuthzToken_args(");
+      boolean first = true;
+
+      sb.append("authzToken:");
+      if (this.authzToken == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.authzToken);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("gatewayId:");
+      if (this.gatewayId == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.gatewayId);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      if (authzToken == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'authzToken' was not present! Struct: " + toString());
+      }
+      if (gatewayId == null) {
+        throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString());
+      }
+      // check for sub-struct validity
+      if (authzToken != null) {
+        authzToken.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserManagementServiceAccountAuthzToken_argsStandardScheme getScheme() {
+        return new getUserManagementServiceAccountAuthzToken_argsStandardScheme();
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserManagementServiceAccountAuthzToken_args> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 1: // AUTHZ_TOKEN
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+                struct.authzToken.read(iprot);
+                struct.setAuthzTokenIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 2: // GATEWAY_ID
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.gatewayId = iprot.readString();
+                struct.setGatewayIdIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.authzToken != null) {
+          oprot.writeFieldBegin(AUTHZ_TOKEN_FIELD_DESC);
+          struct.authzToken.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        if (struct.gatewayId != null) {
+          oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
+          oprot.writeString(struct.gatewayId);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserManagementServiceAccountAuthzToken_argsTupleScheme getScheme() {
+        return new getUserManagementServiceAccountAuthzToken_argsTupleScheme();
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserManagementServiceAccountAuthzToken_args> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken.write(oprot);
+        oprot.writeString(struct.gatewayId);
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_args struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        struct.authzToken = new org.apache.custos.commons.model.security.AuthzToken();
+        struct.authzToken.read(iprot);
+        struct.setAuthzTokenIsSet(true);
+        struct.gatewayId = iprot.readString();
+        struct.setGatewayIdIsSet(true);
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+  public static class getUserManagementServiceAccountAuthzToken_result implements org.apache.thrift.TBase<getUserManagementServiceAccountAuthzToken_result, getUserManagementServiceAccountAuthzToken_result._Fields>, java.io.Serializable, Cloneable, Comparable<getUserManagementServiceAccountAuthzToken_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getUserManagementServiceAccountAuthzToken_result");
+
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
+    private static final org.apache.thrift.protocol.TField AE_FIELD_DESC = new org.apache.thrift.protocol.TField("ae", org.apache.thrift.protocol.TType.STRUCT, (short)1);
+
+    private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_resultStandardSchemeFactory();
+    private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getUserManagementServiceAccountAuthzToken_resultTupleSchemeFactory();
+
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken success; // required
+    public @org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae; // required
+
+    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
+      AE((short)1, "ae");
+
+      private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+      static {
+        for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+          byName.put(field.getFieldName(), field);
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByThriftId(int fieldId) {
+        switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
+          case 1: // AE
+            return AE;
+          default:
+            return null;
+        }
+      }
+
+      /**
+       * Find the _Fields constant that matches fieldId, throwing an exception
+       * if it is not found.
+       */
+      public static _Fields findByThriftIdOrThrow(int fieldId) {
+        _Fields fields = findByThriftId(fieldId);
+        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+        return fields;
+      }
+
+      /**
+       * Find the _Fields constant that matches name, or null if its not found.
+       */
+      @org.apache.thrift.annotation.Nullable
+      public static _Fields findByName(String name) {
+        return byName.get(name);
+      }
+
+      private final short _thriftId;
+      private final String _fieldName;
+
+      _Fields(short thriftId, String fieldName) {
+        _thriftId = thriftId;
+        _fieldName = fieldName;
+      }
+
+      public short getThriftFieldId() {
+        return _thriftId;
+      }
+
+      public String getFieldName() {
+        return _fieldName;
+      }
+    }
+
+    // isset id assignments
+    public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+    static {
+      java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.commons.model.security.AuthzToken.class)));
+      tmpMap.put(_Fields.AE, new org.apache.thrift.meta_data.FieldMetaData("ae", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException.class)));
+      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getUserManagementServiceAccountAuthzToken_result.class, metaDataMap);
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result() {
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result(
+      org.apache.custos.commons.model.security.AuthzToken success,
+      org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae)
+    {
+      this();
+      this.success = success;
+      this.ae = ae;
+    }
+
+    /**
+     * Performs a deep copy on <i>other</i>.
+     */
+    public getUserManagementServiceAccountAuthzToken_result(getUserManagementServiceAccountAuthzToken_result other) {
+      if (other.isSetSuccess()) {
+        this.success = new org.apache.custos.commons.model.security.AuthzToken(other.success);
+      }
+      if (other.isSetAe()) {
+        this.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException(other.ae);
+      }
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result deepCopy() {
+      return new getUserManagementServiceAccountAuthzToken_result(this);
+    }
+
+    @Override
+    public void clear() {
+      this.success = null;
+      this.ae = null;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.commons.model.security.AuthzToken getSuccess() {
+      return this.success;
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result setSuccess(@org.apache.thrift.annotation.Nullable org.apache.custos.commons.model.security.AuthzToken success) {
+      this.success = success;
+      return this;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException getAe() {
+      return this.ae;
+    }
+
+    public getUserManagementServiceAccountAuthzToken_result setAe(@org.apache.thrift.annotation.Nullable org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException ae) {
+      this.ae = ae;
+      return this;
+    }
+
+    public void unsetAe() {
+      this.ae = null;
+    }
+
+    /** Returns true if field ae is set (has been assigned a value) and false otherwise */
+    public boolean isSetAe() {
+      return this.ae != null;
+    }
+
+    public void setAeIsSet(boolean value) {
+      if (!value) {
+        this.ae = null;
+      }
+    }
+
+    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+      switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((org.apache.custos.commons.model.security.AuthzToken)value);
+        }
+        break;
+
+      case AE:
+        if (value == null) {
+          unsetAe();
+        } else {
+          setAe((org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException)value);
+        }
+        break;
+
+      }
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public Object getFieldValue(_Fields field) {
+      switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
+      case AE:
+        return getAe();
+
+      }
+      throw new IllegalStateException();
+    }
+
+    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+    public boolean isSet(_Fields field) {
+      if (field == null) {
+        throw new IllegalArgumentException();
+      }
+
+      switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
+      case AE:
+        return isSetAe();
+      }
+      throw new IllegalStateException();
+    }
+
+    @Override
+    public boolean equals(Object that) {
+      if (that == null)
+        return false;
+      if (that instanceof getUserManagementServiceAccountAuthzToken_result)
+        return this.equals((getUserManagementServiceAccountAuthzToken_result)that);
+      return false;
+    }
+
+    public boolean equals(getUserManagementServiceAccountAuthzToken_result that) {
+      if (that == null)
+        return false;
+      if (this == that)
+        return true;
+
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
+      boolean this_present_ae = true && this.isSetAe();
+      boolean that_present_ae = true && that.isSetAe();
+      if (this_present_ae || that_present_ae) {
+        if (!(this_present_ae && that_present_ae))
+          return false;
+        if (!this.ae.equals(that.ae))
+          return false;
+      }
+
+      return true;
+    }
+
+    @Override
+    public int hashCode() {
+      int hashCode = 1;
+
+      hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
+      if (isSetSuccess())
+        hashCode = hashCode * 8191 + success.hashCode();
+
+      hashCode = hashCode * 8191 + ((isSetAe()) ? 131071 : 524287);
+      if (isSetAe())
+        hashCode = hashCode * 8191 + ae.hashCode();
+
+      return hashCode;
+    }
+
+    @Override
+    public int compareTo(getUserManagementServiceAccountAuthzToken_result other) {
+      if (!getClass().equals(other.getClass())) {
+        return getClass().getName().compareTo(other.getClass().getName());
+      }
+
+      int lastComparison = 0;
+
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      lastComparison = Boolean.valueOf(isSetAe()).compareTo(other.isSetAe());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetAe()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ae, other.ae);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
+      return 0;
+    }
+
+    @org.apache.thrift.annotation.Nullable
+    public _Fields fieldForId(int fieldId) {
+      return _Fields.findByThriftId(fieldId);
+    }
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+      scheme(iprot).read(iprot, this);
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+      scheme(oprot).write(oprot, this);
+      }
+
+    @Override
+    public String toString() {
+      StringBuilder sb = new StringBuilder("getUserManagementServiceAccountAuthzToken_result(");
+      boolean first = true;
+
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      if (!first) sb.append(", ");
+      sb.append("ae:");
+      if (this.ae == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.ae);
+      }
+      first = false;
+      sb.append(")");
+      return sb.toString();
+    }
+
+    public void validate() throws org.apache.thrift.TException {
+      // check for required fields
+      // check for sub-struct validity
+      if (success != null) {
+        success.validate();
+      }
+    }
+
+    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+      try {
+        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+      try {
+        read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+      } catch (org.apache.thrift.TException te) {
+        throw new java.io.IOException(te);
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserManagementServiceAccountAuthzToken_resultStandardScheme getScheme() {
+        return new getUserManagementServiceAccountAuthzToken_resultStandardScheme();
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<getUserManagementServiceAccountAuthzToken_result> {
+
+      public void read(org.apache.thrift.protocol.TProtocol iprot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TField schemeField;
+        iprot.readStructBegin();
+        while (true)
+        {
+          schemeField = iprot.readFieldBegin();
+          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+            break;
+          }
+          switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.success = new org.apache.custos.commons.model.security.AuthzToken();
+                struct.success.read(iprot);
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            case 1: // AE
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+                struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+                struct.ae.read(iprot);
+                struct.setAeIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
+            default:
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+          }
+          iprot.readFieldEnd();
+        }
+        iprot.readStructEnd();
+
+        // check for required fields of primitive type, which can't be checked in the validate method
+        struct.validate();
+      }
+
+      public void write(org.apache.thrift.protocol.TProtocol oprot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
+        struct.validate();
+
+        oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          struct.success.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        if (struct.ae != null) {
+          oprot.writeFieldBegin(AE_FIELD_DESC);
+          struct.ae.write(oprot);
+          oprot.writeFieldEnd();
+        }
+        oprot.writeFieldStop();
+        oprot.writeStructEnd();
+      }
+
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+      public getUserManagementServiceAccountAuthzToken_resultTupleScheme getScheme() {
+        return new getUserManagementServiceAccountAuthzToken_resultTupleScheme();
+      }
+    }
+
+    private static class getUserManagementServiceAccountAuthzToken_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<getUserManagementServiceAccountAuthzToken_result> {
+
+      @Override
+      public void write(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet optionals = new java.util.BitSet();
+        if (struct.isSetSuccess()) {
+          optionals.set(0);
+        }
+        if (struct.isSetAe()) {
+          optionals.set(1);
+        }
+        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetSuccess()) {
+          struct.success.write(oprot);
+        }
+        if (struct.isSetAe()) {
+          struct.ae.write(oprot);
+        }
+      }
+
+      @Override
+      public void read(org.apache.thrift.protocol.TProtocol prot, getUserManagementServiceAccountAuthzToken_result struct) throws org.apache.thrift.TException {
+        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+        java.util.BitSet incoming = iprot.readBitSet(2);
+        if (incoming.get(0)) {
+          struct.success = new org.apache.custos.commons.model.security.AuthzToken();
+          struct.success.read(iprot);
+          struct.setSuccessIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.ae = new org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException();
+          struct.ae.read(iprot);
+          struct.setAeIsSet(true);
+        }
+      }
+    }
+
+    private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+      return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+    }
+  }
+
+}
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/exception/CustosAuthenticationServiceException.java b/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/exception/CustosAuthenticationServiceException.java
new file mode 100644
index 0000000..571f176
--- /dev/null
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/cpi/exception/CustosAuthenticationServiceException.java
@@ -0,0 +1,370 @@
+/**
+ * Autogenerated by Thrift Compiler (0.12.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.custos.authentication.cpi.exception;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-07")
+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");
+
+  private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)1);
+
+  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new CustosAuthenticationServiceExceptionStandardSchemeFactory();
+  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new CustosAuthenticationServiceExceptionTupleSchemeFactory();
+
+  public @org.apache.thrift.annotation.Nullable String message; // required
+
+  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
+  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+    MESSAGE((short)1, "message");
+
+    private static final java.util.Map<String, _Fields> byName = new java.util.HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    @org.apache.thrift.annotation.Nullable
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // MESSAGE
+          return MESSAGE;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    @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.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CustosAuthenticationServiceException.class, metaDataMap);
+  }
+
+  public CustosAuthenticationServiceException() {
+  }
+
+  public CustosAuthenticationServiceException(
+    String message)
+  {
+    this();
+    this.message = message;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public CustosAuthenticationServiceException(CustosAuthenticationServiceException other) {
+    if (other.isSetMessage()) {
+      this.message = other.message;
+    }
+  }
+
+  public CustosAuthenticationServiceException deepCopy() {
+    return new CustosAuthenticationServiceException(this);
+  }
+
+  @Override
+  public void clear() {
+    this.message = null;
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public String getMessage() {
+    return this.message;
+  }
+
+  public CustosAuthenticationServiceException setMessage(@org.apache.thrift.annotation.Nullable String message) {
+    this.message = message;
+    return this;
+  }
+
+  public void unsetMessage() {
+    this.message = null;
+  }
+
+  /** Returns true if field message is set (has been assigned a value) and false otherwise */
+  public boolean isSetMessage() {
+    return this.message != null;
+  }
+
+  public void setMessageIsSet(boolean value) {
+    if (!value) {
+      this.message = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable Object value) {
+    switch (field) {
+    case MESSAGE:
+      if (value == null) {
+        unsetMessage();
+      } else {
+        setMessage((String)value);
+      }
+      break;
+
+    }
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case MESSAGE:
+      return getMessage();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case MESSAGE:
+      return isSetMessage();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof CustosAuthenticationServiceException)
+      return this.equals((CustosAuthenticationServiceException)that);
+    return false;
+  }
+
+  public boolean equals(CustosAuthenticationServiceException that) {
+    if (that == null)
+      return false;
+    if (this == that)
+      return true;
+
+    boolean this_present_message = true && this.isSetMessage();
+    boolean that_present_message = true && that.isSetMessage();
+    if (this_present_message || that_present_message) {
+      if (!(this_present_message && that_present_message))
+        return false;
+      if (!this.message.equals(that.message))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int hashCode = 1;
+
+    hashCode = hashCode * 8191 + ((isSetMessage()) ? 131071 : 524287);
+    if (isSetMessage())
+      hashCode = hashCode * 8191 + message.hashCode();
+
+    return hashCode;
+  }
+
+  @Override
+  public int compareTo(CustosAuthenticationServiceException other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetMessage()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  @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("CustosAuthenticationServiceException(");
+    boolean first = true;
+
+    sb.append("message:");
+    if (this.message == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.message);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (message == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'message' was not present! Struct: " + toString());
+    }
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class CustosAuthenticationServiceExceptionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+    public CustosAuthenticationServiceExceptionStandardScheme getScheme() {
+      return new CustosAuthenticationServiceExceptionStandardScheme();
+    }
+  }
+
+  private static class CustosAuthenticationServiceExceptionStandardScheme extends org.apache.thrift.scheme.StandardScheme<CustosAuthenticationServiceException> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, CustosAuthenticationServiceException struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // MESSAGE
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.message = iprot.readString();
+              struct.setMessageIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // 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, CustosAuthenticationServiceException struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.message != null) {
+        oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+        oprot.writeString(struct.message);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class CustosAuthenticationServiceExceptionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+    public CustosAuthenticationServiceExceptionTupleScheme getScheme() {
+      return new CustosAuthenticationServiceExceptionTupleScheme();
+    }
+  }
+
+  private static class CustosAuthenticationServiceExceptionTupleScheme extends org.apache.thrift.scheme.TupleScheme<CustosAuthenticationServiceException> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, CustosAuthenticationServiceException struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+      oprot.writeString(struct.message);
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, CustosAuthenticationServiceException struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+      struct.message = iprot.readString();
+      struct.setMessageIsSet(true);
+    }
+  }
+
+  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
+    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
+  }
+}
+
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java b/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java
new file mode 100644
index 0000000..abb073a
--- /dev/null
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/handler/CustosAuthenticationHandler.java
@@ -0,0 +1,57 @@
+package org.apache.custos.authentication.handler;
+
+import org.apache.custos.authentication.cpi.CustosAuthenticationService;
+import org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException;
+import org.apache.custos.commons.model.security.UserInfo;
+import org.apache.custos.commons.exceptions.CustosSecurityException;
+import org.apache.custos.commons.model.error.AuthenticationException;
+import org.apache.custos.commons.model.security.AuthzToken;
+import org.apache.custos.commons.utils.Constants;
+import org.apache.custos.security.manager.CustosSecurityManager;
+import org.apache.custos.security.manager.SecurityManagerFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CustosAuthenticationHandler implements CustosAuthenticationService.Iface {
+    private final static Logger logger = LoggerFactory.getLogger(CustosAuthenticationHandler.class);
+
+    @Override
+    public boolean isUserAuthenticated(AuthzToken authzToken) throws AuthenticationException {
+        try {
+            CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
+            boolean isAuth = securityManager.isUserAuthenticated(authzToken);
+                if (isAuth) {
+                    logger.info("User" + authzToken.getClaimsMap().get(Constants.USER_NAME) + "in gateway" + authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + "is authenticated");
+                    return isAuth;
+                }
+                else{
+                    throw new AuthenticationException("User is not authenticated.");
+                }
+        } catch (CustosSecurityException e) {
+            logger.error(e.getMessage(), e);
+            throw new AuthenticationException("Error in authenticating.");
+        }
+    }
+    @Override
+    public UserInfo getUserInfoFromAuthzToken(AuthzToken authzToken) throws CustosAuthenticationServiceException {
+        try{
+            CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
+            UserInfo userInfo = securityManager.getUserInfoFromAuthzToken(authzToken);
+            return userInfo;
+        }catch (CustosSecurityException e){
+            logger.error(e.getMessage(), e);
+            throw new CustosAuthenticationServiceException("Could not retrieve user info");
+        }
+    }
+    @Override
+    public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) throws CustosAuthenticationServiceException {
+        try{
+            CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
+            AuthzToken managementServiceAccountAuthzToken = securityManager.getUserManagementServiceAccountAuthzToken(authzToken, gatewayId);
+            return managementServiceAccountAuthzToken;
+        }catch (CustosSecurityException e){
+            logger.error(e.getMessage(), e);
+            throw new CustosAuthenticationServiceException("Could get user management account authz token");
+        }
+    }
+}
diff --git a/custos-authentication/src/main/java/org/apache/custos/authentication/server/CustosAuthenticationServer.java b/custos-authentication/src/main/java/org/apache/custos/authentication/server/CustosAuthenticationServer.java
new file mode 100644
index 0000000..76a4066
--- /dev/null
+++ b/custos-authentication/src/main/java/org/apache/custos/authentication/server/CustosAuthenticationServer.java
@@ -0,0 +1,137 @@
+package org.apache.custos.authentication.server;
+
+import org.apache.custos.authentication.cpi.CustosAuthenticationService;
+import org.apache.custos.authentication.handler.CustosAuthenticationHandler;
+import org.apache.custos.commons.utils.IServer;
+import org.apache.custos.commons.utils.ServerSettings;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.InetSocketAddress;
+import java.util.Date;;
+
+public class CustosAuthenticationServer implements  IServer{
+
+    private final static Logger logger = LoggerFactory.getLogger(CustosAuthenticationService.class);
+
+    private static final String SERVER_NAME = "Authentication Service Server";
+    private static final String SERVER_VERSION = "1.0";
+
+    private ServerStatus status;
+    private TServer server;
+
+    public CustosAuthenticationServer() {
+        setStatus(ServerStatus.STOPPED);
+    }
+
+    public void updateTime() {
+
+    }
+
+    public Date getTime() {
+        return null;
+    }
+
+    public String getName() {
+        return SERVER_NAME;
+    }
+
+    public String getVersion() {
+        return SERVER_VERSION;
+    }
+
+    public void start() throws Exception {
+        try {
+            final int serverPort = Integer.parseInt(ServerSettings.getAuthenticationServerPort());
+            final String serverHost = ServerSettings.getAuthenticationServerHost();
+            CustosAuthenticationService.Processor authenticationProcessor = new CustosAuthenticationService.Processor(new CustosAuthenticationHandler());
+            TServerTransport serverTransport;
+
+            if (serverHost == null) {
+                serverTransport = new TServerSocket(serverPort);
+            } else {
+                InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
+                serverTransport = new TServerSocket(inetSocketAddress);
+            }
+            TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
+            options.minWorkerThreads = 30;
+            server = new TThreadPoolServer(options.processor(authenticationProcessor));
+
+            new Thread() {
+                public void run() {
+                    server.serve();
+                    setStatus(ServerStatus.STOPPED);
+                    logger.info("Authentication Service Server Stopped.");
+                }
+            }.start();
+            new Thread() {
+                public void run() {
+                    while (!server.isServing()) {
+                        try {
+                            Thread.sleep(500);
+                        } catch (InterruptedException e) {
+                            break;
+                        }
+                    }
+                    if (server.isServing()) {
+                        setStatus(ServerStatus.STARTED);
+                        logger.info("Starting Authentication Service Server on Port " + serverPort);
+                        logger.info("Listening to Authentication Service Server clients ....");
+                    }
+                }
+            }.start();
+        }
+         catch (TTransportException e) {
+            setStatus(ServerStatus.FAILED);
+            throw new Exception("Error while starting the Authentication Service Server", e);
+        }
+    }
+
+    public void stop() throws Exception {
+
+        if (server != null && server.isServing()) {
+            setStatus(ServerStatus.STOPING);
+            server.stop();
+        }
+    }
+
+    public void restart() throws Exception {
+
+        stop();
+        start();
+    }
+
+    public void configure() throws Exception {
+
+    }
+
+    public ServerStatus getStatus() throws Exception {
+        return status;
+    }
+
+    private void setStatus(ServerStatus stat) {
+        status = stat;
+        status.updateTime();
+    }
+
+    public TServer getServer() {
+        return server;
+    }
+
+    public void setServer(TServer server) {
+        this.server = server;
+    }
+
+    public static void main(String[] args) {
+        try {
+            new CustosAuthenticationServer().start();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}
diff --git a/custos-client/pom.xml b/custos-client/pom.xml
index cc6d67b..882305a 100644
--- a/custos-client/pom.xml
+++ b/custos-client/pom.xml
@@ -8,6 +8,7 @@
         <version>1.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
+    <artifactId>custos-client</artifactId>
     <dependencies>
         <dependency>
             <groupId>org.apache.custos</groupId>
@@ -15,12 +16,18 @@
             <version>1.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.custos</groupId>
+            <artifactId>custos-authentication</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
     <properties>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
     </properties>
-    <artifactId>custos-client</artifactId>
+
 
 
 </project>
\ No newline at end of file
diff --git a/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java b/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
new file mode 100644
index 0000000..34aa7f9
--- /dev/null
+++ b/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
@@ -0,0 +1,25 @@
+package org.apache.custos.client.authentication.service;
+
+import org.apache.custos.authentication.cpi.CustosAuthenticationService;
+import org.apache.custos.authentication.cpi.exception.CustosAuthenticationServiceException;
+import org.apache.custos.commons.model.error.AuthenticationException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TMultiplexedProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+
+public class AuthenticationServiceClient {
+    public static CustosAuthenticationService.Client createAuthenticationServiceClient(String serverHost, int serverPort)  throws CustosAuthenticationServiceException {
+        try {
+            TTransport transport = new TSocket(serverHost, serverPort);
+            transport.open();
+            TProtocol protocol = new TBinaryProtocol(transport);
+            TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, "CustosAuthenticationService");
+            return new CustosAuthenticationService.Client(multiplexedProtocol);
+        } catch (TTransportException e) {
+            throw new CustosAuthenticationServiceException(e.getMessage());
+        }
+    }
+}
diff --git a/custos-client/src/main/java/org/apache/custos/client/profile/service/ProfileServiceClientFactory.java b/custos-client/src/main/java/org/apache/custos/client/profile/service/CustosProfileServiceClientFactory.java
similarity index 89%
copy from custos-client/src/main/java/org/apache/custos/client/profile/service/ProfileServiceClientFactory.java
copy to custos-client/src/main/java/org/apache/custos/client/profile/service/CustosProfileServiceClientFactory.java
index aa8f476..593be32 100644
--- a/custos-client/src/main/java/org/apache/custos/client/profile/service/ProfileServiceClientFactory.java
+++ b/custos-client/src/main/java/org/apache/custos/client/profile/service/CustosProfileServiceClientFactory.java
@@ -38,8 +38,8 @@ import org.apache.thrift.transport.TTransportException;
 /**
  * Created by goshenoy on 03/08/2017.
  */
-public class ProfileServiceClientFactory {
-    public static UserProfileService.Client createUserProfileServiceClient(String serverHost, int serverPort)  throws UserProfileServiceException {
+public class CustosProfileServiceClientFactory {
+    public static UserProfileService.Client createCustosUserProfileServiceClient(String serverHost, int serverPort)  throws UserProfileServiceException {
         try {
             TTransport transport = new TSocket(serverHost, serverPort);
             transport.open();
@@ -51,7 +51,7 @@ public class ProfileServiceClientFactory {
         }
     }
 
-    public static TenantProfileService.Client createTenantProfileServiceClient(String serverHost, int serverPort) throws TenantProfileServiceException {
+    public static TenantProfileService.Client createCustosTenantProfileServiceClient(String serverHost, int serverPort) throws TenantProfileServiceException {
         try {
             TTransport transport = new TSocket(serverHost, serverPort);
             transport.open();
@@ -63,7 +63,7 @@ public class ProfileServiceClientFactory {
         }
     }
 
-    public static IamAdminServices.Client createIamAdminServiceClient(String serverHost, int serverPort) throws IamAdminServicesException {
+    public static IamAdminServices.Client createCustosIamAdminServiceClient(String serverHost, int serverPort) throws IamAdminServicesException {
         try {
             TTransport transport = new TSocket(serverHost, serverPort);
             transport.open();
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/model/security/UserInfo.java b/custos-commons/src/main/java/org/apache/custos/commons/model/security/UserInfo.java
new file mode 100644
index 0000000..167458f
--- /dev/null
+++ b/custos-commons/src/main/java/org/apache/custos/commons/model/security/UserInfo.java
@@ -0,0 +1,875 @@
+/**
+ * Autogenerated by Thrift Compiler (0.12.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.custos.commons.model.security;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-08")
+public class UserInfo implements org.apache.thrift.TBase<UserInfo, UserInfo._Fields>, java.io.Serializable, Cloneable, Comparable<UserInfo> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserInfo");
+
+  private static final org.apache.thrift.protocol.TField SUB_FIELD_DESC = new org.apache.thrift.protocol.TField("sub", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField FIRST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("firstName", org.apache.thrift.protocol.TType.STRING, (short)2);
+  private static final org.apache.thrift.protocol.TField LAST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastName", org.apache.thrift.protocol.TType.STRING, (short)3);
+  private static final org.apache.thrift.protocol.TField FULL_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("fullName", org.apache.thrift.protocol.TType.STRING, (short)4);
+  private static final org.apache.thrift.protocol.TField EMAIL_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("emailAddress", org.apache.thrift.protocol.TType.STRING, (short)5);
+  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)6);
+
+  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new UserInfoStandardSchemeFactory();
+  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new UserInfoTupleSchemeFactory();
+
+  public @org.apache.thrift.annotation.Nullable String sub; // required
+  public @org.apache.thrift.annotation.Nullable String firstName; // required
+  public @org.apache.thrift.annotation.Nullable String lastName; // required
+  public @org.apache.thrift.annotation.Nullable String fullName; // required
+  public @org.apache.thrift.annotation.Nullable String emailAddress; // 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 {
+    SUB((short)1, "sub"),
+    FIRST_NAME((short)2, "firstName"),
+    LAST_NAME((short)3, "lastName"),
+    FULL_NAME((short)4, "fullName"),
+    EMAIL_ADDRESS((short)5, "emailAddress"),
+    USERNAME((short)6, "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: // SUB
+          return SUB;
+        case 2: // FIRST_NAME
+          return FIRST_NAME;
+        case 3: // LAST_NAME
+          return LAST_NAME;
+        case 4: // FULL_NAME
+          return FULL_NAME;
+        case 5: // EMAIL_ADDRESS
+          return EMAIL_ADDRESS;
+        case 6: // 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.SUB, new org.apache.thrift.meta_data.FieldMetaData("sub", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.FIRST_NAME, new org.apache.thrift.meta_data.FieldMetaData("firstName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.LAST_NAME, new org.apache.thrift.meta_data.FieldMetaData("lastName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.FULL_NAME, new org.apache.thrift.meta_data.FieldMetaData("fullName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.EMAIL_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("emailAddress", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    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(UserInfo.class, metaDataMap);
+  }
+
+  public UserInfo() {
+  }
+
+  public UserInfo(
+    String sub,
+    String firstName,
+    String lastName,
+    String fullName,
+    String emailAddress,
+    String username)
+  {
+    this();
+    this.sub = sub;
+    this.firstName = firstName;
+    this.lastName = lastName;
+    this.fullName = fullName;
+    this.emailAddress = emailAddress;
+    this.username = username;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public UserInfo(UserInfo other) {
+    if (other.isSetSub()) {
+      this.sub = other.sub;
+    }
+    if (other.isSetFirstName()) {
+      this.firstName = other.firstName;
+    }
+    if (other.isSetLastName()) {
+      this.lastName = other.lastName;
+    }
+    if (other.isSetFullName()) {
+      this.fullName = other.fullName;
+    }
+    if (other.isSetEmailAddress()) {
+      this.emailAddress = other.emailAddress;
+    }
+    if (other.isSetUsername()) {
+      this.username = other.username;
+    }
+  }
+
+  public UserInfo deepCopy() {
+    return new UserInfo(this);
+  }
+
+  @Override
+  public void clear() {
+    this.sub = null;
+    this.firstName = null;
+    this.lastName = null;
+    this.fullName = null;
+    this.emailAddress = null;
+    this.username = null;
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public String getSub() {
+    return this.sub;
+  }
+
+  public UserInfo setSub(@org.apache.thrift.annotation.Nullable String sub) {
+    this.sub = sub;
+    return this;
+  }
+
+  public void unsetSub() {
+    this.sub = null;
+  }
+
+  /** Returns true if field sub is set (has been assigned a value) and false otherwise */
+  public boolean isSetSub() {
+    return this.sub != null;
+  }
+
+  public void setSubIsSet(boolean value) {
+    if (!value) {
+      this.sub = null;
+    }
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public String getFirstName() {
+    return this.firstName;
+  }
+
+  public UserInfo setFirstName(@org.apache.thrift.annotation.Nullable String firstName) {
+    this.firstName = firstName;
+    return this;
+  }
+
+  public void unsetFirstName() {
+    this.firstName = null;
+  }
+
+  /** Returns true if field firstName is set (has been assigned a value) and false otherwise */
+  public boolean isSetFirstName() {
+    return this.firstName != null;
+  }
+
+  public void setFirstNameIsSet(boolean value) {
+    if (!value) {
+      this.firstName = null;
+    }
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public String getLastName() {
+    return this.lastName;
+  }
+
+  public UserInfo setLastName(@org.apache.thrift.annotation.Nullable String lastName) {
+    this.lastName = lastName;
+    return this;
+  }
+
+  public void unsetLastName() {
+    this.lastName = null;
+  }
+
+  /** Returns true if field lastName is set (has been assigned a value) and false otherwise */
+  public boolean isSetLastName() {
+    return this.lastName != null;
+  }
+
+  public void setLastNameIsSet(boolean value) {
+    if (!value) {
+      this.lastName = null;
+    }
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public String getFullName() {
+    return this.fullName;
+  }
+
+  public UserInfo setFullName(@org.apache.thrift.annotation.Nullable String fullName) {
+    this.fullName = fullName;
+    return this;
+  }
+
+  public void unsetFullName() {
+    this.fullName = null;
+  }
+
+  /** Returns true if field fullName is set (has been assigned a value) and false otherwise */
+  public boolean isSetFullName() {
+    return this.fullName != null;
+  }
+
+  public void setFullNameIsSet(boolean value) {
+    if (!value) {
+      this.fullName = null;
+    }
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public String getEmailAddress() {
+    return this.emailAddress;
+  }
+
+  public UserInfo setEmailAddress(@org.apache.thrift.annotation.Nullable String emailAddress) {
+    this.emailAddress = emailAddress;
+    return this;
+  }
+
+  public void unsetEmailAddress() {
+    this.emailAddress = null;
+  }
+
+  /** Returns true if field emailAddress is set (has been assigned a value) and false otherwise */
+  public boolean isSetEmailAddress() {
+    return this.emailAddress != null;
+  }
+
+  public void setEmailAddressIsSet(boolean value) {
+    if (!value) {
+      this.emailAddress = null;
+    }
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public String getUsername() {
+    return this.username;
+  }
+
+  public UserInfo 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 SUB:
+      if (value == null) {
+        unsetSub();
+      } else {
+        setSub((String)value);
+      }
+      break;
+
+    case FIRST_NAME:
+      if (value == null) {
+        unsetFirstName();
+      } else {
+        setFirstName((String)value);
+      }
+      break;
+
+    case LAST_NAME:
+      if (value == null) {
+        unsetLastName();
+      } else {
+        setLastName((String)value);
+      }
+      break;
+
+    case FULL_NAME:
+      if (value == null) {
+        unsetFullName();
+      } else {
+        setFullName((String)value);
+      }
+      break;
+
+    case EMAIL_ADDRESS:
+      if (value == null) {
+        unsetEmailAddress();
+      } else {
+        setEmailAddress((String)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 SUB:
+      return getSub();
+
+    case FIRST_NAME:
+      return getFirstName();
+
+    case LAST_NAME:
+      return getLastName();
+
+    case FULL_NAME:
+      return getFullName();
+
+    case EMAIL_ADDRESS:
+      return getEmailAddress();
+
+    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 SUB:
+      return isSetSub();
+    case FIRST_NAME:
+      return isSetFirstName();
+    case LAST_NAME:
+      return isSetLastName();
+    case FULL_NAME:
+      return isSetFullName();
+    case EMAIL_ADDRESS:
+      return isSetEmailAddress();
+    case USERNAME:
+      return isSetUsername();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof UserInfo)
+      return this.equals((UserInfo)that);
+    return false;
+  }
+
+  public boolean equals(UserInfo that) {
+    if (that == null)
+      return false;
+    if (this == that)
+      return true;
+
+    boolean this_present_sub = true && this.isSetSub();
+    boolean that_present_sub = true && that.isSetSub();
+    if (this_present_sub || that_present_sub) {
+      if (!(this_present_sub && that_present_sub))
+        return false;
+      if (!this.sub.equals(that.sub))
+        return false;
+    }
+
+    boolean this_present_firstName = true && this.isSetFirstName();
+    boolean that_present_firstName = true && that.isSetFirstName();
+    if (this_present_firstName || that_present_firstName) {
+      if (!(this_present_firstName && that_present_firstName))
+        return false;
+      if (!this.firstName.equals(that.firstName))
+        return false;
+    }
+
+    boolean this_present_lastName = true && this.isSetLastName();
+    boolean that_present_lastName = true && that.isSetLastName();
+    if (this_present_lastName || that_present_lastName) {
+      if (!(this_present_lastName && that_present_lastName))
+        return false;
+      if (!this.lastName.equals(that.lastName))
+        return false;
+    }
+
+    boolean this_present_fullName = true && this.isSetFullName();
+    boolean that_present_fullName = true && that.isSetFullName();
+    if (this_present_fullName || that_present_fullName) {
+      if (!(this_present_fullName && that_present_fullName))
+        return false;
+      if (!this.fullName.equals(that.fullName))
+        return false;
+    }
+
+    boolean this_present_emailAddress = true && this.isSetEmailAddress();
+    boolean that_present_emailAddress = true && that.isSetEmailAddress();
+    if (this_present_emailAddress || that_present_emailAddress) {
+      if (!(this_present_emailAddress && that_present_emailAddress))
+        return false;
+      if (!this.emailAddress.equals(that.emailAddress))
+        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 + ((isSetSub()) ? 131071 : 524287);
+    if (isSetSub())
+      hashCode = hashCode * 8191 + sub.hashCode();
+
+    hashCode = hashCode * 8191 + ((isSetFirstName()) ? 131071 : 524287);
+    if (isSetFirstName())
+      hashCode = hashCode * 8191 + firstName.hashCode();
+
+    hashCode = hashCode * 8191 + ((isSetLastName()) ? 131071 : 524287);
+    if (isSetLastName())
+      hashCode = hashCode * 8191 + lastName.hashCode();
+
+    hashCode = hashCode * 8191 + ((isSetFullName()) ? 131071 : 524287);
+    if (isSetFullName())
+      hashCode = hashCode * 8191 + fullName.hashCode();
+
+    hashCode = hashCode * 8191 + ((isSetEmailAddress()) ? 131071 : 524287);
+    if (isSetEmailAddress())
+      hashCode = hashCode * 8191 + emailAddress.hashCode();
+
+    hashCode = hashCode * 8191 + ((isSetUsername()) ? 131071 : 524287);
+    if (isSetUsername())
+      hashCode = hashCode * 8191 + username.hashCode();
+
+    return hashCode;
+  }
+
+  @Override
+  public int compareTo(UserInfo other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetSub()).compareTo(other.isSetSub());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetSub()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sub, other.sub);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetFirstName()).compareTo(other.isSetFirstName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetFirstName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.firstName, other.firstName);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetLastName()).compareTo(other.isSetLastName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetLastName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastName, other.lastName);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetFullName()).compareTo(other.isSetFullName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetFullName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fullName, other.fullName);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetEmailAddress()).compareTo(other.isSetEmailAddress());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetEmailAddress()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.emailAddress, other.emailAddress);
+      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("UserInfo(");
+    boolean first = true;
+
+    sb.append("sub:");
+    if (this.sub == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.sub);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("firstName:");
+    if (this.firstName == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.firstName);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("lastName:");
+    if (this.lastName == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.lastName);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("fullName:");
+    if (this.fullName == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.fullName);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("emailAddress:");
+    if (this.emailAddress == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.emailAddress);
+    }
+    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 (sub == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'sub' was not present! Struct: " + toString());
+    }
+    if (firstName == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'firstName' was not present! Struct: " + toString());
+    }
+    if (lastName == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'lastName' was not present! Struct: " + toString());
+    }
+    if (fullName == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'fullName' was not present! Struct: " + toString());
+    }
+    if (emailAddress == null) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'emailAddress' 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
+  }
+
+  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 UserInfoStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+    public UserInfoStandardScheme getScheme() {
+      return new UserInfoStandardScheme();
+    }
+  }
+
+  private static class UserInfoStandardScheme extends org.apache.thrift.scheme.StandardScheme<UserInfo> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, UserInfo 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: // SUB
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.sub = iprot.readString();
+              struct.setSubIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // FIRST_NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.firstName = iprot.readString();
+              struct.setFirstNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 3: // LAST_NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.lastName = iprot.readString();
+              struct.setLastNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 4: // FULL_NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.fullName = iprot.readString();
+              struct.setFullNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 5: // EMAIL_ADDRESS
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.emailAddress = iprot.readString();
+              struct.setEmailAddressIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 6: // 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, UserInfo struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.sub != null) {
+        oprot.writeFieldBegin(SUB_FIELD_DESC);
+        oprot.writeString(struct.sub);
+        oprot.writeFieldEnd();
+      }
+      if (struct.firstName != null) {
+        oprot.writeFieldBegin(FIRST_NAME_FIELD_DESC);
+        oprot.writeString(struct.firstName);
+        oprot.writeFieldEnd();
+      }
+      if (struct.lastName != null) {
+        oprot.writeFieldBegin(LAST_NAME_FIELD_DESC);
+        oprot.writeString(struct.lastName);
+        oprot.writeFieldEnd();
+      }
+      if (struct.fullName != null) {
+        oprot.writeFieldBegin(FULL_NAME_FIELD_DESC);
+        oprot.writeString(struct.fullName);
+        oprot.writeFieldEnd();
+      }
+      if (struct.emailAddress != null) {
+        oprot.writeFieldBegin(EMAIL_ADDRESS_FIELD_DESC);
+        oprot.writeString(struct.emailAddress);
+        oprot.writeFieldEnd();
+      }
+      if (struct.username != null) {
+        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+        oprot.writeString(struct.username);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class UserInfoTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
+    public UserInfoTupleScheme getScheme() {
+      return new UserInfoTupleScheme();
+    }
+  }
+
+  private static class UserInfoTupleScheme extends org.apache.thrift.scheme.TupleScheme<UserInfo> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+      oprot.writeString(struct.sub);
+      oprot.writeString(struct.firstName);
+      oprot.writeString(struct.lastName);
+      oprot.writeString(struct.fullName);
+      oprot.writeString(struct.emailAddress);
+      oprot.writeString(struct.username);
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
+      struct.sub = iprot.readString();
+      struct.setSubIsSet(true);
+      struct.firstName = iprot.readString();
+      struct.setFirstNameIsSet(true);
+      struct.lastName = iprot.readString();
+      struct.setLastNameIsSet(true);
+      struct.fullName = iprot.readString();
+      struct.setFullNameIsSet(true);
+      struct.emailAddress = iprot.readString();
+      struct.setEmailAddressIsSet(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();
+  }
+}
+
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/ApplicationSettings.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/ApplicationSettings.java
index 9f0ad54..9c28e25 100644
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/ApplicationSettings.java
+++ b/custos-commons/src/main/java/org/apache/custos/commons/utils/ApplicationSettings.java
@@ -31,6 +31,14 @@ public class ApplicationSettings {
     public static final String IAM_SERVER_URL = "iam.server.url";
     public static final String IAM_SERVER_SUPER_ADMIN_USERNAME = "iam.server.super.admin.username";
     public static final String IAM_SERVER_SUPER_ADMIN_PASSWORD = "iam.server.super.admin.password";
+
+    //User Profile constant
+    public static final String USER_PROFILE_SERVER_HOST = "user.profile.server.host";
+    public static final String USER_PROFILE_SERVER_PORT = "user.profile.server.port";
+
+    // Authentication service constants
+    public static final String AUTHENTICATION_SERVICE_SERVER_PORT = "custos.authentication.server.port";
+    public static final String AUTHENTICATION_SERVICE_SERVER_HOST = "custos.authentication.server.host";
     {
         loadProperties();
     }
diff --git a/custos-commons/src/main/java/org/apache/custos/commons/utils/ServerSettings.java b/custos-commons/src/main/java/org/apache/custos/commons/utils/ServerSettings.java
index 9417313..1b4015c 100644
--- a/custos-commons/src/main/java/org/apache/custos/commons/utils/ServerSettings.java
+++ b/custos-commons/src/main/java/org/apache/custos/commons/utils/ServerSettings.java
@@ -26,10 +26,7 @@ import org.slf4j.LoggerFactory;
 public class ServerSettings extends ApplicationSettings {
 
     private static final Logger log = LoggerFactory.getLogger(ServerSettings.class);
-    //User Profile constant
 
-    public static final String USER_PROFILE_SERVER_HOST = "user.profile.server.host";
-    public static final String USER_PROFILE_SERVER_PORT = "user.profile.server.port";
 
     public static int getCacheSize() throws ApplicationSettingsException {
         return Integer.valueOf(getSetting(Constants.IN_MEMORY_CACHE_SIZE));
@@ -61,9 +58,15 @@ public class ServerSettings extends ApplicationSettings {
     public static String  getProfileServiceServerHost() throws ApplicationSettingsException {
         return getSetting(ServerSettings.PROFILE_SERVICE_SERVER_HOST);
     }
-
     public static String getProfileServiceServerPort() throws ApplicationSettingsException {
         return getSetting(ServerSettings.PROFILE_SERVICE_SERVER_PORT);
     }
+    public static  String getAuthenticationServerPort() throws ApplicationSettingsException {
+        return getSetting(ServerSettings.AUTHENTICATION_SERVICE_SERVER_PORT);
+    }
+    public static  String getAuthenticationServerHost() throws ApplicationSettingsException {
+        return getSetting(ServerSettings.AUTHENTICATION_SERVICE_SERVER_HOST);
+    }
+
 
 }
diff --git a/custos-connectors/pom.xml b/custos-connectors/pom.xml
index 309e806..7b6ae79 100644
--- a/custos-connectors/pom.xml
+++ b/custos-connectors/pom.xml
@@ -36,12 +36,6 @@
             <version>1.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.custos</groupId>
-            <artifactId>custos-client</artifactId>
-            <version>1.0-SNAPSHOT</version>
-            <scope>compile</scope>
-        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityInterceptor.java b/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityInterceptor.java
index f075dd9..a67cf8e 100644
--- a/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityInterceptor.java
+++ b/custos-connectors/src/main/java/org.apache.custos.security/interceptor/SecurityInterceptor.java
@@ -64,7 +64,7 @@ public class SecurityInterceptor implements MethodInterceptor {
             boolean isAPISecured = ServerSettings.isAPISecured();
             if (isAPISecured) {
                 CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
-                boolean isAuthz = securityManager.isUserAuthorized(authzToken, metaData);
+                boolean isAuthz = securityManager.isUserAuthenticated(authzToken);
                 if (!isAuthz) {
                     throw new AuthorizationException("User is not authenticated or authorized.");
                 }
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 8051e77..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
@@ -22,6 +22,7 @@ package org.apache.custos.security.manager;
 
 import org.apache.custos.commons.exceptions.CustosSecurityException;
 import org.apache.custos.commons.model.security.AuthzToken;
+import org.apache.custos.commons.model.security.UserInfo;
 
 import java.util.Map;
 
@@ -35,11 +36,10 @@ public interface CustosSecurityManager {
     /**
      * Implement this method with the user authentication/authorization logic in your SecurityManager.
      * @param authzToken : this includes OAuth token and user's claims
-     * @param metaData : this includes other meta data needed for security enforcements.
      * @return
      * @throws CustosSecurityException
      */
-    public boolean isUserAuthorized(AuthzToken authzToken, Map<String, String> metaData) throws CustosSecurityException;
+    public boolean isUserAuthenticated(AuthzToken authzToken) throws CustosSecurityException;
 
 
     /**
@@ -48,7 +48,7 @@ public interface CustosSecurityManager {
      * @return
      * @throws CustosSecurityException
      */
-    public AuthzToken getUserManagementServiceAccountAuthzToken(String gatewayId) 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 b85ec1e..88cd26f 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
@@ -20,14 +20,14 @@
 */
 package org.apache.custos.security.manager;
 
-
-import org.apache.custos.client.profile.service.ProfileServiceClientFactory;
 import org.apache.custos.commons.exceptions.ApplicationSettingsException;
 import org.apache.custos.commons.exceptions.CustosSecurityException;
 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.commons.utils.ThriftUtils;
+import org.apache.custos.profile.client.ProfileServiceClientFactory;
 import org.apache.custos.profile.model.workspace.Gateway;
 import org.apache.custos.profile.tenant.cpi.TenantProfileService;
 import org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException;
@@ -57,7 +57,6 @@ import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Base64;
 import java.util.List;
-import java.util.Map;
 
 public class KeyCloakSecurityManager implements CustosSecurityManager {
     private final static Logger logger = LoggerFactory.getLogger(KeyCloakSecurityManager.class);
@@ -85,19 +84,17 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
     }
 
     /**
-     * Implement this method with the user authentication/authorization logic in your SecurityManager.
+     * Implement this method with the user authentication logic in your SecurityManager.
      *
      * @param authzToken : this includes OAuth token and user's claims
-     * @param metaData   : this includes other meta data needed for security enforcements.
      * @return
      * @throws CustosSecurityException
      */
     @Override
-    public boolean isUserAuthorized(AuthzToken authzToken, Map<String, String> metaData) throws CustosSecurityException {
+    public boolean isUserAuthenticated(AuthzToken authzToken) throws CustosSecurityException {
         String subject = authzToken.getClaimsMap().get(Constants.USER_NAME);
         String accessToken = authzToken.getAccessToken();
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
-        //String action = "/airavata/" + metaData.get(Constants.API_METHOD_NAME);
         try {
             if (!ServerSettings.isAPISecured()) {
                 return true;
@@ -153,17 +150,17 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
     }
 
     @Override
-    public AuthzToken getUserManagementServiceAccountAuthzToken(String gatewayId) throws CustosSecurityException {
+    public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) throws CustosSecurityException {
         try {
             initServiceClients();
-            Gateway gateway = tenantProfileClient.getGatewayUsingGatewayId(gatewayId);
+            Gateway gateway = tenantProfileClient.getGatewayUsingGatewayId(authzToken,gatewayId);
             String tokenURL = getTokenEndpoint(gatewayId);
             JSONObject clientCredentials = getClientCredentials(tokenURL, gateway.getOauthClientId(), gateway.getOauthClientSecret());
             String accessToken = clientCredentials.getString("access_token");
-            AuthzToken authzToken = new AuthzToken(accessToken);
-            authzToken.putToClaimsMap(Constants.GATEWAY_ID, gatewayId);
-            authzToken.putToClaimsMap(Constants.USER_NAME, gateway.getOauthClientId());
-            return authzToken;
+            AuthzToken userManagementServiceAccountAuthzToken = new AuthzToken(accessToken);
+            userManagementServiceAccountAuthzToken.putToClaimsMap(Constants.GATEWAY_ID, gatewayId);
+            userManagementServiceAccountAuthzToken.putToClaimsMap(Constants.USER_NAME, gateway.getOauthClientId());
+            return userManagementServiceAccountAuthzToken;
         } catch (Exception e) {
             throw new CustosSecurityException(e);
         } finally {
diff --git a/custos-connectors/src/main/java/org.apache.custos.security/manager/UserInfo.java b/custos-connectors/src/main/java/org.apache.custos.security/manager/UserInfo.java
deleted file mode 100644
index 4687748..0000000
--- a/custos-connectors/src/main/java/org.apache.custos.security/manager/UserInfo.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.custos.security.manager;
-
-public class UserInfo {
-    private String sub;
-    private String firstName;
-    private String lastName;
-    private String fullName;
-    private String emailAddress;
-    private String username;
-
-    public String getSub() {
-        return sub;
-    }
-
-    public UserInfo setSub(String sub) {
-        this.sub = sub;
-        return this;
-    }
-
-    public String getFirstName() {
-        return firstName;
-    }
-
-    public UserInfo setFirstName(String firstName) {
-        this.firstName = firstName;
-        return this;
-    }
-
-    public String getLastName() {
-        return lastName;
-    }
-
-    public UserInfo setLastName(String lastName) {
-        this.lastName = lastName;
-        return this;
-    }
-
-    public String getFullName() {
-        return fullName;
-    }
-
-    public UserInfo setFullName(String fullName) {
-        this.fullName = fullName;
-        return this;
-    }
-
-    public String getEmailAddress() {
-        return emailAddress;
-    }
-
-    public UserInfo setEmailAddress(String emailAddress) {
-        this.emailAddress = emailAddress;
-        return this;
-    }
-
-    public String getUsername() {
-        return username;
-    }
-
-    public UserInfo setUsername(String username) {
-        this.username = username;
-        return this;
-    }
-}
diff --git a/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/handlers/TenantProfileServiceHandler.java b/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/handlers/TenantProfileServiceHandler.java
index 587095d..32960e9 100644
--- a/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/handlers/TenantProfileServiceHandler.java
+++ b/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/handlers/TenantProfileServiceHandler.java
@@ -45,7 +45,6 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface {
     private final static Logger logger = LoggerFactory.getLogger(TenantProfileServiceHandler.class);
 
     private TenantProfileRepository tenantProfileRepository;
-    //private DBEventPublisherUtils dbEventPublisherUtils = new DBEventPublisherUtils(DBEventService.TENANT);
 
     public TenantProfileServiceHandler() {
         logger.debug("Initializing TenantProfileServiceHandler");
@@ -75,13 +74,10 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface {
                     if (gateway.getGatewayApprovalStatus().equals(GatewayApprovalStatus.APPROVED)) {
                         logger.info("Gateway with ID: {}, is now APPROVED, replicating to subscribers.", gateway.getGatewayId());
                         return gateway;
-                        //dbEventPublisherUtils.publish(EntityType.TENANT, CrudType.CREATE, gateway);
                     }
                     else {
                         throw new Exception("Gateway status is not approved");
                     }
-//                    // return internal id
-//                    return gateway.getAiravataInternalGatewayId();
                 } else {
                     throw new Exception("Gateway object is null.");
                 }
@@ -112,8 +108,6 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface {
 
             if (tenantProfileRepository.update(updatedGateway) != null) {
                 logger.debug("Updated gateway-profile with ID: " + updatedGateway.getGatewayId());
-                // replicate tenant at end-places
-//                dbEventPublisherUtils.publish(EntityType.TENANT, CrudType.UPDATE, updatedGateway);
                 return updatedGateway;
             } else {
                 throw new TException("Could not update the gateway");
@@ -143,10 +137,10 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface {
         }
     }
 
-    //TODO: check why this was not included, add authToken
+    //TODO: check why this was not included
     @Override
     @SecurityCheck
-    public Gateway getGatewayUsingGatewayId(String gatewayId) throws TenantProfileServiceException, AuthorizationException, TException {
+    public Gateway getGatewayUsingGatewayId(AuthzToken authzToken,String gatewayId) throws TenantProfileServiceException, AuthorizationException, TException {
         try {
             Gateway gateway = tenantProfileRepository.getGatewayUsingId(gatewayId);
             if (gateway == null) {
@@ -168,11 +162,6 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface {
             logger.debug("Deleting Custos gateway-profile with ID: " + gatewayId + "Internal ID: " + custosInternalGatewayId);
             boolean deleteSuccess = tenantProfileRepository.delete(custosInternalGatewayId);
             if (deleteSuccess) {
-                // delete tenant at end-places
-//                dbEventPublisherUtils.publish(EntityType.TENANT, CrudType.DELETE,
-//                        // pass along gateway datamodel, with correct gatewayId;
-//                        // approvalstatus is not used for delete, hence set dummy value
-//                        new Gateway(gatewayId, GatewayApprovalStatus.DEACTIVATED));
                 return new Gateway(gatewayId, GatewayApprovalStatus.DEACTIVATED);
             }
             else {
diff --git a/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/handlers/UserProfileServiceHandler.java b/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/handlers/UserProfileServiceHandler.java
index 1068863..8cb9c61 100644
--- a/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/handlers/UserProfileServiceHandler.java
+++ b/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/handlers/UserProfileServiceHandler.java
@@ -20,15 +20,15 @@
 */
 package org.apache.custos.profile.handlers;
 
-
-import org.apache.custos.client.profile.service.ProfileServiceClientFactory;
 import org.apache.custos.commons.exceptions.ApplicationSettingsException;
 import org.apache.custos.commons.exceptions.CustosSecurityException;
 import org.apache.custos.commons.model.error.AuthorizationException;
 import org.apache.custos.commons.model.security.AuthzToken;
+import org.apache.custos.commons.model.security.UserInfo;
 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.client.ProfileServiceClientFactory;
 import org.apache.custos.profile.iam.admin.services.cpi.IamAdminServices;
 import org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
 import org.apache.custos.profile.model.user.Status;
@@ -40,7 +40,6 @@ import org.apache.custos.profile.user.cpi.exception.UserProfileServiceException;
 import org.apache.custos.security.interceptor.SecurityCheck;
 import org.apache.custos.security.manager.CustosSecurityManager;
 import org.apache.custos.security.manager.SecurityManagerFactory;
-import org.apache.custos.security.manager.UserInfo;
 import org.apache.thrift.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,7 +52,6 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
     private final static Logger logger = LoggerFactory.getLogger(UserProfileServiceHandler.class);
 
     private UserProfileRepository userProfileRepository;
-    //private DBEventPublisherUtils dbEventPublisherUtils = new DBEventPublisherUtils(DBEventService.USER_PROFILE);
 
     public UserProfileServiceHandler() {
 
@@ -66,14 +64,14 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
     }
 
     @Override
-    @SecurityCheck
+    //@SecurityCheck
     public UserProfile initializeUserProfile(AuthzToken authzToken) throws UserProfileServiceException, AuthorizationException {
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         try {
             // Load UserInfo for the access token and create an initial UserProfile from it
             UserInfo userInfo = SecurityManagerFactory.getSecurityManager().getUserInfoFromAuthzToken(authzToken);
             final UserProfile existingProfile = userProfileRepository.getUserProfileByIdAndGateWay(userInfo.getUsername(), gatewayId);
-            // If a user profile already exists, just return the userId
+            // If a user profile already exists, just return the existing profile
             if (existingProfile != null) {
                 return existingProfile;
             }
@@ -104,7 +102,7 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
     }
 
     @Override
-    @SecurityCheck
+    //@SecurityCheck
     public UserProfile addUserProfile(AuthzToken authzToken, UserProfile userProfile) throws UserProfileServiceException, AuthorizationException {
         try{
             // Lowercase user id and internal id
@@ -126,7 +124,7 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
     }
 
     @Override
-    @SecurityCheck
+    //@SecurityCheck
     public UserProfile updateUserProfile(AuthzToken authzToken, UserProfile userProfile) throws UserProfileServiceException, AuthorizationException {
         try {
             // After updating the user profile in the database but before committing the transaction, the
@@ -151,7 +149,7 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
         return () -> {
             try {
                 CustosSecurityManager securityManager = SecurityManagerFactory.getSecurityManager();
-                AuthzToken serviceAccountAuthzToken = securityManager.getUserManagementServiceAccountAuthzToken(gatewayId);
+                AuthzToken serviceAccountAuthzToken = securityManager.getUserManagementServiceAccountAuthzToken(authzToken,gatewayId);
                 IamAdminServices.Client iamAdminServicesClient = getIamAdminServicesClient();
                 iamAdminServicesClient.updateUserProfile(serviceAccountAuthzToken, userProfile);
             } catch (CustosSecurityException |TException e) {
@@ -161,7 +159,7 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
     }
 
     @Override
-    @SecurityCheck
+    //@SecurityCheck
     public UserProfile getUserProfileById(AuthzToken authzToken, String userId, String gatewayId) throws UserProfileServiceException, AuthorizationException, TException {
         try{
             UserProfile userProfile = userProfileRepository.getUserProfileByIdAndGateWay(userId, gatewayId);
@@ -178,7 +176,7 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
     }
 
     @Override
-    @SecurityCheck
+    //@SecurityCheck
     public UserProfile deleteUserProfile(AuthzToken authzToken, String userId, String gatewayId) throws UserProfileServiceException, AuthorizationException, TException {
         UserProfile userProfile = null;
         try{
@@ -198,7 +196,7 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
     }
 
     @Override
-    @SecurityCheck
+    //@SecurityCheck
     public List<UserProfile> getAllUserProfilesInGateway(AuthzToken authzToken, String gatewayId, int offset, int limit) throws UserProfileServiceException, AuthorizationException {
         try{
             List<UserProfile> usersInGateway = userProfileRepository.getAllUserProfilesInGateway(gatewayId, offset, limit);
diff --git a/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/server/ProfileServiceServer.java b/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/server/ProfileServiceServer.java
index cb1923e..55ce1ca 100644
--- a/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/server/ProfileServiceServer.java
+++ b/custos-profile-service/profile-service-server/src/main/java/org/apache/custos/profile/server/ProfileServiceServer.java
@@ -101,14 +101,14 @@ public class ProfileServiceServer implements IServer {
 
             // create multiple processors for each profile-service
             UserProfileService.Processor userProfileProcessor = new UserProfileService.Processor(new UserProfileServiceHandler());
-            TenantProfileService.Processor teneantProfileProcessor = new TenantProfileService.Processor(new TenantProfileServiceHandler());
+            //TenantProfileService.Processor teneantProfileProcessor = new TenantProfileService.Processor(new TenantProfileServiceHandler());
             IamAdminServices.Processor iamAdminServicesProcessor = new IamAdminServices.Processor(new IamAdminServicesHandler());
             //GroupManagerService.Processor groupmanagerProcessor = new GroupManagerService.Processor(new GroupManagerServiceHandler());
 
             // create a multiplexed processor
             TMultiplexedProcessor profileServiceProcessor = new TMultiplexedProcessor();
             profileServiceProcessor.registerProcessor(profile_user_cpiConstants.USER_PROFILE_CPI_NAME, userProfileProcessor);
-            profileServiceProcessor.registerProcessor(profile_tenant_cpiConstants.TENANT_PROFILE_CPI_NAME, teneantProfileProcessor);
+            //profileServiceProcessor.registerProcessor(profile_tenant_cpiConstants.TENANT_PROFILE_CPI_NAME, teneantProfileProcessor);
             profileServiceProcessor.registerProcessor(iam_admin_services_cpiConstants.IAM_ADMIN_SERVICES_CPI_NAME, iamAdminServicesProcessor);
             //profileServiceProcessor.registerProcessor(group_manager_cpiConstants.GROUP_MANAGER_CPI_NAME, groupmanagerProcessor);
 
diff --git a/custos-client/src/main/java/org/apache/custos/client/profile/service/ProfileServiceClientFactory.java b/custos-profile-service/profile-service-stubs/src/main/java/org/apache/custos/profile/client/ProfileServiceClientFactory.java
similarity index 83%
rename from custos-client/src/main/java/org/apache/custos/client/profile/service/ProfileServiceClientFactory.java
rename to custos-profile-service/profile-service-stubs/src/main/java/org/apache/custos/profile/client/ProfileServiceClientFactory.java
index aa8f476..c62f467 100644
--- a/custos-client/src/main/java/org/apache/custos/client/profile/service/ProfileServiceClientFactory.java
+++ b/custos-profile-service/profile-service-stubs/src/main/java/org/apache/custos/profile/client/ProfileServiceClientFactory.java
@@ -1,4 +1,4 @@
-/**
+/*
  *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -16,8 +16,9 @@
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
+ *
  */
-package org.apache.custos.client.profile.service;
+package org.apache.custos.profile.client;
 
 import org.apache.custos.profile.iam.admin.services.cpi.IamAdminServices;
 import org.apache.custos.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
@@ -74,16 +75,4 @@ public class ProfileServiceClientFactory {
             throw new IamAdminServicesException(e.getMessage());
         }
     }
-
-//    public static GroupManagerService.Client createGroupManagerServiceClient(String serverHost, int serverPort)  throws GroupManagerServiceException {
-//        try {
-//            TTransport transport = new TSocket(serverHost, serverPort);
-//            transport.open();
-//            TProtocol protocol = new TBinaryProtocol(transport);
-//            TMultiplexedProtocol multiplexedProtocol = new TMultiplexedProtocol(protocol, group_manager_cpiConstants.GROUP_MANAGER_CPI_NAME);
-//            return new GroupManagerService.Client(multiplexedProtocol);
-//        } catch (TTransportException e) {
-//            throw new GroupManagerServiceException(e.getMessage());
-//        }
-//    }
 }
\ No newline at end of file
diff --git a/custos-profile-service/profile-service-stubs/src/main/java/org/apache/custos/profile/tenant.cpi/TenantProfileService.java b/custos-profile-service/profile-service-stubs/src/main/java/org/apache/custos/profile/tenant.cpi/TenantProfileService.java
index fd14208..3bb0507 100644
--- a/custos-profile-service/profile-service-stubs/src/main/java/org/apache/custos/profile/tenant.cpi/TenantProfileService.java
+++ b/custos-profile-service/profile-service-stubs/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-06-24")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2019-07-05")
 public class TenantProfileService {
 
   public interface Iface {
@@ -26,7 +26,7 @@ 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.custos.commons.model.error.AuthorizationException, org.apache.thrift.TException;
 
-    public org.apache.custos.profile.model.workspace.Gateway getGatewayUsingGatewayId(String gatewayId) throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.custos.commons.model.error.AuthorizationException, 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.custos.commons.model.error.AuthorizationException, 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.custos.commons.model.error.AuthorizationException, org.apache.thrift.TException;
 
@@ -48,7 +48,7 @@ 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(String gatewayId, 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;
 
@@ -195,15 +195,16 @@ 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(String gatewayId) throws org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.custos.commons.model.error.AuthorizationException, 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.custos.commons.model.error.AuthorizationException, org.apache.thrift.TException
     {
-      send_getGatewayUsingGatewayId(gatewayId);
+      send_getGatewayUsingGatewayId(authzToken, gatewayId);
       return recv_getGatewayUsingGatewayId();
     }
 
-    public void send_getGatewayUsingGatewayId(String gatewayId) throws org.apache.thrift.TException
+    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);
     }
@@ -496,23 +497,26 @@ public class TenantProfileService {
       }
     }
 
-    public void getGatewayUsingGatewayId(String gatewayId, 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 {
       checkReady();
-      getGatewayUsingGatewayId_call method_call = new getGatewayUsingGatewayId_call(gatewayId, resultHandler, this, ___protocolFactory, ___transport);
+      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(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 {
+      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();
@@ -836,7 +840,7 @@ public class TenantProfileService {
       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.gatewayId);
+          result.success = iface.getGatewayUsingGatewayId(args.authzToken, args.gatewayId);
         } catch (org.apache.custos.profile.tenant.cpi.exception.TenantProfileServiceException tpe) {
           result.tpe = tpe;
         } catch (org.apache.custos.commons.model.error.AuthorizationException ae) {
@@ -1333,7 +1337,7 @@ public class TenantProfileService {
       }
 
       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.gatewayId,resultHandler);
+        iface.getGatewayUsingGatewayId(args.authzToken, args.gatewayId,resultHandler);
       }
     }
 
@@ -5513,16 +5517,19 @@ 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 GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1);
+    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 {
-      GATEWAY_ID((short)1, "gatewayId");
+      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>();
 
@@ -5538,7 +5545,9 @@ public class TenantProfileService {
       @org.apache.thrift.annotation.Nullable
       public static _Fields findByThriftId(int fieldId) {
         switch(fieldId) {
-          case 1: // GATEWAY_ID
+          case 1: // AUTHZ_TOKEN
+            return AUTHZ_TOKEN;
+          case 2: // GATEWAY_ID
             return GATEWAY_ID;
           default:
             return null;
@@ -5584,6 +5593,8 @@ public class TenantProfileService {
     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);
@@ -5594,9 +5605,11 @@ public class TenantProfileService {
     }
 
     public getGatewayUsingGatewayId_args(
+      org.apache.custos.commons.model.security.AuthzToken authzToken,
       String gatewayId)
     {
       this();
+      this.authzToken = authzToken;
       this.gatewayId = gatewayId;
     }
 
@@ -5604,6 +5617,9 @@ public class TenantProfileService {
      * 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;
       }
@@ -5615,10 +5631,36 @@ public class TenantProfileService {
 
     @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;
     }
@@ -5645,6 +5687,14 @@ public class TenantProfileService {
 
     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();
@@ -5659,6 +5709,9 @@ public class TenantProfileService {
     @org.apache.thrift.annotation.Nullable
     public Object getFieldValue(_Fields field) {
       switch (field) {
+      case AUTHZ_TOKEN:
+        return getAuthzToken();
+
       case GATEWAY_ID:
         return getGatewayId();
 
@@ -5673,6 +5726,8 @@ public class TenantProfileService {
       }
 
       switch (field) {
+      case AUTHZ_TOKEN:
+        return isSetAuthzToken();
       case GATEWAY_ID:
         return isSetGatewayId();
       }
@@ -5694,6 +5749,15 @@ public class TenantProfileService {
       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) {
@@ -5710,6 +5774,10 @@ public class TenantProfileService {
     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();
@@ -5725,6 +5793,16 @@ public class TenantProfileService {
 
       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;
@@ -5756,6 +5834,14 @@ public class TenantProfileService {
       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");
@@ -5769,10 +5855,16 @@ public class TenantProfileService {
 
     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 {
@@ -5809,7 +5901,16 @@ public class TenantProfileService {
             break;
           }
           switch (schemeField.id) {
-            case 1: // GATEWAY_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);
@@ -5832,6 +5933,11 @@ public class TenantProfileService {
         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);
@@ -5854,12 +5960,16 @@ public class TenantProfileService {
       @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);
       }
diff --git a/pom.xml b/pom.xml
index 7bcdf03..59f9579 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,6 +21,7 @@
         <module>custos-profile-service</module>
         <module>custos-client</module>
         <module>ide-integration</module>
+        <module>custos-authentication</module>
     </modules>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/thrift-interfaces/authentication-service/authentication-service-cpi.thrift b/thrift-interfaces/authentication-service/authentication-service-cpi.thrift
new file mode 100644
index 0000000..3e40dd3
--- /dev/null
+++ b/thrift-interfaces/authentication-service/authentication-service-cpi.thrift
@@ -0,0 +1,14 @@
+namespace java org.apache.custos.authentication.cpi
+namespace php Custos.Authentication.CPI
+namespace py custos.authentication.cpi
+
+include "../custos-apis/security_model.thrift"
+include "authentication_service_cpi_errors.thrift"
+include "../custos-apis/userInfo_model.thrift"
+
+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) throws (1: authentication_service_cpi_errors.CustosAuthenticationServiceException ae)
+}
diff --git a/thrift-interfaces/authentication-service/authentication_service_cpi_errors.thrift b/thrift-interfaces/authentication-service/authentication_service_cpi_errors.thrift
new file mode 100644
index 0000000..a2eae1b
--- /dev/null
+++ b/thrift-interfaces/authentication-service/authentication_service_cpi_errors.thrift
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+namespace java org.apache.custos.authentication.cpi.exception
+namespace php Custos.Authentication.CPI.Error
+namespace py custos.authentication.cpi.error
+
+exception CustosAuthenticationServiceException {
+  1: required string message
+}
diff --git a/thrift-interfaces/custos-apis/userInfo_model.thrift b/thrift-interfaces/custos-apis/userInfo_model.thrift
new file mode 100644
index 0000000..f2af21f
--- /dev/null
+++ b/thrift-interfaces/custos-apis/userInfo_model.thrift
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+namespace java org.apache.custos.commons.model.security
+namespace php Custos.Commons.Model.Security
+namespace cpp apache.custos.commons.model.security
+namespace py custos.commons.model.security
+
+struct UserInfo {
+    1: required string sub;
+    2: required string firstName;
+    3: required string lastName;
+    4: required string fullName;
+    5: required string emailAddress;
+    6: required string username;
+}
\ No newline at end of file
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 826fc57..ad5b2c3 100644
--- a/thrift-interfaces/profile-service/profile-tenant/profile-tenant-cpi.thrift
+++ b/thrift-interfaces/profile-service/profile-tenant/profile-tenant-cpi.thrift
@@ -57,9 +57,9 @@ service TenantProfileService {
                                         2: required string custosInternalGatewayId)
                                      throws (1: profile_tenant_cpi_errors.TenantProfileServiceException tpe,
                                              2: custos_errors.AuthorizationException ae)
-    //TODO: check why this method was not included here, add authztoken
-    workspace_model.Gateway getGatewayUsingGatewayId (
-                                             1: required string gatewayId)
+    //TODO: check why this method was not included here
+    workspace_model.Gateway getGatewayUsingGatewayId (1: required security_model.AuthzToken authzToken,
+                                             2: required string gatewayId)
                                           throws (1: profile_tenant_cpi_errors.TenantProfileServiceException tpe,
                                                   2: custos_errors.AuthorizationException ae)