Repository: airavata
Updated Branches:
  refs/heads/develop 26e832d6c -> d678f4fc1


http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
----------------------------------------------------------------------
diff --git 
a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
 
b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
index fe72dce..f235e48 100644
--- 
a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
+++ 
b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php
@@ -253,34 +253,12 @@ interface AiravataIf {
    *    The User for which the credential should be registered. For community 
accounts, this user is the name of the
    *    community user name. For computational resources, this user name need 
not be the same user name on resoruces.
    * 
-   * @return airavataCredStoreToken
-   *   An SSH Key pair is generated and stored in the credential store and 
associated with users or community account
-   *   belonging to a Gateway.
-   * 
-   * 
-   * 
-   * @param \Airavata\Model\Security\AuthzToken $authzToken
-   * @param string $gatewayId
-   * @param string $userName
-   * @return string
-   * @throws \Airavata\API\Error\InvalidRequestException
-   * @throws \Airavata\API\Error\AiravataClientException
-   * @throws \Airavata\API\Error\AiravataSystemException
-   */
-  public function 
generateAndRegisterSSHKeys(\Airavata\Model\Security\AuthzToken $authzToken, 
$gatewayId, $userName);
-  /**
-   * Generate and Register SSH Key Pair with Airavata Credential Store.
-   * 
-   * @param gatewayId
-   *    The identifier for the requested Gateway.
-   * 
-   * @param userName
-   *    The User for which the credential should be registered. For community 
accounts, this user is the name of the
-   *    community user name. For computational resources, this user name need 
not be the same user name on resoruces.
-   * 
    * @param description
    *    The description field for a credential type, all type of credential 
can have a description.
    * 
+   * @param credentialOwnerType
+   *    The type of owner of this credential. Two possible values: GATEWAY 
(default) and USER
+   * 
    * @return airavataCredStoreToken
    *   An SSH Key pair is generated and stored in the credential store and 
associated with users or community account
    *   belonging to a Gateway.
@@ -291,12 +269,13 @@ interface AiravataIf {
    * @param string $gatewayId
    * @param string $userName
    * @param string $description
+   * @param int $credentialOwnerType
    * @return string
    * @throws \Airavata\API\Error\InvalidRequestException
    * @throws \Airavata\API\Error\AiravataClientException
    * @throws \Airavata\API\Error\AiravataSystemException
    */
-  public function 
generateAndRegisterSSHKeysWithDescription(\Airavata\Model\Security\AuthzToken 
$authzToken, $gatewayId, $userName, $description);
+  public function 
generateAndRegisterSSHKeys(\Airavata\Model\Security\AuthzToken $authzToken, 
$gatewayId, $userName, $description, $credentialOwnerType);
   /**
    * Generate and Register Username PWD Pair with Airavata Credential Store.
    * 
@@ -5007,18 +4986,20 @@ class AiravataClient implements 
\Airavata\API\AiravataIf {
     throw new \Exception("getAllNotifications failed: unknown result");
   }
 
-  public function 
generateAndRegisterSSHKeys(\Airavata\Model\Security\AuthzToken $authzToken, 
$gatewayId, $userName)
+  public function 
generateAndRegisterSSHKeys(\Airavata\Model\Security\AuthzToken $authzToken, 
$gatewayId, $userName, $description, $credentialOwnerType)
   {
-    $this->send_generateAndRegisterSSHKeys($authzToken, $gatewayId, $userName);
+    $this->send_generateAndRegisterSSHKeys($authzToken, $gatewayId, $userName, 
$description, $credentialOwnerType);
     return $this->recv_generateAndRegisterSSHKeys();
   }
 
-  public function 
send_generateAndRegisterSSHKeys(\Airavata\Model\Security\AuthzToken 
$authzToken, $gatewayId, $userName)
+  public function 
send_generateAndRegisterSSHKeys(\Airavata\Model\Security\AuthzToken 
$authzToken, $gatewayId, $userName, $description, $credentialOwnerType)
   {
     $args = new \Airavata\API\Airavata_generateAndRegisterSSHKeys_args();
     $args->authzToken = $authzToken;
     $args->gatewayId = $gatewayId;
     $args->userName = $userName;
+    $args->description = $description;
+    $args->credentialOwnerType = $credentialOwnerType;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && 
function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
     {
@@ -5069,69 +5050,6 @@ class AiravataClient implements \Airavata\API\AiravataIf 
{
     throw new \Exception("generateAndRegisterSSHKeys failed: unknown result");
   }
 
-  public function 
generateAndRegisterSSHKeysWithDescription(\Airavata\Model\Security\AuthzToken 
$authzToken, $gatewayId, $userName, $description)
-  {
-    $this->send_generateAndRegisterSSHKeysWithDescription($authzToken, 
$gatewayId, $userName, $description);
-    return $this->recv_generateAndRegisterSSHKeysWithDescription();
-  }
-
-  public function 
send_generateAndRegisterSSHKeysWithDescription(\Airavata\Model\Security\AuthzToken
 $authzToken, $gatewayId, $userName, $description)
-  {
-    $args = new 
\Airavata\API\Airavata_generateAndRegisterSSHKeysWithDescription_args();
-    $args->authzToken = $authzToken;
-    $args->gatewayId = $gatewayId;
-    $args->userName = $userName;
-    $args->description = $description;
-    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && 
function_exists('thrift_protocol_write_binary');
-    if ($bin_accel)
-    {
-      thrift_protocol_write_binary($this->output_, 
'generateAndRegisterSSHKeysWithDescription', TMessageType::CALL, $args, 
$this->seqid_, $this->output_->isStrictWrite());
-    }
-    else
-    {
-      
$this->output_->writeMessageBegin('generateAndRegisterSSHKeysWithDescription', 
TMessageType::CALL, $this->seqid_);
-      $args->write($this->output_);
-      $this->output_->writeMessageEnd();
-      $this->output_->getTransport()->flush();
-    }
-  }
-
-  public function recv_generateAndRegisterSSHKeysWithDescription()
-  {
-    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && 
function_exists('thrift_protocol_read_binary');
-    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, 
'\Airavata\API\Airavata_generateAndRegisterSSHKeysWithDescription_result', 
$this->input_->isStrictRead());
-    else
-    {
-      $rseqid = 0;
-      $fname = null;
-      $mtype = 0;
-
-      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
-      if ($mtype == TMessageType::EXCEPTION) {
-        $x = new TApplicationException();
-        $x->read($this->input_);
-        $this->input_->readMessageEnd();
-        throw $x;
-      }
-      $result = new 
\Airavata\API\Airavata_generateAndRegisterSSHKeysWithDescription_result();
-      $result->read($this->input_);
-      $this->input_->readMessageEnd();
-    }
-    if ($result->success !== null) {
-      return $result->success;
-    }
-    if ($result->ire !== null) {
-      throw $result->ire;
-    }
-    if ($result->ace !== null) {
-      throw $result->ace;
-    }
-    if ($result->ase !== null) {
-      throw $result->ase;
-    }
-    throw new \Exception("generateAndRegisterSSHKeysWithDescription failed: 
unknown result");
-  }
-
   public function registerPwdCredential(\Airavata\Model\Security\AuthzToken 
$authzToken, $gatewayId, $portalUserName, $loginUserName, $password, 
$description)
   {
     $this->send_registerPwdCredential($authzToken, $gatewayId, 
$portalUserName, $loginUserName, $password, $description);
@@ -19181,286 +19099,14 @@ class Airavata_generateAndRegisterSSHKeys_args {
    * @var string
    */
   public $userName = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        1 => array(
-          'var' => 'authzToken',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\Model\Security\AuthzToken',
-          ),
-        2 => array(
-          'var' => 'gatewayId',
-          'type' => TType::STRING,
-          ),
-        3 => array(
-          'var' => 'userName',
-          'type' => TType::STRING,
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['authzToken'])) {
-        $this->authzToken = $vals['authzToken'];
-      }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
-      if (isset($vals['userName'])) {
-        $this->userName = $vals['userName'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_generateAndRegisterSSHKeys_args';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->authzToken = new \Airavata\Model\Security\AuthzToken();
-            $xfer += $this->authzToken->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->userName);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += 
$output->writeStructBegin('Airavata_generateAndRegisterSSHKeys_args');
-    if ($this->authzToken !== null) {
-      if (!is_object($this->authzToken)) {
-        throw new TProtocolException('Bad type in structure.', 
TProtocolException::INVALID_DATA);
-      }
-      $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1);
-      $xfer += $this->authzToken->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
-      $xfer += $output->writeString($this->gatewayId);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->userName !== null) {
-      $xfer += $output->writeFieldBegin('userName', TType::STRING, 3);
-      $xfer += $output->writeString($this->userName);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_generateAndRegisterSSHKeys_result {
-  static $_TSPEC;
-
   /**
    * @var string
    */
-  public $success = null;
-  /**
-   * @var \Airavata\API\Error\InvalidRequestException
-   */
-  public $ire = null;
-  /**
-   * @var \Airavata\API\Error\AiravataClientException
-   */
-  public $ace = null;
-  /**
-   * @var \Airavata\API\Error\AiravataSystemException
-   */
-  public $ase = null;
-
-  public function __construct($vals=null) {
-    if (!isset(self::$_TSPEC)) {
-      self::$_TSPEC = array(
-        0 => array(
-          'var' => 'success',
-          'type' => TType::STRING,
-          ),
-        1 => array(
-          'var' => 'ire',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\InvalidRequestException',
-          ),
-        2 => array(
-          'var' => 'ace',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataClientException',
-          ),
-        3 => array(
-          'var' => 'ase',
-          'type' => TType::STRUCT,
-          'class' => '\Airavata\API\Error\AiravataSystemException',
-          ),
-        );
-    }
-    if (is_array($vals)) {
-      if (isset($vals['success'])) {
-        $this->success = $vals['success'];
-      }
-      if (isset($vals['ire'])) {
-        $this->ire = $vals['ire'];
-      }
-      if (isset($vals['ace'])) {
-        $this->ace = $vals['ace'];
-      }
-      if (isset($vals['ase'])) {
-        $this->ase = $vals['ase'];
-      }
-    }
-  }
-
-  public function getName() {
-    return 'Airavata_generateAndRegisterSSHKeys_result';
-  }
-
-  public function read($input)
-  {
-    $xfer = 0;
-    $fname = null;
-    $ftype = 0;
-    $fid = 0;
-    $xfer += $input->readStructBegin($fname);
-    while (true)
-    {
-      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
-      if ($ftype == TType::STOP) {
-        break;
-      }
-      switch ($fid)
-      {
-        case 0:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->success);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 1:
-          if ($ftype == TType::STRUCT) {
-            $this->ire = new \Airavata\API\Error\InvalidRequestException();
-            $xfer += $this->ire->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 2:
-          if ($ftype == TType::STRUCT) {
-            $this->ace = new \Airavata\API\Error\AiravataClientException();
-            $xfer += $this->ace->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 3:
-          if ($ftype == TType::STRUCT) {
-            $this->ase = new \Airavata\API\Error\AiravataSystemException();
-            $xfer += $this->ase->read($input);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        default:
-          $xfer += $input->skip($ftype);
-          break;
-      }
-      $xfer += $input->readFieldEnd();
-    }
-    $xfer += $input->readStructEnd();
-    return $xfer;
-  }
-
-  public function write($output) {
-    $xfer = 0;
-    $xfer += 
$output->writeStructBegin('Airavata_generateAndRegisterSSHKeys_result');
-    if ($this->success !== null) {
-      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
-      $xfer += $output->writeString($this->success);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ire !== null) {
-      $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1);
-      $xfer += $this->ire->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ace !== null) {
-      $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2);
-      $xfer += $this->ace->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->ase !== null) {
-      $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3);
-      $xfer += $this->ase->write($output);
-      $xfer += $output->writeFieldEnd();
-    }
-    $xfer += $output->writeFieldStop();
-    $xfer += $output->writeStructEnd();
-    return $xfer;
-  }
-
-}
-
-class Airavata_generateAndRegisterSSHKeysWithDescription_args {
-  static $_TSPEC;
-
-  /**
-   * @var \Airavata\Model\Security\AuthzToken
-   */
-  public $authzToken = null;
-  /**
-   * @var string
-   */
-  public $gatewayId = null;
-  /**
-   * @var string
-   */
-  public $userName = null;
+  public $description = null;
   /**
-   * @var string
+   * @var int
    */
-  public $description = null;
+  public $credentialOwnerType = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -19482,6 +19128,10 @@ class 
Airavata_generateAndRegisterSSHKeysWithDescription_args {
           'var' => 'description',
           'type' => TType::STRING,
           ),
+        5 => array(
+          'var' => 'credentialOwnerType',
+          'type' => TType::I32,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -19497,11 +19147,14 @@ class 
Airavata_generateAndRegisterSSHKeysWithDescription_args {
       if (isset($vals['description'])) {
         $this->description = $vals['description'];
       }
+      if (isset($vals['credentialOwnerType'])) {
+        $this->credentialOwnerType = $vals['credentialOwnerType'];
+      }
     }
   }
 
   public function getName() {
-    return 'Airavata_generateAndRegisterSSHKeysWithDescription_args';
+    return 'Airavata_generateAndRegisterSSHKeys_args';
   }
 
   public function read($input)
@@ -19548,6 +19201,13 @@ class 
Airavata_generateAndRegisterSSHKeysWithDescription_args {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 5:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->credentialOwnerType);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -19560,7 +19220,7 @@ class 
Airavata_generateAndRegisterSSHKeysWithDescription_args {
 
   public function write($output) {
     $xfer = 0;
-    $xfer += 
$output->writeStructBegin('Airavata_generateAndRegisterSSHKeysWithDescription_args');
+    $xfer += 
$output->writeStructBegin('Airavata_generateAndRegisterSSHKeys_args');
     if ($this->authzToken !== null) {
       if (!is_object($this->authzToken)) {
         throw new TProtocolException('Bad type in structure.', 
TProtocolException::INVALID_DATA);
@@ -19584,6 +19244,11 @@ class 
Airavata_generateAndRegisterSSHKeysWithDescription_args {
       $xfer += $output->writeString($this->description);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->credentialOwnerType !== null) {
+      $xfer += $output->writeFieldBegin('credentialOwnerType', TType::I32, 5);
+      $xfer += $output->writeI32($this->credentialOwnerType);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -19591,7 +19256,7 @@ class 
Airavata_generateAndRegisterSSHKeysWithDescription_args {
 
 }
 
-class Airavata_generateAndRegisterSSHKeysWithDescription_result {
+class Airavata_generateAndRegisterSSHKeys_result {
   static $_TSPEC;
 
   /**
@@ -19652,7 +19317,7 @@ class 
Airavata_generateAndRegisterSSHKeysWithDescription_result {
   }
 
   public function getName() {
-    return 'Airavata_generateAndRegisterSSHKeysWithDescription_result';
+    return 'Airavata_generateAndRegisterSSHKeys_result';
   }
 
   public function read($input)
@@ -19713,7 +19378,7 @@ class 
Airavata_generateAndRegisterSSHKeysWithDescription_result {
 
   public function write($output) {
     $xfer = 0;
-    $xfer += 
$output->writeStructBegin('Airavata_generateAndRegisterSSHKeysWithDescription_result');
+    $xfer += 
$output->writeStructBegin('Airavata_generateAndRegisterSSHKeys_result');
     if ($this->success !== null) {
       $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
       $xfer += $output->writeString($this->success);

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Credential/Store/Types.php
----------------------------------------------------------------------
diff --git 
a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Credential/Store/Types.php
 
b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Credential/Store/Types.php
index 82139a3..d8e3f13 100644
--- 
a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Credential/Store/Types.php
+++ 
b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Credential/Store/Types.php
@@ -17,6 +17,15 @@ use Thrift\Protocol\TBinaryProtocolAccelerated;
 use Thrift\Exception\TApplicationException;
 
 
+final class CredentialOwnerType {
+  const GATEWAY = 0;
+  const USER = 1;
+  static public $__names = array(
+    0 => 'GATEWAY',
+    1 => 'USER',
+  );
+}
+
 class SSHCredential {
   static $_TSPEC;
 
@@ -52,6 +61,10 @@ class SSHCredential {
    * @var string
    */
   public $description = null;
+  /**
+   * @var int
+   */
+  public $credentialOwnerType =   0;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -88,6 +101,10 @@ class SSHCredential {
           'var' => 'description',
           'type' => TType::STRING,
           ),
+        9 => array(
+          'var' => 'credentialOwnerType',
+          'type' => TType::I32,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -115,6 +132,9 @@ class SSHCredential {
       if (isset($vals['description'])) {
         $this->description = $vals['description'];
       }
+      if (isset($vals['credentialOwnerType'])) {
+        $this->credentialOwnerType = $vals['credentialOwnerType'];
+      }
     }
   }
 
@@ -193,6 +213,13 @@ class SSHCredential {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 9:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->credentialOwnerType);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -246,6 +273,11 @@ class SSHCredential {
       $xfer += $output->writeString($this->description);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->credentialOwnerType !== null) {
+      $xfer += $output->writeFieldBegin('credentialOwnerType', TType::I32, 9);
+      $xfer += $output->writeI32($this->credentialOwnerType);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
index c6823e2..bef8363 100644
--- 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
+++ 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/Credential.java
@@ -35,6 +35,7 @@ public abstract class Credential implements Serializable {
     private String portalUserName;
     private Date persistedTime;
     private String token;
+    private CredentialOwnerType credentialOwnerType = 
CredentialOwnerType.GATEWAY;
 
     public String getDescription() {
         return description;
@@ -71,4 +72,7 @@ public abstract class Credential implements Serializable {
         return persistedTime;
     }
 
+    public CredentialOwnerType getCredentialOwnerType() { return 
credentialOwnerType; }
+
+    public void setCredentialOwnerType(CredentialOwnerType 
credentialOwnerType) { this.credentialOwnerType = credentialOwnerType; }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CredentialOwnerType.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CredentialOwnerType.java
 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CredentialOwnerType.java
new file mode 100644
index 0000000..18f2ddf
--- /dev/null
+++ 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/CredentialOwnerType.java
@@ -0,0 +1,28 @@
+package org.apache.airavata.credential.store.credential;
+
+/**
+ * Created by marcus on 11/23/16.
+ */
+public enum CredentialOwnerType {
+    
GATEWAY(org.apache.airavata.credential.store.datamodel.CredentialOwnerType.GATEWAY),
+    
USER(org.apache.airavata.credential.store.datamodel.CredentialOwnerType.USER);
+
+    private org.apache.airavata.credential.store.datamodel.CredentialOwnerType 
datamodelType;
+    private 
CredentialOwnerType(org.apache.airavata.credential.store.datamodel.CredentialOwnerType
 datamodelType) {
+       this.datamodelType = datamodelType;
+    }
+
+    public org.apache.airavata.credential.store.datamodel.CredentialOwnerType 
getDatamodelType() {
+        return datamodelType;
+    }
+
+    public static CredentialOwnerType 
findByDataModelType(org.apache.airavata.credential.store.datamodel.CredentialOwnerType
 datamodelType) {
+        for( CredentialOwnerType credentialOwnerType : 
CredentialOwnerType.values() ) {
+            if (credentialOwnerType.datamodelType == datamodelType) {
+                return credentialOwnerType;
+            }
+        }
+
+        throw new RuntimeException("No CredentialOwnerType found for data 
model CredentialOwnerType " + datamodelType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
index 4914395..387e2af 100644
--- 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
+++ 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
@@ -27,6 +27,7 @@ import 
org.apache.airavata.credential.store.cpi.CredentialStoreService;
 import org.apache.airavata.credential.store.cpi.credential_store_cpiConstants;
 import org.apache.airavata.credential.store.credential.CommunityUser;
 import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.credential.CredentialOwnerType;
 import org.apache.airavata.credential.store.datamodel.CertificateCredential;
 import org.apache.airavata.credential.store.datamodel.PasswordCredential;
 import org.apache.airavata.credential.store.datamodel.SSHCredential;
@@ -101,6 +102,7 @@ public class CredentialStoreServerHandler implements 
CredentialStoreService.Ifac
             if (sshCredential.getPublicKey() == null || 
sshCredential.getPrivateKey() == null) {
                 credential = Utility.generateKeyPair(credential);
             }
+            
credential.setCredentialOwnerType(CredentialOwnerType.findByDataModelType(sshCredential.getCredentialOwnerType()));
             sshCredentialWriter.writeCredentials(credential);
             return token;
         } catch (CredentialStoreException e) {
@@ -176,6 +178,7 @@ public class CredentialStoreServerHandler implements 
CredentialStoreService.Ifac
                 sshCredential.setToken(credential1.getToken());
                 
sshCredential.setPersistedTime(credential1.getCertificateRequestedTime().getTime());
                 sshCredential.setDescription(credential1.getDescription());
+                
sshCredential.setCredentialOwnerType(credential1.getCredentialOwnerType().getDatamodelType());
                 return sshCredential;
             } else {
                 log.info("Could not find SSH credentials for token - " + 
tokenId + " and "
@@ -283,7 +286,7 @@ public class CredentialStoreServerHandler implements 
CredentialStoreService.Ifac
                     if (credential instanceof 
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) {
                         
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential 
sshCredential = 
(org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) 
credential;
                         String portalUserName = 
sshCredential.getPortalUserName();
-                        if (portalUserName != null){
+                        if (portalUserName != null && 
sshCredential.getCredentialOwnerType() == CredentialOwnerType.USER){
                             if (portalUserName.equals(username)) {
                                 byte[] publicKey = 
sshCredential.getPublicKey();
                                 if (publicKey != null) {
@@ -311,7 +314,7 @@ public class CredentialStoreServerHandler implements 
CredentialStoreService.Ifac
                     if (credential instanceof 
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) {
                         
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential 
sshCredential = 
(org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) 
credential;
                         byte[] publicKey = sshCredential.getPublicKey();
-                        if (publicKey != null) {
+                        if (publicKey != null && 
sshCredential.getCredentialOwnerType() == CredentialOwnerType.GATEWAY) {
                             sshKeyMap.put(sshCredential.getToken(), new 
String(publicKey));
                         }
                     }
@@ -333,7 +336,8 @@ public class CredentialStoreServerHandler implements 
CredentialStoreService.Ifac
             List<Credential> allCredentials = 
credentialReader.getAllCredentialsPerGateway(gatewayId);
             if (allCredentials != null && !allCredentials.isEmpty()){
                 for (Credential credential : allCredentials) {
-                    if (credential instanceof 
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) {
+                    if (credential instanceof 
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential
+                            && credential.getCredentialOwnerType() == 
CredentialOwnerType.GATEWAY) {
                         
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential 
sshCredential = 
(org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) 
credential;
                         SSHCredentialSummary sshCredentialSummary = new 
SSHCredentialSummary();
                         
sshCredentialSummary.setToken(sshCredential.getToken());
@@ -364,7 +368,7 @@ public class CredentialStoreServerHandler implements 
CredentialStoreService.Ifac
                         
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential 
sshCredential = 
(org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) 
credential;
                         String portalUserName = 
sshCredential.getPortalUserName();
                         String gateway = sshCredential.getGateway();
-                        if (portalUserName != null && gateway != null){
+                        if (portalUserName != null && gateway != null && 
sshCredential.getCredentialOwnerType() == CredentialOwnerType.USER){
                             if (portalUserName.equals(userId) && 
gateway.equals(gatewayId)) {
                                 
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential 
sshCredentialKey = 
(org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) 
credential;
                                 SSHCredentialSummary sshCredentialSummary = 
new SSHCredentialSummary();

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
index 4fbb17d..7770590 100644
--- 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
+++ 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAO.java
@@ -25,6 +25,7 @@ import org.apache.airavata.common.utils.DBUtil;
 import org.apache.airavata.common.utils.KeyStorePasswordCallback;
 import org.apache.airavata.common.utils.SecurityUtil;
 import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.credential.CredentialOwnerType;
 import org.apache.airavata.credential.store.store.CredentialStoreException;
 
 import java.io.*;
@@ -86,7 +87,7 @@ public class CredentialsDAO extends ParentDAO {
     public void addCredentials(String gatewayId, Credential credential, 
Connection connection)
             throws CredentialStoreException {
 
-        String sql = "INSERT INTO CREDENTIALS VALUES (?, ?, ?, ?, ?, ?)";
+        String sql = "INSERT INTO CREDENTIALS VALUES (?, ?, ?, ?, ?, ?, ?)";
 
         PreparedStatement preparedStatement = null;
 
@@ -108,6 +109,8 @@ public class CredentialsDAO extends ParentDAO {
 
             preparedStatement.setString(6,credential.getDescription());
 
+            preparedStatement.setString(7, 
credential.getCredentialOwnerType().toString());
+
             preparedStatement.executeUpdate();
 
         } catch (SQLException e) {
@@ -163,7 +166,7 @@ public class CredentialsDAO extends ParentDAO {
     public void updateCredentials(String gatewayId, Credential credential, 
Connection connection)
             throws CredentialStoreException {
 
-        String sql = "UPDATE CREDENTIALS set CREDENTIAL = ?, PORTAL_USER_ID = 
?, TIME_PERSISTED = ?, DESCRIPTION = ? where GATEWAY_ID = ? and TOKEN_ID = ?";
+        String sql = "UPDATE CREDENTIALS set CREDENTIAL = ?, PORTAL_USER_ID = 
?, TIME_PERSISTED = ?, DESCRIPTION = ?, CREDENTIAL_OWNER_TYPE = ? where 
GATEWAY_ID = ? and TOKEN_ID = ?";
 
         PreparedStatement preparedStatement = null;
 
@@ -177,8 +180,9 @@ public class CredentialsDAO extends ParentDAO {
 
             preparedStatement.setTimestamp(3, new Timestamp(new 
java.util.Date().getTime()));
             preparedStatement.setString(4, credential.getDescription());
-            preparedStatement.setString(5, gatewayId);
-            preparedStatement.setString(6, credential.getToken());
+            preparedStatement.setString(5, 
credential.getCredentialOwnerType().toString());
+            preparedStatement.setString(6, gatewayId);
+            preparedStatement.setString(7, credential.getToken());
 
 
             preparedStatement.executeUpdate();
@@ -232,6 +236,7 @@ public class CredentialsDAO extends ParentDAO {
                 
certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
                 
certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
                 
certificateCredential.setDescription(resultSet.getString("DESCRIPTION"));
+                
certificateCredential.setCredentialOwnerType(CredentialOwnerType.valueOf(resultSet.getString("CREDENTIAL_OWNER_TYPE")));
 
                 return certificateCredential;
             }
@@ -320,6 +325,7 @@ public class CredentialsDAO extends ParentDAO {
                 
certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
                 
certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
                 
certificateCredential.setDescription(resultSet.getString("DESCRIPTION"));
+                
certificateCredential.setCredentialOwnerType(CredentialOwnerType.valueOf(resultSet.getString("CREDENTIAL_OWNER_TYPE")));
 
                 credentialList.add(certificateCredential);
             }
@@ -370,6 +376,7 @@ public class CredentialsDAO extends ParentDAO {
                 
certificateCredential.setPortalUserName(resultSet.getString("PORTAL_USER_ID"));
                 
certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("TIME_PERSISTED"));
                 
certificateCredential.setDescription(resultSet.getString("DESCRIPTION"));
+                
certificateCredential.setCredentialOwnerType(CredentialOwnerType.valueOf(resultSet.getString("CREDENTIAL_OWNER_TYPE")));
 
                 credentialList.add(certificateCredential);
             }

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
 
b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
index 0f6d493..63efb46 100644
--- 
a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
+++ 
b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
@@ -28,6 +28,7 @@ import org.apache.airavata.common.utils.DerbyUtil;
 import org.apache.airavata.common.utils.KeyStorePasswordCallback;
 import org.apache.airavata.credential.store.credential.CommunityUser;
 import org.apache.airavata.credential.store.credential.Credential;
+import org.apache.airavata.credential.store.credential.CredentialOwnerType;
 import 
org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
 import org.apache.airavata.credential.store.store.CredentialStoreException;
 import org.junit.AfterClass;
@@ -81,6 +82,7 @@ public class CredentialsDAOTest extends DatabaseTestCases {
                 "        CREDENTIAL BLOB NOT NULL,\n" + "        
PORTAL_USER_ID VARCHAR(256) NOT NULL,\n"
                 + "        TIME_PERSISTED TIMESTAMP DEFAULT 
CURRENT_TIMESTAMP,\n"
                 + "        DESCRIPTION VARCHAR(500),\n"
+                + "        CREDENTIAL_OWNER_TYPE VARCHAR(10) DEFAULT 'GATEWAY' 
NOT NULL,\n"
                 + "        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" + ")";
 
         String dropTable = "drop table CREDENTIALS";
@@ -196,6 +198,7 @@ public class CredentialsDAOTest extends DatabaseTestCases {
         certificateCredential.setPortalUserName("jerry");
         certificateCredential.setNotBefore("13 OCT 2012 5:34:23");
         certificateCredential.setNotAfter("14 OCT 2012 5:34:23");
+        
certificateCredential.setCredentialOwnerType(CredentialOwnerType.GATEWAY);
 
         return certificateCredential;
 
@@ -225,6 +228,7 @@ public class CredentialsDAOTest extends DatabaseTestCases {
         Assert.assertEquals(certificateCredential.getNotAfter(), 
readCertificateCredential.getNotAfter());
         Assert.assertEquals(certificateCredential.getNotBefore(), 
readCertificateCredential.getNotBefore());
         Assert.assertEquals(certificateCredential.getPortalUserName(), 
readCertificateCredential.getPortalUserName());
+        Assert.assertEquals(certificateCredential.getCredentialOwnerType(), 
readCertificateCredential.getCredentialOwnerType());
 
         PrivateKey newKey = readCertificateCredential.getPrivateKey();
 
@@ -266,6 +270,7 @@ public class CredentialsDAOTest extends DatabaseTestCases {
         Assert.assertEquals(certificateCredential.getNotAfter(), 
readCertificateCredential.getNotAfter());
         Assert.assertEquals(certificateCredential.getNotBefore(), 
readCertificateCredential.getNotBefore());
         Assert.assertEquals(certificateCredential.getPortalUserName(), 
readCertificateCredential.getPortalUserName());
+        Assert.assertEquals(certificateCredential.getCredentialOwnerType(), 
readCertificateCredential.getCredentialOwnerType());
 
         PrivateKey newKey = readCertificateCredential.getPrivateKey();
 
@@ -368,6 +373,7 @@ public class CredentialsDAOTest extends DatabaseTestCases {
             certificateCredential.setLifeTime(50);
             certificateCredential.setNotBefore("15 OCT 2012 5:34:23");
             certificateCredential.setNotAfter("16 OCT 2012 5:34:23");
+            
certificateCredential.setCredentialOwnerType(CredentialOwnerType.USER);
 
             credentialsDAO.updateCredentials(communityUser.getGatewayName(), 
certificateCredential, connection);
 
@@ -377,6 +383,7 @@ public class CredentialsDAOTest extends DatabaseTestCases {
                     
certificateCredential.getCertificates()[0].getIssuerDN().toString());
             // Assert.assertNotNull(certificateCredential.getPrivateKey());
             Assert.assertEquals("test2", 
certificateCredential.getPortalUserName());
+            Assert.assertEquals(CredentialOwnerType.USER, 
certificateCredential.getCredentialOwnerType());
 
         } finally {
             connection.close();

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/pom.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-stubs/pom.xml 
b/modules/credential-store/credential-store-stubs/pom.xml
index 97ade9d..5c9f92a 100644
--- a/modules/credential-store/credential-store-stubs/pom.xml
+++ b/modules/credential-store/credential-store-stubs/pom.xml
@@ -52,4 +52,28 @@
         
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     </properties>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>com.google.code.maven-replacer-plugin</groupId>
+                <artifactId>replacer</artifactId>
+                <version>${maven.replacer.plugin.version}</version>
+                <executions>
+                    <execution>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>replace</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <includes>
+                        
<include>${basedir}/src/main/java/org/apache/airavata/**/*.java</include>
+                    </includes>
+                    <token>, date = ".*"</token>
+                    <value> </value>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
index 4d2a456..1686c76 100644
--- 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/cpi/CredentialStoreService.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = 
"2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
 public class CredentialStoreService {
 
   public interface Iface {

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/APICredential.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/APICredential.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/APICredential.java
index b7a23d1..27347e9 100644
--- 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/APICredential.java
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/APICredential.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = 
"2015-12-21")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
 public class APICredential implements org.apache.thrift.TBase<APICredential, 
APICredential._Fields>, java.io.Serializable, Cloneable, 
Comparable<APICredential> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("APICredential");
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
index d2e5d85..989b277 100644
--- 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CertificateCredential.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = 
"2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
 public class CertificateCredential implements 
org.apache.thrift.TBase<CertificateCredential, CertificateCredential._Fields>, 
java.io.Serializable, Cloneable, Comparable<CertificateCredential> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("CertificateCredential");
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
index 9947b64..ac11739 100644
--- 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CommunityUser.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = 
"2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
 public class CommunityUser implements org.apache.thrift.TBase<CommunityUser, 
CommunityUser._Fields>, java.io.Serializable, Cloneable, 
Comparable<CommunityUser> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("CommunityUser");
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CredentialOwnerType.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CredentialOwnerType.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CredentialOwnerType.java
new file mode 100644
index 0000000..745f921
--- /dev/null
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/CredentialOwnerType.java
@@ -0,0 +1,61 @@
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.credential.store.datamodel;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum CredentialOwnerType implements org.apache.thrift.TEnum {
+  GATEWAY(0),
+  USER(1);
+
+  private final int value;
+
+  private CredentialOwnerType(int value) {
+    this.value = value;
+  }
+
+  /**
+   * Get the integer value of this enum value, as defined in the Thrift IDL.
+   */
+  public int getValue() {
+    return value;
+  }
+
+  /**
+   * Find a the enum type by its integer value, as defined in the Thrift IDL.
+   * @return null if the value is not found.
+   */
+  public static CredentialOwnerType findByValue(int value) { 
+    switch (value) {
+      case 0:
+        return GATEWAY;
+      case 1:
+        return USER;
+      default:
+        return null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
index 0e57752..44e1503 100644
--- 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/PasswordCredential.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = 
"2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
 public class PasswordCredential implements 
org.apache.thrift.TBase<PasswordCredential, PasswordCredential._Fields>, 
java.io.Serializable, Cloneable, Comparable<PasswordCredential> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("PasswordCredential");
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
index 47b585b..14fb1b1 100644
--- 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredential.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = 
"2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
 public class SSHCredential implements org.apache.thrift.TBase<SSHCredential, 
SSHCredential._Fields>, java.io.Serializable, Cloneable, 
Comparable<SSHCredential> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("SSHCredential");
 
@@ -62,6 +62,7 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
   private static final org.apache.thrift.protocol.TField 
PERSISTED_TIME_FIELD_DESC = new 
org.apache.thrift.protocol.TField("persistedTime", 
org.apache.thrift.protocol.TType.I64, (short)6);
   private static final org.apache.thrift.protocol.TField TOKEN_FIELD_DESC = 
new org.apache.thrift.protocol.TField("token", 
org.apache.thrift.protocol.TType.STRING, (short)7);
   private static final org.apache.thrift.protocol.TField 
DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("description", 
org.apache.thrift.protocol.TType.STRING, (short)8);
+  private static final org.apache.thrift.protocol.TField 
CREDENTIAL_OWNER_TYPE_FIELD_DESC = new 
org.apache.thrift.protocol.TField("credentialOwnerType", 
org.apache.thrift.protocol.TType.I32, (short)9);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = 
new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -77,6 +78,11 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
   public long persistedTime; // optional
   public String token; // optional
   public String description; // optional
+  /**
+   * 
+   * @see CredentialOwnerType
+   */
+  public CredentialOwnerType credentialOwnerType; // optional
 
   /** The set of fields this struct contains, along with convenience methods 
for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -87,7 +93,12 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
     PRIVATE_KEY((short)5, "privateKey"),
     PERSISTED_TIME((short)6, "persistedTime"),
     TOKEN((short)7, "token"),
-    DESCRIPTION((short)8, "description");
+    DESCRIPTION((short)8, "description"),
+    /**
+     * 
+     * @see CredentialOwnerType
+     */
+    CREDENTIAL_OWNER_TYPE((short)9, "credentialOwnerType");
 
     private static final Map<String, _Fields> byName = new HashMap<String, 
_Fields>();
 
@@ -118,6 +129,8 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
           return TOKEN;
         case 8: // DESCRIPTION
           return DESCRIPTION;
+        case 9: // CREDENTIAL_OWNER_TYPE
+          return CREDENTIAL_OWNER_TYPE;
         default:
           return null;
       }
@@ -160,7 +173,7 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
   // isset id assignments
   private static final int __PERSISTEDTIME_ISSET_ID = 0;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = 
{_Fields.PASSPHRASE,_Fields.PUBLIC_KEY,_Fields.PRIVATE_KEY,_Fields.PERSISTED_TIME,_Fields.TOKEN,_Fields.DESCRIPTION};
+  private static final _Fields optionals[] = 
{_Fields.PASSPHRASE,_Fields.PUBLIC_KEY,_Fields.PRIVATE_KEY,_Fields.PERSISTED_TIME,_Fields.TOKEN,_Fields.DESCRIPTION,_Fields.CREDENTIAL_OWNER_TYPE};
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> 
metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new 
EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -180,11 +193,15 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
         new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     tmpMap.put(_Fields.DESCRIPTION, new 
org.apache.thrift.meta_data.FieldMetaData("description", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.CREDENTIAL_OWNER_TYPE, new 
org.apache.thrift.meta_data.FieldMetaData("credentialOwnerType", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new 
org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, 
CredentialOwnerType.class)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SSHCredential.class,
 metaDataMap);
   }
 
   public SSHCredential() {
+    this.credentialOwnerType = 
org.apache.airavata.credential.store.datamodel.CredentialOwnerType.GATEWAY;
+
   }
 
   public SSHCredential(
@@ -223,6 +240,9 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
     if (other.isSetDescription()) {
       this.description = other.description;
     }
+    if (other.isSetCredentialOwnerType()) {
+      this.credentialOwnerType = other.credentialOwnerType;
+    }
   }
 
   public SSHCredential deepCopy() {
@@ -240,6 +260,8 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
     this.persistedTime = 0;
     this.token = null;
     this.description = null;
+    this.credentialOwnerType = 
org.apache.airavata.credential.store.datamodel.CredentialOwnerType.GATEWAY;
+
   }
 
   public String getGatewayId() {
@@ -433,6 +455,38 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
     }
   }
 
+  /**
+   * 
+   * @see CredentialOwnerType
+   */
+  public CredentialOwnerType getCredentialOwnerType() {
+    return this.credentialOwnerType;
+  }
+
+  /**
+   * 
+   * @see CredentialOwnerType
+   */
+  public SSHCredential setCredentialOwnerType(CredentialOwnerType 
credentialOwnerType) {
+    this.credentialOwnerType = credentialOwnerType;
+    return this;
+  }
+
+  public void unsetCredentialOwnerType() {
+    this.credentialOwnerType = null;
+  }
+
+  /** Returns true if field credentialOwnerType is set (has been assigned a 
value) and false otherwise */
+  public boolean isSetCredentialOwnerType() {
+    return this.credentialOwnerType != null;
+  }
+
+  public void setCredentialOwnerTypeIsSet(boolean value) {
+    if (!value) {
+      this.credentialOwnerType = null;
+    }
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case GATEWAY_ID:
@@ -499,6 +553,14 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
       }
       break;
 
+    case CREDENTIAL_OWNER_TYPE:
+      if (value == null) {
+        unsetCredentialOwnerType();
+      } else {
+        setCredentialOwnerType((CredentialOwnerType)value);
+      }
+      break;
+
     }
   }
 
@@ -528,6 +590,9 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
     case DESCRIPTION:
       return getDescription();
 
+    case CREDENTIAL_OWNER_TYPE:
+      return getCredentialOwnerType();
+
     }
     throw new IllegalStateException();
   }
@@ -555,6 +620,8 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
       return isSetToken();
     case DESCRIPTION:
       return isSetDescription();
+    case CREDENTIAL_OWNER_TYPE:
+      return isSetCredentialOwnerType();
     }
     throw new IllegalStateException();
   }
@@ -644,6 +711,15 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
         return false;
     }
 
+    boolean this_present_credentialOwnerType = true && 
this.isSetCredentialOwnerType();
+    boolean that_present_credentialOwnerType = true && 
that.isSetCredentialOwnerType();
+    if (this_present_credentialOwnerType || that_present_credentialOwnerType) {
+      if (!(this_present_credentialOwnerType && 
that_present_credentialOwnerType))
+        return false;
+      if (!this.credentialOwnerType.equals(that.credentialOwnerType))
+        return false;
+    }
+
     return true;
   }
 
@@ -691,6 +767,11 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
     if (present_description)
       list.add(description);
 
+    boolean present_credentialOwnerType = true && (isSetCredentialOwnerType());
+    list.add(present_credentialOwnerType);
+    if (present_credentialOwnerType)
+      list.add(credentialOwnerType.getValue());
+
     return list.hashCode();
   }
 
@@ -782,6 +863,16 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
         return lastComparison;
       }
     }
+    lastComparison = 
Boolean.valueOf(isSetCredentialOwnerType()).compareTo(other.isSetCredentialOwnerType());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCredentialOwnerType()) {
+      lastComparison = 
org.apache.thrift.TBaseHelper.compareTo(this.credentialOwnerType, 
other.credentialOwnerType);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -873,6 +964,16 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
       }
       first = false;
     }
+    if (isSetCredentialOwnerType()) {
+      if (!first) sb.append(", ");
+      sb.append("credentialOwnerType:");
+      if (this.credentialOwnerType == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.credentialOwnerType);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -988,6 +1089,14 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
             }
             break;
+          case 9: // CREDENTIAL_OWNER_TYPE
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.credentialOwnerType = 
org.apache.airavata.credential.store.datamodel.CredentialOwnerType.findByValue(iprot.readI32());
+              struct.setCredentialOwnerTypeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
         }
@@ -1053,6 +1162,13 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
           oprot.writeFieldEnd();
         }
       }
+      if (struct.credentialOwnerType != null) {
+        if (struct.isSetCredentialOwnerType()) {
+          oprot.writeFieldBegin(CREDENTIAL_OWNER_TYPE_FIELD_DESC);
+          oprot.writeI32(struct.credentialOwnerType.getValue());
+          oprot.writeFieldEnd();
+        }
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -1091,7 +1207,10 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
       if (struct.isSetDescription()) {
         optionals.set(5);
       }
-      oprot.writeBitSet(optionals, 6);
+      if (struct.isSetCredentialOwnerType()) {
+        optionals.set(6);
+      }
+      oprot.writeBitSet(optionals, 7);
       if (struct.isSetPassphrase()) {
         oprot.writeString(struct.passphrase);
       }
@@ -1110,6 +1229,9 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
       if (struct.isSetDescription()) {
         oprot.writeString(struct.description);
       }
+      if (struct.isSetCredentialOwnerType()) {
+        oprot.writeI32(struct.credentialOwnerType.getValue());
+      }
     }
 
     @Override
@@ -1119,7 +1241,7 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
       struct.setGatewayIdIsSet(true);
       struct.username = iprot.readString();
       struct.setUsernameIsSet(true);
-      BitSet incoming = iprot.readBitSet(6);
+      BitSet incoming = iprot.readBitSet(7);
       if (incoming.get(0)) {
         struct.passphrase = iprot.readString();
         struct.setPassphraseIsSet(true);
@@ -1144,6 +1266,10 @@ public class SSHCredential implements 
org.apache.thrift.TBase<SSHCredential, SSH
         struct.description = iprot.readString();
         struct.setDescriptionIsSet(true);
       }
+      if (incoming.get(6)) {
+        struct.credentialOwnerType = 
org.apache.airavata.credential.store.datamodel.CredentialOwnerType.findByValue(iprot.readI32());
+        struct.setCredentialOwnerTypeIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
index a646a94..49fc100 100644
--- 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel/SSHCredentialSummary.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = 
"2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
 public class SSHCredentialSummary implements 
org.apache.thrift.TBase<SSHCredentialSummary, SSHCredentialSummary._Fields>, 
java.io.Serializable, Cloneable, Comparable<SSHCredentialSummary> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("SSHCredentialSummary");
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
index ce445ac..5a1c748 100644
--- 
a/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
+++ 
b/modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/exception/CredentialStoreException.java
@@ -50,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = 
"2016-11-08")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)")
 public class CredentialStoreException extends TException implements 
org.apache.thrift.TBase<CredentialStoreException, 
CredentialStoreException._Fields>, java.io.Serializable, Cloneable, 
Comparable<CredentialStoreException> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("CredentialStoreException");
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/registry/registry-core/src/main/resources/credstore-derby.sql
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/resources/credstore-derby.sql 
b/modules/registry/registry-core/src/main/resources/credstore-derby.sql
index f600f24..7ccc001 100644
--- a/modules/registry/registry-core/src/main/resources/credstore-derby.sql
+++ b/modules/registry/registry-core/src/main/resources/credstore-derby.sql
@@ -12,6 +12,8 @@ CREATE TABLE CREDENTIALS (
   CREDENTIAL     BLOB         NOT NULL,
   PORTAL_USER_ID VARCHAR(256) NOT NULL,
   TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+  DESCRIPTION VARCHAR(500),
+  CREDENTIAL_OWNER_TYPE VARCHAR(10) DEFAULT 'GATEWAY' NOT NULL,
   PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
 );
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/modules/registry/registry-core/src/main/resources/credstore-mysql.sql
----------------------------------------------------------------------
diff --git 
a/modules/registry/registry-core/src/main/resources/credstore-mysql.sql 
b/modules/registry/registry-core/src/main/resources/credstore-mysql.sql
index a0cf815..a6c9144 100644
--- a/modules/registry/registry-core/src/main/resources/credstore-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/credstore-mysql.sql
@@ -12,6 +12,8 @@ CREATE TABLE CREDENTIALS (
   CREDENTIAL     BLOB         NOT NULL,
   PORTAL_USER_ID VARCHAR(256) NOT NULL,
   TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+  DESCRIPTION VARCHAR(500),
+  CREDENTIAL_OWNER_TYPE VARCHAR(10) DEFAULT 'GATEWAY' NOT NULL,
   PRIMARY KEY (GATEWAY_ID, TOKEN_ID)
 );
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift 
b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
index 9a07df0..36b6fda 100644
--- a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
+++ b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
@@ -27,6 +27,7 @@
 include "airavata_errors.thrift"
 include "security_model.thrift"
 include "../data-models/airavata_data_models.thrift"
+include 
"../data-models/credential-store-models/credential_store_data_models.thrift"
 include "../data-models/experiment-catalog-models/status_models.thrift"
 include "../data-models/experiment-catalog-models/job_model.thrift"
 include "../data-models/experiment-catalog-models/experiment_model.thrift"
@@ -266,6 +267,12 @@ service Airavata {
    *    The User for which the credential should be registered. For community 
accounts, this user is the name of the
    *    community user name. For computational resources, this user name need 
not be the same user name on resoruces.
    *
+   * @param description
+   *    The description field for a credential type, all type of credential 
can have a description.
+   *
+   * @param credentialOwnerType
+   *    The type of owner of this credential. Two possible values: GATEWAY 
(default) and USER
+   *
    * @return airavataCredStoreToken
    *   An SSH Key pair is generated and stored in the credential store and 
associated with users or community account
    *   belonging to a Gateway.
@@ -273,38 +280,13 @@ service Airavata {
    **/
    string generateAndRegisterSSHKeys (1: required security_model.AuthzToken 
authzToken,
                     2: required string gatewayId,
-                    3: required string userName)
+                    3: required string userName,
+                    4: string description,
+                    5: credential_store_data_models.CredentialOwnerType 
credentialOwnerType)
            throws (1: airavata_errors.InvalidRequestException ire,
                    2: airavata_errors.AiravataClientException ace,
                    3: airavata_errors.AiravataSystemException ase)
 
-  /**
-     * Generate and Register SSH Key Pair with Airavata Credential Store.
-     *
-     * @param gatewayId
-     *    The identifier for the requested Gateway.
-     *
-     * @param userName
-     *    The User for which the credential should be registered. For 
community accounts, this user is the name of the
-     *    community user name. For computational resources, this user name 
need not be the same user name on resoruces.
-     *
-     * @param description
-     *    The description field for a credential type, all type of credential 
can have a description.
-     *
-     * @return airavataCredStoreToken
-     *   An SSH Key pair is generated and stored in the credential store and 
associated with users or community account
-     *   belonging to a Gateway.
-     *
-     **/
-     string generateAndRegisterSSHKeysWithDescription (1: required 
security_model.AuthzToken authzToken,
-                      2: required string gatewayId,
-                      3: required string userName,
-                      4: required string description)
-             throws (1: airavata_errors.InvalidRequestException ire,
-                     2: airavata_errors.AiravataClientException ace,
-                     3: airavata_errors.AiravataSystemException ase)
-
-
  /**
    * Generate and Register Username PWD Pair with Airavata Credential Store.
    *

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/thrift-interface-descriptions/data-models/credential-store-models/credential_store_data_models.thrift
----------------------------------------------------------------------
diff --git 
a/thrift-interface-descriptions/data-models/credential-store-models/credential_store_data_models.thrift
 
b/thrift-interface-descriptions/data-models/credential-store-models/credential_store_data_models.thrift
index f2c2c77..d69c18e 100644
--- 
a/thrift-interface-descriptions/data-models/credential-store-models/credential_store_data_models.thrift
+++ 
b/thrift-interface-descriptions/data-models/credential-store-models/credential_store_data_models.thrift
@@ -24,6 +24,11 @@ namespace php Airavata.Model.Credential.Store
 
 const string DEFAULT_ID = "DO_NOT_SET_AT_CLIENTS"
 
+enum CredentialOwnerType {
+    GATEWAY,
+    USER
+}
+
 struct SSHCredential {
     1: required string gatewayId,
     2: required string username,
@@ -32,7 +37,8 @@ struct SSHCredential {
     5: optional string privateKey,
     6: optional i64 persistedTime,
     7: optional string token,
-    8: optional string description
+    8: optional string description,
+    9: optional CredentialOwnerType credentialOwnerType = 
CredentialOwnerType.GATEWAY
 }
 
 struct SSHCredentialSummary {

http://git-wip-us.apache.org/repos/asf/airavata/blob/2e05c239/thrift-interface-descriptions/generate-thrift-stubs.sh
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/generate-thrift-stubs.sh 
b/thrift-interface-descriptions/generate-thrift-stubs.sh
index 949ce2e..4a9550a 100755
--- a/thrift-interface-descriptions/generate-thrift-stubs.sh
+++ b/thrift-interface-descriptions/generate-thrift-stubs.sh
@@ -69,14 +69,12 @@ 
DATAMODEL_THRIFT_FILE='data-models/airavata_data_models.thrift'
 
APP_CATALOG_THRIFT_FILE='data-models/app-catalog-models/app_catalog_models.thrift'
 
RESOURCE_CATALOG_THRIFT_FILE='data-models/resource-catalog-models/resource_catalog_models.thrift'
 WORKFLOW_THRIFT_FILE='data-models/workflow-models/workflow_data_model.thrift'
-CREDENTIAL_STORE_DATAMODEL_THRIFT_FILE='data-models/credential-store-models/credential_store_data_models.thrift'
 
 DATAMODEL_SRC_DIR='../airavata-api/airavata-data-models/src/main/java'
 JAVA_API_SDK_DIR='../airavata-api/airavata-api-stubs/src/main/java'
 
PHP_SDK_DIR='../airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib'
 
CPP_SDK_DIR='../airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/'
 
PYTHON_SDK_DIR='../airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/'
-CREDENTIAL_DATAMODEL_SRC_DIR='../modules/credential-store/credential-store-stubs/src/main/java/org/apache/airavata/credential/store/datamodel'
 
 # Initialize the thrift arguments.
 #  Since most of the Airavata API and Data Models have includes, use recursive 
option by default.
@@ -186,27 +184,6 @@ generate_java_stubs() {
     # As a precaution  remove and previously generated files if exists
     rm -rf ${JAVA_GEN_DIR}
 
-    # Generate the credential store data models in move them to respective 
modules/credential-store directory
-
-     $THRIFT_EXEC ${THRIFT_ARGS} --gen java:beans 
${CREDENTIAL_STORE_DATAMODEL_THRIFT_FILE} || fail unable to generate java bean 
thrift classes on app workflow data models
-
-    # For the generated java beans add the ASF V2 License header
-    add_license_header $JAVA_BEAN_GEN_DIR
-
-    # Compare the newly generated beans with existing sources and replace the 
changed ones.
-    copy_changed_files 
${JAVA_BEAN_GEN_DIR}/org/apache/airavata/credential/store/datamodel} 
${CREDENTIAL_DATAMODEL_SRC_DIR}
-
-    
###############################################################################
-    # Generate/Update source used by Airavata Server Skeletons & Java Client 
Stubs #
-    #  JAVA server and client both use generated api-boilerplate-code          
   #
-    
###############################################################################
-
-    #Java generation directory
-    JAVA_GEN_DIR=${BASE_TARGET_DIR}/gen-java
-
-    # As a precaution  remove and previously generated files if exists
-    rm -rf ${JAVA_GEN_DIR}
-
     # Using thrift Java generator, generate the java classes based on Airavata 
API. This
     #   The airavata_api.thrift includes rest of data models.
     $THRIFT_EXEC ${THRIFT_ARGS} --gen java ${AIRAVATA_API_THRIFT_FILE} || fail 
unable to generate java thrift classes on AiravataAPI
@@ -239,7 +216,6 @@ generate_php_stubs() {
     $THRIFT_EXEC ${THRIFT_ARGS} --gen php:autoload ${APP_CATALOG_THRIFT_FILE}  
|| fail unable to generate PHP thrift classes
     $THRIFT_EXEC ${THRIFT_ARGS} --gen php:autoload 
${RESOURCE_CATALOG_THRIFT_FILE}   || fail unable to generate PHP thrift classes
     $THRIFT_EXEC ${THRIFT_ARGS} --gen php:autoload ${AIRAVATA_API_THRIFT_FILE} 
|| fail unable to generate PHP thrift classes
-    $THRIFT_EXEC ${THRIFT_ARGS} --gen php:autoload 
${CREDENTIAL_STORE_DATAMODEL_THRIFT_FILE} || fail unable to generate PHP thrift 
classes
 
     # For the generated java classes add the ASF V2 License header
     ## TODO Write PHP license parser

Reply via email to