Merge branch 'set-CAINFO-everywhere' into develop
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index f9ea073..2e494e3 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -180,6 +180,13 @@
 
     }
 
+    public function apiLoginSubmit() {
+        $username = strtolower(Input::get("username"));
+        $password = Input::get("password");
+        $response = Keycloak::authenticate($username, $password);
+        return Response::json($response);
+    }
+
     public function oauthCallback()
     {
         if (!isset($_GET["code"])) {
@@ -294,12 +301,25 @@
             umask($old_umask);
         }
 
+        // Must create the UserResourceProfile before we can add auto provisioned accounts to it
+        $user_resource_profile = URPUtilities::get_or_create_user_resource_profile();
+        $auto_provisioned_accounts = URPUtilities::setup_auto_provisioned_accounts();
+        // Log::debug("auto_provisioned_accounts", array($auto_provisioned_accounts));
+
         if(Session::has("admin") || Session::has("admin-read-only") || Session::has("gateway-provider")){
-            return Redirect::to("admin/dashboard". "?status=ok&code=".$accessToken . "&username=".$username
+            $response = Redirect::to("admin/dashboard". "?status=ok&code=".$accessToken . "&username=".$username
                 . "&refresh_code=" . $refreshToken . "&valid_time=" . $validTime);
+            if (!empty($auto_provisioned_accounts)) {
+                $response = $response->with("auto_provisioned_accounts", $auto_provisioned_accounts);
+            }
+            return $response;
         }else{
-            return Redirect::to("account/dashboard". "?status=ok&code=".$accessToken ."&username=".$username
+            $response = Redirect::to("account/dashboard". "?status=ok&code=".$accessToken ."&username=".$username
                 . "&refresh_code=" . $refreshToken . "&valid_time=" . $validTime);
+            if (!empty($auto_provisioned_accounts)) {
+                $response = $response->with("auto_provisioned_accounts", $auto_provisioned_accounts);
+            }
+            return $response;
         }
     }
 
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 28eb9a5..6c11dfb 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -173,6 +173,30 @@
 
 	public function updateGateway(){
 
+        $rules = array(
+            "password" => "min:6|max:48|regex:/^.*(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@!$#*]).*$/",
+            "confirm_password" => "same:password",
+            "email" => "email",
+        );
+        $messages = array(
+            'password.regex' => 'Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$&*',
+        );
+		$inputs = Input::all();
+        $checkValidation = array();
+        $checkValidation["password"] = $inputs["gatewayAdminPassword"];
+        $checkValidation["confirm_password"] = $inputs["gatewayAdminPasswordConfirm"];
+        $checkValidation["email"] = $inputs["gatewayAdminEmail"];
+
+        $validator = Validator::make( $checkValidation, $rules, $messages);
+        if ($validator->fails()) {
+            if(Request::ajax()){
+                return json_encode(array("errors" => true, "validationMessages" => $validator->messages()));
+            } else {
+                Session::put("message", "An error has occurred while updating the Gateway: " + $validator->messages());
+                return Redirect::back();
+            }
+        }
+
 	    $gateway = TenantProfileService::getGateway( Session::get('authz-token'), Input::get("internal_gateway_id"));
 		$returnVal = AdminUtilities::update_gateway( Input::get("internal_gateway_id"), Input::except("oauthClientId","oauthClientSecret"));
 		if( Request::ajax()){
@@ -184,10 +208,10 @@
                     Session::put("successMessages", "Tenant has been created successfully!");
                 else
                     Session::put("successMessages", "Gateway has been updated successfully!");
-                return json_encode(AdminUtilities::get_gateway(Input::get("internal_gateway_id")));
+                return json_encode(array("errors" => false, "gateway" => AdminUtilities::get_gateway(Input::get("internal_gateway_id"))));
             }
 			else {
-                return $returnVal; // anything other than positive update result
+                return json_encode(array("errors" => true)); // anything other than positive update result
             }
 		}
 		else{
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index 131fa1d..dadfb29 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -318,7 +318,7 @@
 
         $computeResources = CRUtilities::create_compute_resources_select($experiment->executionId, $expVal['scheduling']->resourceHostId);
 
-        $userComputeResourcePreferences = URPUtilities::get_all_user_compute_resource_prefs();
+        $userComputeResourcePreferences = URPUtilities::get_all_validated_user_compute_resource_prefs();
         $userHasComputeResourcePreference = array_key_exists($expVal['scheduling']->resourceHostId, $userComputeResourcePreferences);
 
         $experimentInputs = array(
@@ -459,7 +459,7 @@
         );
 
         $queues = ExperimentUtilities::getQueueDatafromResourceId($computeResourceId);
-        $userComputeResourcePreferences = URPUtilities::get_all_user_compute_resource_prefs();
+        $userComputeResourcePreferences = URPUtilities::get_all_validated_user_compute_resource_prefs();
         $userHasComputeResourcePreference = array_key_exists($computeResourceId, $userComputeResourcePreferences);
         if ($userHasComputeResourcePreference)
         {
diff --git a/app/controllers/GatewayRequestUpdateController.php b/app/controllers/GatewayRequestUpdateController.php
index 2ff33a5..f75019e 100644
--- a/app/controllers/GatewayRequestUpdateController.php
+++ b/app/controllers/GatewayRequestUpdateController.php
@@ -27,26 +27,18 @@
 
         $inputs = Input::all();
         $rules = array(
-            "password" => "required|min:6|max:48|regex:/^.*(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@!$#*]).*$/",
-            "confirm_password" => "required|same:password",
             "email" => "required|email",
         );
 
-        $messages = array(
-            'password.regex' => 'Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$&*',
-        );
+        $messages = array();
 
         $checkValidation = array();
-        $checkValidation["password"] = $inputs["admin-password"];
-        $checkValidation["confirm_password"] = $inputs["admin-password-confirm"];
-        $checkValidation["email"] = $inputs["admin-email"];
+        $checkValidation["email"] = $inputs["email-address"];
 
         $validator = Validator::make( $checkValidation, $rules, $messages);
         if ($validator->fails()) {
             Session::put("validationMessages", $validator->messages() );
-            return Redirect::back()
-                ->withInput(Input::except('password', 'password_confirm'))
-                ->withErrors($validator);
+            return Redirect::back()->withErrors($validator);
         }
         else {
             $returnVal = AdminUtilities::user_update_gateway(Input::get("internal-gateway-id"), Input::all());
diff --git a/app/controllers/UserSettingsController.php b/app/controllers/UserSettingsController.php
index d73e874..ef17e17 100644
--- a/app/controllers/UserSettingsController.php
+++ b/app/controllers/UserSettingsController.php
@@ -17,7 +17,7 @@
         $userCredentialSummaries = URPUtilities::get_all_ssh_pub_keys_summary_for_user();
         $defaultCredentialToken = $userResourceProfile->credentialStoreToken;
         foreach ($userCredentialSummaries as $credentialSummary) {
-            $credentialSummary->canDelete = ($credentialSummary->token != $defaultCredentialToken);
+            $credentialSummary->canDelete = $this->canDeleteCredential($credentialSummary->token, $userResourceProfile);
         }
 
         return View::make("account/credential-store", array(
@@ -27,6 +27,26 @@
         ));
     }
 
+    // Don't allow deleting credential if default credential or in use by a
+    // userComputeResourcePreference or a userStoragePreference
+    private function canDeleteCredential($token, $userResourceProfile) {
+        if ($token == $userResourceProfile->credentialStoreToken) {
+            return false;
+        } else {
+            foreach ($userResourceProfile->userComputeResourcePreferences as $userCompResPref) {
+                if ($userCompResPref->resourceSpecificCredentialStoreToken == $token) {
+                    return false;
+                }
+            }
+            foreach ($userResourceProfile->userStoragePreferences as $userStoragePreference) {
+                if ($userStoragePreference->resourceSpecificCredentialStoreToken == $token) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
     public function setDefaultCredential() {
 
         $defaultToken = Input::get("defaultToken");
@@ -82,6 +102,12 @@
     public function getComputeResources(){
 
         $userResourceProfile = URPUtilities::get_or_create_user_resource_profile();
+        $gatewayResourceProfile = CRUtilities::getGatewayResourceProfile();
+        $computeResourcePreferences = $gatewayResourceProfile->computeResourcePreferences;
+        $computeResourcePreferencesById = array();
+        foreach ($computeResourcePreferences as $computeResourcePreference) {
+            $computeResourcePreferencesById[$computeResourcePreference->computeResourceId] = $computeResourcePreference;
+        }
 
         $allCRs = CRUtilities::getAllCRObjects();
         foreach( $allCRs as $index => $crObject)
@@ -91,6 +117,12 @@
         // Add crDetails to each UserComputeResourcePreference
         foreach ($userResourceProfile->userComputeResourcePreferences as $index => $userCompResPref) {
             $userCompResPref->crDetails = $allCRsById[$userCompResPref->computeResourceId];
+            // Disallow editing a UserComputeResourcePreference that was automatically setup by an sshAccountProvisioner
+            $userCompResPref->editable = true;
+            if (array_key_exists($userCompResPref->computeResourceId, $computeResourcePreferencesById)) {
+                $computeResourcePreference = $computeResourcePreferencesById[$userCompResPref->computeResourceId];
+                $userCompResPref->editable = $computeResourcePreference->sshAccountProvisioner == null;
+            }
             // To figure out the unselectedCRs, remove this compute resource from allCRsById
             unset($allCRsById[$userCompResPref->computeResourceId]);
         }
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index 7f17408..b66ab4c 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -127,16 +127,6 @@
         $gateway->gatewayApprovalStatus = GatewayApprovalStatus::APPROVED;
         $gateway->emailAddress = $gatewayData["email-address"];
         $gateway->gatewayURL = $gatewayData["gateway-url"];
-        $gateway->identityServerUserName = $gatewayData["admin-username"];
-        $token = AdminUtilities::create_pwd_token([
-            "username" => $gatewayData["admin-username"],
-            "password" => $gatewayData["admin-password"],
-            "description" => "Admin user password for Gateway " . $gatewayId
-        ]);
-        $gateway->identityServerPasswordToken  = $token;
-        $gateway->gatewayAdminFirstName = $gatewayData["admin-firstname"];
-        $gateway->gatewayAdminLastName = $gatewayData["admin-lastname"];
-        $gateway->gatewayAdminEmail = $gatewayData["admin-email"];
         $gateway->reviewProposalDescription = $gatewayData["project-details"];
         $gateway->gatewayPublicAbstract = $gatewayData["public-project-description"];
         if( TenantProfileService::updateGateway( Session::get('authz-token'), $gateway) ){
@@ -163,10 +153,15 @@
             $gatewayData["declinedReason"] = " ";
             if ($gateway->identityServerPasswordToken == null)
             {
-                Session::put("errorMessages", "Error: Please ask the Gateway Provider to submit a password.");
+                Session::flash("errorMessages", "Error: Please provide an admin password.");
                 return -1;
             }
-            foreach ($gatewayData as $data) {
+            foreach ($gatewayData as $key => $data) {
+                // Don't check these fields, see related check above
+                // where we make sure that password is provided
+                if ($key == "gatewayAdminPassword" || $key == "gatewayAdminPasswordConfirm") {
+                    continue;
+                }
                 if ($data == null) {
                     return -1;
                 }
@@ -181,6 +176,14 @@
             $gateway->gatewayAdminLastName = $gatewayData["gatewayAdminLastName"];
             $gateway->gatewayAdminEmail = $gatewayData["gatewayAdminEmail"];
             $gateway->identityServerUserName = $gatewayData["identityServerUserName"];
+            if (!empty($gatewayData["gatewayAdminPassword"])) {
+                $token = AdminUtilities::create_pwd_token([
+                    "username" => $gatewayData["identityServerUserName"],
+                    "password" => $gatewayData["gatewayAdminPassword"],
+                    "description" => "Admin user password for Gateway " . $gateway->gatewayName
+                ]);
+                $gateway->identityServerPasswordToken = $token;
+            }
             $gateway->reviewProposalDescription = $gatewayData["reviewProposalDescription"];
             $gateway->gatewayPublicAbstract = $gatewayData["gatewayPublicAbstract"];
             $gateway->gatewayApprovalStatus = GatewayApprovalStatus::APPROVED;
@@ -195,6 +198,14 @@
             $gateway->gatewayAdminLastName = $gatewayData["gatewayAdminLastName"];
             $gateway->gatewayAdminEmail = $gatewayData["gatewayAdminEmail"];
             $gateway->identityServerUserName = $gatewayData["identityServerUserName"];
+            if (!empty($gatewayData["gatewayAdminPassword"])) {
+                $token = AdminUtilities::create_pwd_token([
+                    "username" => $gatewayData["identityServerUserName"],
+                    "password" => $gatewayData["gatewayAdminPassword"],
+                    "description" => "Admin user password for Gateway " . $gateway->gatewayName
+                ]);
+                $gateway->identityServerPasswordToken = $token;
+            }
             $gateway->reviewProposalDescription = $gatewayData["reviewProposalDescription"];
             $gateway->gatewayPublicAbstract = $gatewayData["gatewayPublicAbstract"];
             $gateway->gatewayApprovalStatus = GatewayApprovalStatus::APPROVED;
diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php
index ae27035..a22ef84 100644
--- a/app/libraries/Airavata/API/Airavata.php
+++ b/app/libraries/Airavata/API/Airavata.php
@@ -3428,6 +3428,76 @@
    */
   public function deleteGatewayStoragePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $storageId);
   /**
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @return \Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisioner[]
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function getSSHAccountProvisioners(\Airavata\Model\Security\AuthzToken $authzToken);
+  /**
+   * Check if user has an SSH account on the given compute resource. This
+   * method will only work if the compute resource has an SSHAccountProvisioner configured for it.
+   * 
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $computeResourceId
+   * @param string $userId
+   * @return bool
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function doesUserHaveSSHAccount(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId);
+  /**
+   * Setup and return a UserComputeResourcePreference object for this user to SSH into the given compute resource with
+   * the given SSH credential. This method will only work if the compute resource has an SSHAccountProvisioner
+   * configured for it. The returned UserComputeResourcePreference object is not saved; it is up to the client to
+   * call addUserComputeResourcePreference to persist it.
+   * 
+   * @param \Airavata\Model\Security\AuthzToken $authzToken
+   * @param string $computeResourceId
+   * @param string $userId
+   * @param string $airavataCredStoreToken
+   * @return \Airavata\Model\AppCatalog\UserResourceProfile\UserComputeResourcePreference User specific preferences for a Computer Resource
+   * 
+   * computeResourceId:
+   *   Corelate the preference to a compute resource.
+   * 
+   * 
+   * loginUserName:
+   *   If turned true, Airavata will override the preferences of better alternatives exist.
+   * 
+   * 
+   * preferredBatchQueue:
+   *  Gateways can choose a defualt batch queue based on average job dimention, reservations or other metrics.
+   * 
+   * scratchLocation:
+   *  Path to the local scratch space on a HPC cluster. Typically used to create working directory for job execution.
+   * 
+   * allocationProjectNumber:
+   *  Typically used on HPC machines to charge computing usage to a account number. For instance, on XSEDE once an
+   *    allocation is approved, an allocation number is assigned. Before passing this number with job submittions, the
+   *    account to be used has to be added to the allocation.
+   * 
+   * resourceSpecificCredentialStoreToken:
+   *  Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's
+   *   default credential store.
+   * 
+   * validated:
+   *  If true the the configuration has been validated in the sense that the username and credential can be used to
+   *  login to the remote host and the scratchLocation is a valid location that the user has permission to write to.
+   *  Should be treated as read-only and only mutated by Airavata middleware.
+   * 
+   * 
+   * @throws \Airavata\API\Error\InvalidRequestException
+   * @throws \Airavata\API\Error\AiravataClientException
+   * @throws \Airavata\API\Error\AiravataSystemException
+   * @throws \Airavata\API\Error\AuthorizationException
+   */
+  public function setupUserComputeResourcePreferencesForSSH(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId, $airavataCredStoreToken);
+  /**
    * Register User Resource Profile.
    * 
    * @param UserResourceProfile
@@ -3652,6 +3722,11 @@
    *  Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's
    *   default credential store.
    * 
+   * validated:
+   *  If true the the configuration has been validated in the sense that the username and credential can be used to
+   *  login to the remote host and the scratchLocation is a valid location that the user has permission to write to.
+   *  Should be treated as read-only and only mutated by Airavata middleware.
+   * 
    * 
    * @throws \Airavata\API\Error\InvalidRequestException
    * @throws \Airavata\API\Error\AiravataClientException
@@ -4045,7 +4120,7 @@
   /**
    * @param \Airavata\Model\Security\AuthzToken $authzToken
    * @param \Airavata\Model\Group\GroupModel $groupModel
-   * @return bool
+   * @return string
    * @throws \Airavata\API\Error\InvalidRequestException
    * @throws \Airavata\API\Error\AiravataClientException
    * @throws \Airavata\API\Error\AiravataSystemException
@@ -4066,14 +4141,13 @@
    * @param \Airavata\Model\Security\AuthzToken $authzToken
    * @param string $groupId
    * @param string $ownerId
-   * @param string $gatewayId
    * @return bool
    * @throws \Airavata\API\Error\InvalidRequestException
    * @throws \Airavata\API\Error\AiravataClientException
    * @throws \Airavata\API\Error\AiravataSystemException
    * @throws \Airavata\API\Error\AuthorizationException
    */
-  public function deleteGroup(\Airavata\Model\Security\AuthzToken $authzToken, $groupId, $ownerId, $gatewayId);
+  public function deleteGroup(\Airavata\Model\Security\AuthzToken $authzToken, $groupId, $ownerId);
   /**
    * @param \Airavata\Model\Security\AuthzToken $authzToken
    * @param string $groupId
@@ -4087,14 +4161,13 @@
   /**
    * @param \Airavata\Model\Security\AuthzToken $authzToken
    * @param string $userName
-   * @param string $gatewayId
    * @return \Airavata\Model\Group\GroupModel[]
    * @throws \Airavata\API\Error\InvalidRequestException
    * @throws \Airavata\API\Error\AiravataClientException
    * @throws \Airavata\API\Error\AiravataSystemException
    * @throws \Airavata\API\Error\AuthorizationException
    */
-  public function getAllGroupsUserBelongs(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId);
+  public function getAllGroupsUserBelongs(\Airavata\Model\Security\AuthzToken $authzToken, $userName);
 }
 
 class AiravataClient implements \Airavata\API\AiravataIf {
@@ -12722,6 +12795,200 @@
     throw new \Exception("deleteGatewayStoragePreference failed: unknown result");
   }
 
+  public function getSSHAccountProvisioners(\Airavata\Model\Security\AuthzToken $authzToken)
+  {
+    $this->send_getSSHAccountProvisioners($authzToken);
+    return $this->recv_getSSHAccountProvisioners();
+  }
+
+  public function send_getSSHAccountProvisioners(\Airavata\Model\Security\AuthzToken $authzToken)
+  {
+    $args = new \Airavata\API\Airavata_getSSHAccountProvisioners_args();
+    $args->authzToken = $authzToken;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'getSSHAccountProvisioners', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('getSSHAccountProvisioners', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_getSSHAccountProvisioners()
+  {
+    $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_getSSHAccountProvisioners_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_getSSHAccountProvisioners_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;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("getSSHAccountProvisioners failed: unknown result");
+  }
+
+  public function doesUserHaveSSHAccount(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId)
+  {
+    $this->send_doesUserHaveSSHAccount($authzToken, $computeResourceId, $userId);
+    return $this->recv_doesUserHaveSSHAccount();
+  }
+
+  public function send_doesUserHaveSSHAccount(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId)
+  {
+    $args = new \Airavata\API\Airavata_doesUserHaveSSHAccount_args();
+    $args->authzToken = $authzToken;
+    $args->computeResourceId = $computeResourceId;
+    $args->userId = $userId;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'doesUserHaveSSHAccount', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('doesUserHaveSSHAccount', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_doesUserHaveSSHAccount()
+  {
+    $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_doesUserHaveSSHAccount_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_doesUserHaveSSHAccount_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;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("doesUserHaveSSHAccount failed: unknown result");
+  }
+
+  public function setupUserComputeResourcePreferencesForSSH(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId, $airavataCredStoreToken)
+  {
+    $this->send_setupUserComputeResourcePreferencesForSSH($authzToken, $computeResourceId, $userId, $airavataCredStoreToken);
+    return $this->recv_setupUserComputeResourcePreferencesForSSH();
+  }
+
+  public function send_setupUserComputeResourcePreferencesForSSH(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId, $airavataCredStoreToken)
+  {
+    $args = new \Airavata\API\Airavata_setupUserComputeResourcePreferencesForSSH_args();
+    $args->authzToken = $authzToken;
+    $args->computeResourceId = $computeResourceId;
+    $args->userId = $userId;
+    $args->airavataCredStoreToken = $airavataCredStoreToken;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'setupUserComputeResourcePreferencesForSSH', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('setupUserComputeResourcePreferencesForSSH', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_setupUserComputeResourcePreferencesForSSH()
+  {
+    $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_setupUserComputeResourcePreferencesForSSH_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_setupUserComputeResourcePreferencesForSSH_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;
+    }
+    if ($result->ae !== null) {
+      throw $result->ae;
+    }
+    throw new \Exception("setupUserComputeResourcePreferencesForSSH failed: unknown result");
+  }
+
   public function registerUserResourceProfile(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\AppCatalog\UserResourceProfile\UserResourceProfile $userResourceProfile)
   {
     $this->send_registerUserResourceProfile($authzToken, $userResourceProfile);
@@ -14860,19 +15127,18 @@
     throw new \Exception("updateGroup failed: unknown result");
   }
 
-  public function deleteGroup(\Airavata\Model\Security\AuthzToken $authzToken, $groupId, $ownerId, $gatewayId)
+  public function deleteGroup(\Airavata\Model\Security\AuthzToken $authzToken, $groupId, $ownerId)
   {
-    $this->send_deleteGroup($authzToken, $groupId, $ownerId, $gatewayId);
+    $this->send_deleteGroup($authzToken, $groupId, $ownerId);
     return $this->recv_deleteGroup();
   }
 
-  public function send_deleteGroup(\Airavata\Model\Security\AuthzToken $authzToken, $groupId, $ownerId, $gatewayId)
+  public function send_deleteGroup(\Airavata\Model\Security\AuthzToken $authzToken, $groupId, $ownerId)
   {
     $args = new \Airavata\API\Airavata_deleteGroup_args();
     $args->authzToken = $authzToken;
     $args->groupId = $groupId;
     $args->ownerId = $ownerId;
-    $args->gatewayId = $gatewayId;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
     {
@@ -14990,18 +15256,17 @@
     throw new \Exception("getGroup failed: unknown result");
   }
 
-  public function getAllGroupsUserBelongs(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  public function getAllGroupsUserBelongs(\Airavata\Model\Security\AuthzToken $authzToken, $userName)
   {
-    $this->send_getAllGroupsUserBelongs($authzToken, $userName, $gatewayId);
+    $this->send_getAllGroupsUserBelongs($authzToken, $userName);
     return $this->recv_getAllGroupsUserBelongs();
   }
 
-  public function send_getAllGroupsUserBelongs(\Airavata\Model\Security\AuthzToken $authzToken, $userName, $gatewayId)
+  public function send_getAllGroupsUserBelongs(\Airavata\Model\Security\AuthzToken $authzToken, $userName)
   {
     $args = new \Airavata\API\Airavata_getAllGroupsUserBelongs_args();
     $args->authzToken = $authzToken;
     $args->userName = $userName;
-    $args->gatewayId = $gatewayId;
     $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
     if ($bin_accel)
     {
@@ -55773,6 +56038,919 @@
 
 }
 
+class Airavata_getSSHAccountProvisioners_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = 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',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getSSHAccountProvisioners_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;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Airavata_getSSHAccountProvisioners_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();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_getSSHAccountProvisioners_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisioner[]
+   */
+  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;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisioner',
+            ),
+          ),
+        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',
+          ),
+        4 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    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'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_getSSHAccountProvisioners_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::LST) {
+            $this->success = array();
+            $_size253 = 0;
+            $_etype256 = 0;
+            $xfer += $input->readListBegin($_etype256, $_size253);
+            for ($_i257 = 0; $_i257 < $_size253; ++$_i257)
+            {
+              $elem258 = null;
+              $elem258 = new \Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisioner();
+              $xfer += $elem258->read($input);
+              $this->success []= $elem258;
+            }
+            $xfer += $input->readListEnd();
+          } 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;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->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_getSSHAccountProvisioners_result');
+    if ($this->success !== null) {
+      if (!is_array($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::LST, 0);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->success));
+        {
+          foreach ($this->success as $iter259)
+          {
+            $xfer += $iter259->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $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();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_doesUserHaveSSHAccount_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $computeResourceId = null;
+  /**
+   * @var string
+   */
+  public $userId = 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' => 'computeResourceId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'userId',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['computeResourceId'])) {
+        $this->computeResourceId = $vals['computeResourceId'];
+      }
+      if (isset($vals['userId'])) {
+        $this->userId = $vals['userId'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_doesUserHaveSSHAccount_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->computeResourceId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->userId);
+          } 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_doesUserHaveSSHAccount_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->computeResourceId !== null) {
+      $xfer += $output->writeFieldBegin('computeResourceId', TType::STRING, 2);
+      $xfer += $output->writeString($this->computeResourceId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userId !== null) {
+      $xfer += $output->writeFieldBegin('userId', TType::STRING, 3);
+      $xfer += $output->writeString($this->userId);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_doesUserHaveSSHAccount_result {
+  static $_TSPEC;
+
+  /**
+   * @var bool
+   */
+  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;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::BOOL,
+          ),
+        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',
+          ),
+        4 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    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'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_doesUserHaveSSHAccount_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::BOOL) {
+            $xfer += $input->readBool($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;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->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_doesUserHaveSSHAccount_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
+      $xfer += $output->writeBool($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();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_setupUserComputeResourcePreferencesForSSH_args {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\Security\AuthzToken
+   */
+  public $authzToken = null;
+  /**
+   * @var string
+   */
+  public $computeResourceId = null;
+  /**
+   * @var string
+   */
+  public $userId = null;
+  /**
+   * @var string
+   */
+  public $airavataCredStoreToken = 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' => 'computeResourceId',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'userId',
+          'type' => TType::STRING,
+          ),
+        4 => array(
+          'var' => 'airavataCredStoreToken',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['authzToken'])) {
+        $this->authzToken = $vals['authzToken'];
+      }
+      if (isset($vals['computeResourceId'])) {
+        $this->computeResourceId = $vals['computeResourceId'];
+      }
+      if (isset($vals['userId'])) {
+        $this->userId = $vals['userId'];
+      }
+      if (isset($vals['airavataCredStoreToken'])) {
+        $this->airavataCredStoreToken = $vals['airavataCredStoreToken'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_setupUserComputeResourcePreferencesForSSH_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->computeResourceId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->userId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->airavataCredStoreToken);
+          } 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_setupUserComputeResourcePreferencesForSSH_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->computeResourceId !== null) {
+      $xfer += $output->writeFieldBegin('computeResourceId', TType::STRING, 2);
+      $xfer += $output->writeString($this->computeResourceId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->userId !== null) {
+      $xfer += $output->writeFieldBegin('userId', TType::STRING, 3);
+      $xfer += $output->writeString($this->userId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->airavataCredStoreToken !== null) {
+      $xfer += $output->writeFieldBegin('airavataCredStoreToken', TType::STRING, 4);
+      $xfer += $output->writeString($this->airavataCredStoreToken);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Airavata_setupUserComputeResourcePreferencesForSSH_result {
+  static $_TSPEC;
+
+  /**
+   * @var \Airavata\Model\AppCatalog\UserResourceProfile\UserComputeResourcePreference
+   */
+  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;
+  /**
+   * @var \Airavata\API\Error\AuthorizationException
+   */
+  public $ae = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\Model\AppCatalog\UserResourceProfile\UserComputeResourcePreference',
+          ),
+        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',
+          ),
+        4 => array(
+          'var' => 'ae',
+          'type' => TType::STRUCT,
+          'class' => '\Airavata\API\Error\AuthorizationException',
+          ),
+        );
+    }
+    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'];
+      }
+      if (isset($vals['ae'])) {
+        $this->ae = $vals['ae'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Airavata_setupUserComputeResourcePreferencesForSSH_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::STRUCT) {
+            $this->success = new \Airavata\Model\AppCatalog\UserResourceProfile\UserComputeResourcePreference();
+            $xfer += $this->success->read($input);
+          } 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;
+        case 4:
+          if ($ftype == TType::STRUCT) {
+            $this->ae = new \Airavata\API\Error\AuthorizationException();
+            $xfer += $this->ae->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_setupUserComputeResourcePreferencesForSSH_result');
+    if ($this->success !== null) {
+      if (!is_object($this->success)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0);
+      $xfer += $this->success->write($output);
+      $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();
+    }
+    if ($this->ae !== null) {
+      $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4);
+      $xfer += $this->ae->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
 class Airavata_registerUserResourceProfile_args {
   static $_TSPEC;
 
@@ -58579,15 +59757,15 @@
         case 0:
           if ($ftype == TType::LST) {
             $this->success = array();
-            $_size253 = 0;
-            $_etype256 = 0;
-            $xfer += $input->readListBegin($_etype256, $_size253);
-            for ($_i257 = 0; $_i257 < $_size253; ++$_i257)
+            $_size260 = 0;
+            $_etype263 = 0;
+            $xfer += $input->readListBegin($_etype263, $_size260);
+            for ($_i264 = 0; $_i264 < $_size260; ++$_i264)
             {
-              $elem258 = null;
-              $elem258 = new \Airavata\Model\AppCatalog\UserResourceProfile\UserComputeResourcePreference();
-              $xfer += $elem258->read($input);
-              $this->success []= $elem258;
+              $elem265 = null;
+              $elem265 = new \Airavata\Model\AppCatalog\UserResourceProfile\UserComputeResourcePreference();
+              $xfer += $elem265->read($input);
+              $this->success []= $elem265;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -58647,9 +59825,9 @@
       {
         $output->writeListBegin(TType::STRUCT, count($this->success));
         {
-          foreach ($this->success as $iter259)
+          foreach ($this->success as $iter266)
           {
-            $xfer += $iter259->write($output);
+            $xfer += $iter266->write($output);
           }
         }
         $output->writeListEnd();
@@ -58908,15 +60086,15 @@
         case 0:
           if ($ftype == TType::LST) {
             $this->success = array();
-            $_size260 = 0;
-            $_etype263 = 0;
-            $xfer += $input->readListBegin($_etype263, $_size260);
-            for ($_i264 = 0; $_i264 < $_size260; ++$_i264)
+            $_size267 = 0;
+            $_etype270 = 0;
+            $xfer += $input->readListBegin($_etype270, $_size267);
+            for ($_i271 = 0; $_i271 < $_size267; ++$_i271)
             {
-              $elem265 = null;
-              $elem265 = new \Airavata\Model\AppCatalog\UserResourceProfile\UserStoragePreference();
-              $xfer += $elem265->read($input);
-              $this->success []= $elem265;
+              $elem272 = null;
+              $elem272 = new \Airavata\Model\AppCatalog\UserResourceProfile\UserStoragePreference();
+              $xfer += $elem272->read($input);
+              $this->success []= $elem272;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -58976,9 +60154,9 @@
       {
         $output->writeListBegin(TType::STRUCT, count($this->success));
         {
-          foreach ($this->success as $iter266)
+          foreach ($this->success as $iter273)
           {
-            $xfer += $iter266->write($output);
+            $xfer += $iter273->write($output);
           }
         }
         $output->writeListEnd();
@@ -59191,15 +60369,15 @@
         case 0:
           if ($ftype == TType::LST) {
             $this->success = array();
-            $_size267 = 0;
-            $_etype270 = 0;
-            $xfer += $input->readListBegin($_etype270, $_size267);
-            for ($_i271 = 0; $_i271 < $_size267; ++$_i271)
+            $_size274 = 0;
+            $_etype277 = 0;
+            $xfer += $input->readListBegin($_etype277, $_size274);
+            for ($_i278 = 0; $_i278 < $_size274; ++$_i278)
             {
-              $elem272 = null;
-              $elem272 = new \Airavata\Model\AppCatalog\UserResourceProfile\UserResourceProfile();
-              $xfer += $elem272->read($input);
-              $this->success []= $elem272;
+              $elem279 = null;
+              $elem279 = new \Airavata\Model\AppCatalog\UserResourceProfile\UserResourceProfile();
+              $xfer += $elem279->read($input);
+              $this->success []= $elem279;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -59259,9 +60437,9 @@
       {
         $output->writeListBegin(TType::STRUCT, count($this->success));
         {
-          foreach ($this->success as $iter273)
+          foreach ($this->success as $iter280)
           {
-            $xfer += $iter273->write($output);
+            $xfer += $iter280->write($output);
           }
         }
         $output->writeListEnd();
@@ -60848,14 +62026,14 @@
         case 0:
           if ($ftype == TType::LST) {
             $this->success = array();
-            $_size274 = 0;
-            $_etype277 = 0;
-            $xfer += $input->readListBegin($_etype277, $_size274);
-            for ($_i278 = 0; $_i278 < $_size274; ++$_i278)
+            $_size281 = 0;
+            $_etype284 = 0;
+            $xfer += $input->readListBegin($_etype284, $_size281);
+            for ($_i285 = 0; $_i285 < $_size281; ++$_i285)
             {
-              $elem279 = null;
-              $xfer += $input->readString($elem279);
-              $this->success []= $elem279;
+              $elem286 = null;
+              $xfer += $input->readString($elem286);
+              $this->success []= $elem286;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -60915,9 +62093,9 @@
       {
         $output->writeListBegin(TType::STRING, count($this->success));
         {
-          foreach ($this->success as $iter280)
+          foreach ($this->success as $iter287)
           {
-            $xfer += $output->writeString($iter280);
+            $xfer += $output->writeString($iter287);
           }
         }
         $output->writeListEnd();
@@ -61130,15 +62308,15 @@
         case 0:
           if ($ftype == TType::LST) {
             $this->success = array();
-            $_size281 = 0;
-            $_etype284 = 0;
-            $xfer += $input->readListBegin($_etype284, $_size281);
-            for ($_i285 = 0; $_i285 < $_size281; ++$_i285)
+            $_size288 = 0;
+            $_etype291 = 0;
+            $xfer += $input->readListBegin($_etype291, $_size288);
+            for ($_i292 = 0; $_i292 < $_size288; ++$_i292)
             {
-              $elem286 = null;
-              $elem286 = new \Airavata\Model\Status\QueueStatusModel();
-              $xfer += $elem286->read($input);
-              $this->success []= $elem286;
+              $elem293 = null;
+              $elem293 = new \Airavata\Model\Status\QueueStatusModel();
+              $xfer += $elem293->read($input);
+              $this->success []= $elem293;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -61198,9 +62376,9 @@
       {
         $output->writeListBegin(TType::STRUCT, count($this->success));
         {
-          foreach ($this->success as $iter287)
+          foreach ($this->success as $iter294)
           {
-            $xfer += $iter287->write($output);
+            $xfer += $iter294->write($output);
           }
         }
         $output->writeListEnd();
@@ -64251,15 +65429,15 @@
         case 0:
           if ($ftype == TType::LST) {
             $this->success = array();
-            $_size288 = 0;
-            $_etype291 = 0;
-            $xfer += $input->readListBegin($_etype291, $_size288);
-            for ($_i292 = 0; $_i292 < $_size288; ++$_i292)
+            $_size295 = 0;
+            $_etype298 = 0;
+            $xfer += $input->readListBegin($_etype298, $_size295);
+            for ($_i299 = 0; $_i299 < $_size295; ++$_i299)
             {
-              $elem293 = null;
-              $elem293 = new \Airavata\Model\Data\Replica\DataProductModel();
-              $xfer += $elem293->read($input);
-              $this->success []= $elem293;
+              $elem300 = null;
+              $elem300 = new \Airavata\Model\Data\Replica\DataProductModel();
+              $xfer += $elem300->read($input);
+              $this->success []= $elem300;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -64319,9 +65497,9 @@
       {
         $output->writeListBegin(TType::STRUCT, count($this->success));
         {
-          foreach ($this->success as $iter294)
+          foreach ($this->success as $iter301)
           {
-            $xfer += $iter294->write($output);
+            $xfer += $iter301->write($output);
           }
         }
         $output->writeListEnd();
@@ -64465,17 +65643,17 @@
         case 4:
           if ($ftype == TType::MAP) {
             $this->userPermissionList = array();
-            $_size295 = 0;
-            $_ktype296 = 0;
-            $_vtype297 = 0;
-            $xfer += $input->readMapBegin($_ktype296, $_vtype297, $_size295);
-            for ($_i299 = 0; $_i299 < $_size295; ++$_i299)
+            $_size302 = 0;
+            $_ktype303 = 0;
+            $_vtype304 = 0;
+            $xfer += $input->readMapBegin($_ktype303, $_vtype304, $_size302);
+            for ($_i306 = 0; $_i306 < $_size302; ++$_i306)
             {
-              $key300 = '';
-              $val301 = 0;
-              $xfer += $input->readString($key300);
-              $xfer += $input->readI32($val301);
-              $this->userPermissionList[$key300] = $val301;
+              $key307 = '';
+              $val308 = 0;
+              $xfer += $input->readString($key307);
+              $xfer += $input->readI32($val308);
+              $this->userPermissionList[$key307] = $val308;
             }
             $xfer += $input->readMapEnd();
           } else {
@@ -64521,10 +65699,10 @@
       {
         $output->writeMapBegin(TType::STRING, TType::I32, count($this->userPermissionList));
         {
-          foreach ($this->userPermissionList as $kiter302 => $viter303)
+          foreach ($this->userPermissionList as $kiter309 => $viter310)
           {
-            $xfer += $output->writeString($kiter302);
-            $xfer += $output->writeI32($viter303);
+            $xfer += $output->writeString($kiter309);
+            $xfer += $output->writeI32($viter310);
           }
         }
         $output->writeMapEnd();
@@ -64823,17 +66001,17 @@
         case 4:
           if ($ftype == TType::MAP) {
             $this->userPermissionList = array();
-            $_size304 = 0;
-            $_ktype305 = 0;
-            $_vtype306 = 0;
-            $xfer += $input->readMapBegin($_ktype305, $_vtype306, $_size304);
-            for ($_i308 = 0; $_i308 < $_size304; ++$_i308)
+            $_size311 = 0;
+            $_ktype312 = 0;
+            $_vtype313 = 0;
+            $xfer += $input->readMapBegin($_ktype312, $_vtype313, $_size311);
+            for ($_i315 = 0; $_i315 < $_size311; ++$_i315)
             {
-              $key309 = '';
-              $val310 = 0;
-              $xfer += $input->readString($key309);
-              $xfer += $input->readI32($val310);
-              $this->userPermissionList[$key309] = $val310;
+              $key316 = '';
+              $val317 = 0;
+              $xfer += $input->readString($key316);
+              $xfer += $input->readI32($val317);
+              $this->userPermissionList[$key316] = $val317;
             }
             $xfer += $input->readMapEnd();
           } else {
@@ -64879,10 +66057,10 @@
       {
         $output->writeMapBegin(TType::STRING, TType::I32, count($this->userPermissionList));
         {
-          foreach ($this->userPermissionList as $kiter311 => $viter312)
+          foreach ($this->userPermissionList as $kiter318 => $viter319)
           {
-            $xfer += $output->writeString($kiter311);
-            $xfer += $output->writeI32($viter312);
+            $xfer += $output->writeString($kiter318);
+            $xfer += $output->writeI32($viter319);
           }
         }
         $output->writeMapEnd();
@@ -65318,14 +66496,14 @@
         case 0:
           if ($ftype == TType::LST) {
             $this->success = array();
-            $_size313 = 0;
-            $_etype316 = 0;
-            $xfer += $input->readListBegin($_etype316, $_size313);
-            for ($_i317 = 0; $_i317 < $_size313; ++$_i317)
+            $_size320 = 0;
+            $_etype323 = 0;
+            $xfer += $input->readListBegin($_etype323, $_size320);
+            for ($_i324 = 0; $_i324 < $_size320; ++$_i324)
             {
-              $elem318 = null;
-              $xfer += $input->readString($elem318);
-              $this->success []= $elem318;
+              $elem325 = null;
+              $xfer += $input->readString($elem325);
+              $this->success []= $elem325;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -65385,9 +66563,9 @@
       {
         $output->writeListBegin(TType::STRING, count($this->success));
         {
-          foreach ($this->success as $iter319)
+          foreach ($this->success as $iter326)
           {
-            $xfer += $output->writeString($iter319);
+            $xfer += $output->writeString($iter326);
           }
         }
         $output->writeListEnd();
@@ -65533,7 +66711,7 @@
   static $_TSPEC;
 
   /**
-   * @var bool
+   * @var string
    */
   public $success = null;
   /**
@@ -65558,7 +66736,7 @@
       self::$_TSPEC = array(
         0 => array(
           'var' => 'success',
-          'type' => TType::BOOL,
+          'type' => TType::STRING,
           ),
         1 => array(
           'var' => 'ire',
@@ -65621,8 +66799,8 @@
       switch ($fid)
       {
         case 0:
-          if ($ftype == TType::BOOL) {
-            $xfer += $input->readBool($this->success);
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->success);
           } else {
             $xfer += $input->skip($ftype);
           }
@@ -65673,8 +66851,8 @@
     $xfer = 0;
     $xfer += $output->writeStructBegin('Airavata_createGroup_result');
     if ($this->success !== null) {
-      $xfer += $output->writeFieldBegin('success', TType::BOOL, 0);
-      $xfer += $output->writeBool($this->success);
+      $xfer += $output->writeFieldBegin('success', TType::STRING, 0);
+      $xfer += $output->writeString($this->success);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->ire !== null) {
@@ -66002,10 +67180,6 @@
    * @var string
    */
   public $ownerId = null;
-  /**
-   * @var string
-   */
-  public $gatewayId = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -66023,10 +67197,6 @@
           'var' => 'ownerId',
           'type' => TType::STRING,
           ),
-        4 => array(
-          'var' => 'gatewayId',
-          'type' => TType::STRING,
-          ),
         );
     }
     if (is_array($vals)) {
@@ -66039,9 +67209,6 @@
       if (isset($vals['ownerId'])) {
         $this->ownerId = $vals['ownerId'];
       }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
     }
   }
 
@@ -66086,13 +67253,6 @@
             $xfer += $input->skip($ftype);
           }
           break;
-        case 4:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -66124,11 +67284,6 @@
       $xfer += $output->writeString($this->ownerId);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 4);
-      $xfer += $output->writeString($this->gatewayId);
-      $xfer += $output->writeFieldEnd();
-    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -66605,10 +67760,6 @@
    * @var string
    */
   public $userName = null;
-  /**
-   * @var string
-   */
-  public $gatewayId = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -66622,10 +67773,6 @@
           'var' => 'userName',
           'type' => TType::STRING,
           ),
-        3 => array(
-          'var' => 'gatewayId',
-          'type' => TType::STRING,
-          ),
         );
     }
     if (is_array($vals)) {
@@ -66635,9 +67782,6 @@
       if (isset($vals['userName'])) {
         $this->userName = $vals['userName'];
       }
-      if (isset($vals['gatewayId'])) {
-        $this->gatewayId = $vals['gatewayId'];
-      }
     }
   }
 
@@ -66675,13 +67819,6 @@
             $xfer += $input->skip($ftype);
           }
           break;
-        case 3:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->gatewayId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -66708,11 +67845,6 @@
       $xfer += $output->writeString($this->userName);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->gatewayId !== null) {
-      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 3);
-      $xfer += $output->writeString($this->gatewayId);
-      $xfer += $output->writeFieldEnd();
-    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -66819,15 +67951,15 @@
         case 0:
           if ($ftype == TType::LST) {
             $this->success = array();
-            $_size320 = 0;
-            $_etype323 = 0;
-            $xfer += $input->readListBegin($_etype323, $_size320);
-            for ($_i324 = 0; $_i324 < $_size320; ++$_i324)
+            $_size327 = 0;
+            $_etype330 = 0;
+            $xfer += $input->readListBegin($_etype330, $_size327);
+            for ($_i331 = 0; $_i331 < $_size327; ++$_i331)
             {
-              $elem325 = null;
-              $elem325 = new \Airavata\Model\Group\GroupModel();
-              $xfer += $elem325->read($input);
-              $this->success []= $elem325;
+              $elem332 = null;
+              $elem332 = new \Airavata\Model\Group\GroupModel();
+              $xfer += $elem332->read($input);
+              $this->success []= $elem332;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -66887,9 +68019,9 @@
       {
         $output->writeListBegin(TType::STRUCT, count($this->success));
         {
-          foreach ($this->success as $iter326)
+          foreach ($this->success as $iter333)
           {
-            $xfer += $iter326->write($output);
+            $xfer += $iter333->write($output);
           }
         }
         $output->writeListEnd();
diff --git a/app/libraries/Airavata/Model/AppCatalog/AccountProvisioning/Types.php b/app/libraries/Airavata/Model/AppCatalog/AccountProvisioning/Types.php
new file mode 100644
index 0000000..541abd8
--- /dev/null
+++ b/app/libraries/Airavata/Model/AppCatalog/AccountProvisioning/Types.php
@@ -0,0 +1,345 @@
+<?php
+namespace Airavata\Model\AppCatalog\AccountProvisioning;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+final class SSHAccountProvisionerConfigParamType {
+  const STRING = 0;
+  const CRED_STORE_PASSWORD_TOKEN = 1;
+  static public $__names = array(
+    0 => 'STRING',
+    1 => 'CRED_STORE_PASSWORD_TOKEN',
+  );
+}
+
+class SSHAccountProvisionerConfigParam {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $name = null;
+  /**
+   * @var int
+   */
+  public $type =   0;
+  /**
+   * @var bool
+   */
+  public $isOptional = false;
+  /**
+   * @var string
+   */
+  public $description = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'name',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'type',
+          'type' => TType::I32,
+          ),
+        3 => array(
+          'var' => 'isOptional',
+          'type' => TType::BOOL,
+          ),
+        4 => array(
+          'var' => 'description',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['name'])) {
+        $this->name = $vals['name'];
+      }
+      if (isset($vals['type'])) {
+        $this->type = $vals['type'];
+      }
+      if (isset($vals['isOptional'])) {
+        $this->isOptional = $vals['isOptional'];
+      }
+      if (isset($vals['description'])) {
+        $this->description = $vals['description'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'SSHAccountProvisionerConfigParam';
+  }
+
+  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::STRING) {
+            $xfer += $input->readString($this->name);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->type);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->isOptional);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->description);
+          } 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('SSHAccountProvisionerConfigParam');
+    if ($this->name !== null) {
+      $xfer += $output->writeFieldBegin('name', TType::STRING, 1);
+      $xfer += $output->writeString($this->name);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->type !== null) {
+      $xfer += $output->writeFieldBegin('type', TType::I32, 2);
+      $xfer += $output->writeI32($this->type);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->isOptional !== null) {
+      $xfer += $output->writeFieldBegin('isOptional', TType::BOOL, 3);
+      $xfer += $output->writeBool($this->isOptional);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->description !== null) {
+      $xfer += $output->writeFieldBegin('description', TType::STRING, 4);
+      $xfer += $output->writeString($this->description);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class SSHAccountProvisioner {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $name = null;
+  /**
+   * @var bool
+   */
+  public $canCreateAccount = null;
+  /**
+   * @var bool
+   */
+  public $canInstallSSHKey = null;
+  /**
+   * @var \Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisionerConfigParam[]
+   */
+  public $configParams = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'name',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'canCreateAccount',
+          'type' => TType::BOOL,
+          ),
+        3 => array(
+          'var' => 'canInstallSSHKey',
+          'type' => TType::BOOL,
+          ),
+        4 => array(
+          'var' => 'configParams',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisionerConfigParam',
+            ),
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['name'])) {
+        $this->name = $vals['name'];
+      }
+      if (isset($vals['canCreateAccount'])) {
+        $this->canCreateAccount = $vals['canCreateAccount'];
+      }
+      if (isset($vals['canInstallSSHKey'])) {
+        $this->canInstallSSHKey = $vals['canInstallSSHKey'];
+      }
+      if (isset($vals['configParams'])) {
+        $this->configParams = $vals['configParams'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'SSHAccountProvisioner';
+  }
+
+  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::STRING) {
+            $xfer += $input->readString($this->name);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->canCreateAccount);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->canInstallSSHKey);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::LST) {
+            $this->configParams = array();
+            $_size0 = 0;
+            $_etype3 = 0;
+            $xfer += $input->readListBegin($_etype3, $_size0);
+            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            {
+              $elem5 = null;
+              $elem5 = new \Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisionerConfigParam();
+              $xfer += $elem5->read($input);
+              $this->configParams []= $elem5;
+            }
+            $xfer += $input->readListEnd();
+          } 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('SSHAccountProvisioner');
+    if ($this->name !== null) {
+      $xfer += $output->writeFieldBegin('name', TType::STRING, 1);
+      $xfer += $output->writeString($this->name);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->canCreateAccount !== null) {
+      $xfer += $output->writeFieldBegin('canCreateAccount', TType::BOOL, 2);
+      $xfer += $output->writeBool($this->canCreateAccount);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->canInstallSSHKey !== null) {
+      $xfer += $output->writeFieldBegin('canInstallSSHKey', TType::BOOL, 3);
+      $xfer += $output->writeBool($this->canInstallSSHKey);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->configParams !== null) {
+      if (!is_array($this->configParams)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('configParams', TType::LST, 4);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->configParams));
+        {
+          foreach ($this->configParams as $iter6)
+          {
+            $xfer += $iter6->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+
diff --git a/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php b/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php
index f0b329d..63e39bc 100644
--- a/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php
+++ b/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php
@@ -110,6 +110,18 @@
    * @var int
    */
   public $reservationEndTime = null;
+  /**
+   * @var string
+   */
+  public $sshAccountProvisioner = null;
+  /**
+   * @var array
+   */
+  public $sshAccountProvisionerConfig = null;
+  /**
+   * @var string
+   */
+  public $sshAccountProvisionerAdditionalInfo = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -170,6 +182,26 @@
           'var' => 'reservationEndTime',
           'type' => TType::I64,
           ),
+        15 => array(
+          'var' => 'sshAccountProvisioner',
+          'type' => TType::STRING,
+          ),
+        16 => array(
+          'var' => 'sshAccountProvisionerConfig',
+          'type' => TType::MAP,
+          'ktype' => TType::STRING,
+          'vtype' => TType::STRING,
+          'key' => array(
+            'type' => TType::STRING,
+          ),
+          'val' => array(
+            'type' => TType::STRING,
+            ),
+          ),
+        17 => array(
+          'var' => 'sshAccountProvisionerAdditionalInfo',
+          'type' => TType::STRING,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -215,6 +247,15 @@
       if (isset($vals['reservationEndTime'])) {
         $this->reservationEndTime = $vals['reservationEndTime'];
       }
+      if (isset($vals['sshAccountProvisioner'])) {
+        $this->sshAccountProvisioner = $vals['sshAccountProvisioner'];
+      }
+      if (isset($vals['sshAccountProvisionerConfig'])) {
+        $this->sshAccountProvisionerConfig = $vals['sshAccountProvisionerConfig'];
+      }
+      if (isset($vals['sshAccountProvisionerAdditionalInfo'])) {
+        $this->sshAccountProvisionerAdditionalInfo = $vals['sshAccountProvisionerAdditionalInfo'];
+      }
     }
   }
 
@@ -335,6 +376,40 @@
             $xfer += $input->skip($ftype);
           }
           break;
+        case 15:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->sshAccountProvisioner);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 16:
+          if ($ftype == TType::MAP) {
+            $this->sshAccountProvisionerConfig = array();
+            $_size0 = 0;
+            $_ktype1 = 0;
+            $_vtype2 = 0;
+            $xfer += $input->readMapBegin($_ktype1, $_vtype2, $_size0);
+            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            {
+              $key5 = '';
+              $val6 = '';
+              $xfer += $input->readString($key5);
+              $xfer += $input->readString($val6);
+              $this->sshAccountProvisionerConfig[$key5] = $val6;
+            }
+            $xfer += $input->readMapEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 17:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->sshAccountProvisionerAdditionalInfo);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -418,6 +493,34 @@
       $xfer += $output->writeI64($this->reservationEndTime);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->sshAccountProvisioner !== null) {
+      $xfer += $output->writeFieldBegin('sshAccountProvisioner', TType::STRING, 15);
+      $xfer += $output->writeString($this->sshAccountProvisioner);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->sshAccountProvisionerConfig !== null) {
+      if (!is_array($this->sshAccountProvisionerConfig)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('sshAccountProvisionerConfig', TType::MAP, 16);
+      {
+        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->sshAccountProvisionerConfig));
+        {
+          foreach ($this->sshAccountProvisionerConfig as $kiter7 => $viter8)
+          {
+            $xfer += $output->writeString($kiter7);
+            $xfer += $output->writeString($viter8);
+          }
+        }
+        $output->writeMapEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->sshAccountProvisionerAdditionalInfo !== null) {
+      $xfer += $output->writeFieldBegin('sshAccountProvisionerAdditionalInfo', TType::STRING, 17);
+      $xfer += $output->writeString($this->sshAccountProvisionerAdditionalInfo);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -711,15 +814,15 @@
         case 3:
           if ($ftype == TType::LST) {
             $this->computeResourcePreferences = array();
-            $_size0 = 0;
-            $_etype3 = 0;
-            $xfer += $input->readListBegin($_etype3, $_size0);
-            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            $_size9 = 0;
+            $_etype12 = 0;
+            $xfer += $input->readListBegin($_etype12, $_size9);
+            for ($_i13 = 0; $_i13 < $_size9; ++$_i13)
             {
-              $elem5 = null;
-              $elem5 = new \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference();
-              $xfer += $elem5->read($input);
-              $this->computeResourcePreferences []= $elem5;
+              $elem14 = null;
+              $elem14 = new \Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference();
+              $xfer += $elem14->read($input);
+              $this->computeResourcePreferences []= $elem14;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -729,15 +832,15 @@
         case 4:
           if ($ftype == TType::LST) {
             $this->storagePreferences = array();
-            $_size6 = 0;
-            $_etype9 = 0;
-            $xfer += $input->readListBegin($_etype9, $_size6);
-            for ($_i10 = 0; $_i10 < $_size6; ++$_i10)
+            $_size15 = 0;
+            $_etype18 = 0;
+            $xfer += $input->readListBegin($_etype18, $_size15);
+            for ($_i19 = 0; $_i19 < $_size15; ++$_i19)
             {
-              $elem11 = null;
-              $elem11 = new \Airavata\Model\AppCatalog\GatewayProfile\StoragePreference();
-              $xfer += $elem11->read($input);
-              $this->storagePreferences []= $elem11;
+              $elem20 = null;
+              $elem20 = new \Airavata\Model\AppCatalog\GatewayProfile\StoragePreference();
+              $xfer += $elem20->read($input);
+              $this->storagePreferences []= $elem20;
             }
             $xfer += $input->readListEnd();
           } else {
@@ -789,9 +892,9 @@
       {
         $output->writeListBegin(TType::STRUCT, count($this->computeResourcePreferences));
         {
-          foreach ($this->computeResourcePreferences as $iter12)
+          foreach ($this->computeResourcePreferences as $iter21)
           {
-            $xfer += $iter12->write($output);
+            $xfer += $iter21->write($output);
           }
         }
         $output->writeListEnd();
@@ -806,9 +909,9 @@
       {
         $output->writeListBegin(TType::STRUCT, count($this->storagePreferences));
         {
-          foreach ($this->storagePreferences as $iter13)
+          foreach ($this->storagePreferences as $iter22)
           {
-            $xfer += $iter13->write($output);
+            $xfer += $iter22->write($output);
           }
         }
         $output->writeListEnd();
diff --git a/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php b/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php
index 8ab78a0..c4a0a9c 100644
--- a/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php
+++ b/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php
@@ -43,6 +43,11 @@
  *  Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's
  *   default credential store.
  * 
+ * validated:
+ *  If true the the configuration has been validated in the sense that the username and credential can be used to
+ *  login to the remote host and the scratchLocation is a valid location that the user has permission to write to.
+ *  Should be treated as read-only and only mutated by Airavata middleware.
+ * 
  */
 class UserComputeResourcePreference {
   static $_TSPEC;
@@ -87,6 +92,10 @@
    * @var int
    */
   public $reservationEndTime = null;
+  /**
+   * @var bool
+   */
+  public $validated = false;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -131,6 +140,10 @@
           'var' => 'reservationEndTime',
           'type' => TType::I64,
           ),
+        11 => array(
+          'var' => 'validated',
+          'type' => TType::BOOL,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -164,6 +177,9 @@
       if (isset($vals['reservationEndTime'])) {
         $this->reservationEndTime = $vals['reservationEndTime'];
       }
+      if (isset($vals['validated'])) {
+        $this->validated = $vals['validated'];
+      }
     }
   }
 
@@ -256,6 +272,13 @@
             $xfer += $input->skip($ftype);
           }
           break;
+        case 11:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->validated);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -319,6 +342,11 @@
       $xfer += $output->writeI64($this->reservationEndTime);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->validated !== null) {
+      $xfer += $output->writeFieldBegin('validated', TType::BOOL, 11);
+      $xfer += $output->writeBool($this->validated);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
diff --git a/app/libraries/Airavata/Model/Tenant/Types.php b/app/libraries/Airavata/Model/Tenant/Types.php
index b217adf..c1ad4ec 100644
--- a/app/libraries/Airavata/Model/Tenant/Types.php
+++ b/app/libraries/Airavata/Model/Tenant/Types.php
@@ -38,6 +38,271 @@
   );
 }
 
+class TenantPreferences {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $tenantAdminFirstName = null;
+  /**
+   * @var string
+   */
+  public $tenantAdminLastName = null;
+  /**
+   * @var string
+   */
+  public $tenantAdminEmail = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        10 => array(
+          'var' => 'tenantAdminFirstName',
+          'type' => TType::STRING,
+          ),
+        11 => array(
+          'var' => 'tenantAdminLastName',
+          'type' => TType::STRING,
+          ),
+        12 => array(
+          'var' => 'tenantAdminEmail',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['tenantAdminFirstName'])) {
+        $this->tenantAdminFirstName = $vals['tenantAdminFirstName'];
+      }
+      if (isset($vals['tenantAdminLastName'])) {
+        $this->tenantAdminLastName = $vals['tenantAdminLastName'];
+      }
+      if (isset($vals['tenantAdminEmail'])) {
+        $this->tenantAdminEmail = $vals['tenantAdminEmail'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantPreferences';
+  }
+
+  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 10:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantAdminFirstName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 11:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantAdminLastName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 12:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tenantAdminEmail);
+          } 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('TenantPreferences');
+    if ($this->tenantAdminFirstName !== null) {
+      $xfer += $output->writeFieldBegin('tenantAdminFirstName', TType::STRING, 10);
+      $xfer += $output->writeString($this->tenantAdminFirstName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantAdminLastName !== null) {
+      $xfer += $output->writeFieldBegin('tenantAdminLastName', TType::STRING, 11);
+      $xfer += $output->writeString($this->tenantAdminLastName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tenantAdminEmail !== null) {
+      $xfer += $output->writeFieldBegin('tenantAdminEmail', TType::STRING, 12);
+      $xfer += $output->writeString($this->tenantAdminEmail);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class TenantConfig {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $oauthClientId = null;
+  /**
+   * @var string
+   */
+  public $oauthClientSecret = null;
+  /**
+   * @var string
+   */
+  public $identityServerUserName = null;
+  /**
+   * @var string
+   */
+  public $identityServerPasswordToken = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        16 => array(
+          'var' => 'oauthClientId',
+          'type' => TType::STRING,
+          ),
+        17 => array(
+          'var' => 'oauthClientSecret',
+          'type' => TType::STRING,
+          ),
+        13 => array(
+          'var' => 'identityServerUserName',
+          'type' => TType::STRING,
+          ),
+        14 => array(
+          'var' => 'identityServerPasswordToken',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['oauthClientId'])) {
+        $this->oauthClientId = $vals['oauthClientId'];
+      }
+      if (isset($vals['oauthClientSecret'])) {
+        $this->oauthClientSecret = $vals['oauthClientSecret'];
+      }
+      if (isset($vals['identityServerUserName'])) {
+        $this->identityServerUserName = $vals['identityServerUserName'];
+      }
+      if (isset($vals['identityServerPasswordToken'])) {
+        $this->identityServerPasswordToken = $vals['identityServerPasswordToken'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'TenantConfig';
+  }
+
+  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 16:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->oauthClientId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 17:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->oauthClientSecret);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 13:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->identityServerUserName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 14:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->identityServerPasswordToken);
+          } 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('TenantConfig');
+    if ($this->identityServerUserName !== null) {
+      $xfer += $output->writeFieldBegin('identityServerUserName', TType::STRING, 13);
+      $xfer += $output->writeString($this->identityServerUserName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->identityServerPasswordToken !== null) {
+      $xfer += $output->writeFieldBegin('identityServerPasswordToken', TType::STRING, 14);
+      $xfer += $output->writeString($this->identityServerPasswordToken);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->oauthClientId !== null) {
+      $xfer += $output->writeFieldBegin('oauthClientId', TType::STRING, 16);
+      $xfer += $output->writeString($this->oauthClientId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->oauthClientSecret !== null) {
+      $xfer += $output->writeFieldBegin('oauthClientSecret', TType::STRING, 17);
+      $xfer += $output->writeString($this->oauthClientSecret);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
 class Tenant {
   static $_TSPEC;
 
@@ -80,36 +345,8 @@
   /**
    * @var string
    */
-  public $tenantAdminFirstName = null;
-  /**
-   * @var string
-   */
-  public $tenantAdminLastName = null;
-  /**
-   * @var string
-   */
-  public $tenantAdminEmail = null;
-  /**
-   * @var string
-   */
-  public $identityServerUserName = null;
-  /**
-   * @var string
-   */
-  public $identityServerPasswordToken = null;
-  /**
-   * @var string
-   */
   public $declinedReason = null;
   /**
-   * @var string
-   */
-  public $oauthClientId = null;
-  /**
-   * @var string
-   */
-  public $oauthClientSecret = null;
-  /**
    * @var int
    */
   public $requestCreationTime = null;
@@ -157,38 +394,10 @@
           'var' => 'reviewProposalDescription',
           'type' => TType::STRING,
           ),
-        10 => array(
-          'var' => 'tenantAdminFirstName',
-          'type' => TType::STRING,
-          ),
-        11 => array(
-          'var' => 'tenantAdminLastName',
-          'type' => TType::STRING,
-          ),
-        12 => array(
-          'var' => 'tenantAdminEmail',
-          'type' => TType::STRING,
-          ),
-        13 => array(
-          'var' => 'identityServerUserName',
-          'type' => TType::STRING,
-          ),
-        14 => array(
-          'var' => 'identityServerPasswordToken',
-          'type' => TType::STRING,
-          ),
         15 => array(
           'var' => 'declinedReason',
           'type' => TType::STRING,
           ),
-        16 => array(
-          'var' => 'oauthClientId',
-          'type' => TType::STRING,
-          ),
-        17 => array(
-          'var' => 'oauthClientSecret',
-          'type' => TType::STRING,
-          ),
         18 => array(
           'var' => 'requestCreationTime',
           'type' => TType::I64,
@@ -227,30 +436,9 @@
       if (isset($vals['reviewProposalDescription'])) {
         $this->reviewProposalDescription = $vals['reviewProposalDescription'];
       }
-      if (isset($vals['tenantAdminFirstName'])) {
-        $this->tenantAdminFirstName = $vals['tenantAdminFirstName'];
-      }
-      if (isset($vals['tenantAdminLastName'])) {
-        $this->tenantAdminLastName = $vals['tenantAdminLastName'];
-      }
-      if (isset($vals['tenantAdminEmail'])) {
-        $this->tenantAdminEmail = $vals['tenantAdminEmail'];
-      }
-      if (isset($vals['identityServerUserName'])) {
-        $this->identityServerUserName = $vals['identityServerUserName'];
-      }
-      if (isset($vals['identityServerPasswordToken'])) {
-        $this->identityServerPasswordToken = $vals['identityServerPasswordToken'];
-      }
       if (isset($vals['declinedReason'])) {
         $this->declinedReason = $vals['declinedReason'];
       }
-      if (isset($vals['oauthClientId'])) {
-        $this->oauthClientId = $vals['oauthClientId'];
-      }
-      if (isset($vals['oauthClientSecret'])) {
-        $this->oauthClientSecret = $vals['oauthClientSecret'];
-      }
       if (isset($vals['requestCreationTime'])) {
         $this->requestCreationTime = $vals['requestCreationTime'];
       }
@@ -342,41 +530,6 @@
             $xfer += $input->skip($ftype);
           }
           break;
-        case 10:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->tenantAdminFirstName);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 11:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->tenantAdminLastName);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 12:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->tenantAdminEmail);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 13:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->identityServerUserName);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 14:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->identityServerPasswordToken);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
         case 15:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->declinedReason);
@@ -384,20 +537,6 @@
             $xfer += $input->skip($ftype);
           }
           break;
-        case 16:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->oauthClientId);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
-        case 17:
-          if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->oauthClientSecret);
-          } else {
-            $xfer += $input->skip($ftype);
-          }
-          break;
         case 18:
           if ($ftype == TType::I64) {
             $xfer += $input->readI64($this->requestCreationTime);
@@ -470,46 +609,11 @@
       $xfer += $output->writeString($this->reviewProposalDescription);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->tenantAdminFirstName !== null) {
-      $xfer += $output->writeFieldBegin('tenantAdminFirstName', TType::STRING, 10);
-      $xfer += $output->writeString($this->tenantAdminFirstName);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->tenantAdminLastName !== null) {
-      $xfer += $output->writeFieldBegin('tenantAdminLastName', TType::STRING, 11);
-      $xfer += $output->writeString($this->tenantAdminLastName);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->tenantAdminEmail !== null) {
-      $xfer += $output->writeFieldBegin('tenantAdminEmail', TType::STRING, 12);
-      $xfer += $output->writeString($this->tenantAdminEmail);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->identityServerUserName !== null) {
-      $xfer += $output->writeFieldBegin('identityServerUserName', TType::STRING, 13);
-      $xfer += $output->writeString($this->identityServerUserName);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->identityServerPasswordToken !== null) {
-      $xfer += $output->writeFieldBegin('identityServerPasswordToken', TType::STRING, 14);
-      $xfer += $output->writeString($this->identityServerPasswordToken);
-      $xfer += $output->writeFieldEnd();
-    }
     if ($this->declinedReason !== null) {
       $xfer += $output->writeFieldBegin('declinedReason', TType::STRING, 15);
       $xfer += $output->writeString($this->declinedReason);
       $xfer += $output->writeFieldEnd();
     }
-    if ($this->oauthClientId !== null) {
-      $xfer += $output->writeFieldBegin('oauthClientId', TType::STRING, 16);
-      $xfer += $output->writeString($this->oauthClientId);
-      $xfer += $output->writeFieldEnd();
-    }
-    if ($this->oauthClientSecret !== null) {
-      $xfer += $output->writeFieldBegin('oauthClientSecret', TType::STRING, 17);
-      $xfer += $output->writeString($this->oauthClientSecret);
-      $xfer += $output->writeFieldEnd();
-    }
     if ($this->requestCreationTime !== null) {
       $xfer += $output->writeFieldBegin('requestCreationTime', TType::I64, 18);
       $xfer += $output->writeI64($this->requestCreationTime);
diff --git a/app/libraries/CRUtilities.php b/app/libraries/CRUtilities.php
index 3643e72..8a815a1 100755
--- a/app/libraries/CRUtilities.php
+++ b/app/libraries/CRUtilities.php
@@ -544,6 +544,11 @@
         return $gateways;
     }
 
+    public static function getGatewayResourceProfile()
+    {
+        return Airavata::getGatewayResourceProfile( Session::get('authz-token'), Session::get("gateway_id"));
+    }
+
     public static function updateGatewayProfile( $data){
         $gatewayResourceProfile = Airavata::getGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"]);
         $gatewayResourceProfile->credentialStoreToken = $data["cst"];
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 9424893..ab91a3b 100755
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -691,7 +691,7 @@
             if ($experiment->userConfigurationData->useUserCRPref){
                 // Check if this user has a user CR preference for the compute
                 // resource, if not we want to switch this flag to false
-                $userComputeResourcePreferences = URPUtilities::get_all_user_compute_resource_prefs();
+                $userComputeResourcePreferences = URPUtilities::get_all_validated_user_compute_resource_prefs();
                 $userHasComputeResourcePreference = array_key_exists($computeResourceId, $userComputeResourcePreferences);
                 $experiment->userConfigurationData->useUserCRPref = $userHasComputeResourcePreference;
             }
diff --git a/app/libraries/URPUtilities.php b/app/libraries/URPUtilities.php
index 8632d59..c65197b 100644
--- a/app/libraries/URPUtilities.php
+++ b/app/libraries/URPUtilities.php
@@ -86,6 +86,8 @@
             $inputs["reservationEndTime"] = CommonUtilities::convertLocalToUTC(strtotime($inputs["reservationEndTime"])) * 1000;
 
         $userComputeResourcePreference = new UserComputeResourcePreference($inputs);
+        // FIXME: for now assume that if a user is adding or updating a UserComputeResourcePreference then they have also validated that it works. It would be better to confirm that in Airavata.
+        $userComputeResourcePreference->validated = true;
         // Log::debug("add_or_update_user_CRP: ", array($userComputeResourcePreference));
         $userId = Session::get('username');
         if ($update)
@@ -107,9 +109,17 @@
     }
 
     /*
-     * Get all user's compute resource preferences, keyed by compute resource id.
+     * Get all user's *validated* compute resource preferences, keyed by compute resource id.
      */
-    public static function get_all_user_compute_resource_prefs()
+    public static function get_all_validated_user_compute_resource_prefs()
+    {
+
+        return array_filter(URPUtilities::get_all_user_compute_resource_prefs(), function($userComputeResourcePreference) {
+            return $userComputeResourcePreference->validated;
+        });
+    }
+
+    private static function get_all_user_compute_resource_prefs()
     {
 
         $userComputeResourcePreferencesById = array();
@@ -161,6 +171,99 @@
         $gatewayId = Session::get('gateway_id');
         Airavata::deleteUserResourceProfile(Session::get('authz-token'), $userId, $gatewayId);
     }
+
+    /**
+     * Returns an array with compute resource ids as the key and each entry is a 
+     * map with the following fields:
+     * * hostname: hostname of compute resource
+     * * userComputeResourcePreference: if UserComputeResourcePreference exists for compute resource or was able to be created
+     * * accountIsMissing: (boolean) true if account doesn't exist on cluster and needs to be created manually (or by some other process)
+     * * additionalInfo: Additional info field from ComputeResourcePreference
+     * * errorMessage: Error message associated with trying to setup account
+     */
+    public static function setup_auto_provisioned_accounts()
+    {
+        $results = array();
+        $gatewayResourceProfile = CRUtilities::getGatewayResourceProfile();
+        $computeResourcePreferences = $gatewayResourceProfile->computeResourcePreferences;
+        $userComputeResourcePreferences = URPUtilities::get_all_user_compute_resource_prefs();
+        $sshAccountProvisioners = URPUtilities::get_ssh_account_provisioners();
+        $userId = Session::get("username");
+        $gatewayId = Session::get("gateway_id");
+        foreach( $computeResourcePreferences as $computeResourcePreference)
+        {
+            if( !empty($computeResourcePreference->sshAccountProvisioner))
+            {
+                $sshAccountProvisioner = $sshAccountProvisioners[$computeResourcePreference->sshAccountProvisioner];
+                $computeResourceId = $computeResourcePreference->computeResourceId;
+                $computeResource = CRUtilities::get_compute_resource($computeResourceId);
+                $hostname = $computeResource->hostName;
+                $userComputeResourcePreference = null;
+                $errorMessage = null;
+                $accountIsMissing = false;
+                try {
+                    if( array_key_exists($computeResourceId, $userComputeResourcePreferences)) {
+                        $userComputeResourcePreference = $userComputeResourcePreferences[$computeResourceId];
+                        // If a $userComputeResourcePreference exists but isn't
+                        // validated some error must have occurred the last time
+                        // it was attempted to be setup. We'll try to set it up again.
+                        if (!$userComputeResourcePreference->validated) {
+                            $userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname, $userComputeResourcePreference);
+                        }
+                    } else if ($sshAccountProvisioner->canCreateAccount) {
+                        $userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname);
+                    } else if (Airavata::doesUserHaveSSHAccount(Session::get('authz-token'), $computeResourceId, $userId)) {
+                        $userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname);
+                    } else {
+                        $accountIsMissing = true;
+                    }
+                } catch (Exception $ex) {
+                    Log::error("Failed to setup SSH Account for " . $userId . " on " . $hostname);
+                    Log::error($ex);
+                    $errorMessage = $ex->getMessage();
+                }
+                $results[] = array(
+                    "hostname" => $hostname,
+                    "userComputeResourcePreference" => $userComputeResourcePreference,
+                    "accountIsMissing" => $accountIsMissing,
+                    "additionalInfo" => $computeResourcePreference->sshAccountProvisionerAdditionalInfo,
+                    "errorMessage" => $errorMessage
+                );
+            }
+        }
+
+        return $results;
+    }
+
+    private static function get_ssh_account_provisioners()
+    {
+        $sshAccountProvisionersByName = array();
+        $sshAccountProvisioners = Airavata::getSSHAccountProvisioners(Session::get('authz-token'));
+        foreach ($sshAccountProvisioners as $sshAccountProvisioner) {
+            $sshAccountProvisionersByName[$sshAccountProvisioner->name] = $sshAccountProvisioner;
+        }
+        return $sshAccountProvisionersByName;
+    }
+
+    private static function setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname, $userComputeResourcePreference=null)
+    {
+        if (empty($userComputeResourcePreference)) {
+            Log::debug("userComputeResourcePreference is empty", array($userComputeResourcePreference));
+            // Initially create a UserComputeResourcePreference record to store
+            // the key. This will be marked validated=false initially until it
+            // is successfully setup. This way in case an error occurs we have a
+            // record of the generated SSH key to use and can try again later.
+            $userComputeResourcePreference = new UserComputeResourcePreference();
+            $userComputeResourcePreference->computeResourceId = $computeResourceId;
+            $credentialStoreToken = AdminUtilities::create_ssh_token_for_user("SSH Key for " . $hostname);
+            $userComputeResourcePreference->resourceSpecificCredentialStoreToken = $credentialStoreToken;
+            Airavata::addUserComputeResourcePreference(Session::get('authz-token'), $userId, $gatewayId, $computeResourceId, $userComputeResourcePreference);
+        }
+        $updatedUserCompResourcePref = Airavata::setupUserComputeResourcePreferencesForSSH(Session::get('authz-token'), $computeResourceId, $userId, $userComputeResourcePreference->resourceSpecificCredentialStoreToken);
+        $updatedUserCompResourcePref->resourceSpecificCredentialStoreToken = $userComputeResourcePreference->resourceSpecificCredentialStoreToken;
+        Airavata::updateUserComputeResourcePreference(Session::get('authz-token'), $userId, $gatewayId, $computeResourceId, $updatedUserCompResourcePref);
+        return $updatedUserCompResourcePref;
+    }
 }
 
 ?>
\ No newline at end of file
diff --git a/app/routes.php b/app/routes.php
index 61f15eb..9e876d6 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -34,6 +34,8 @@
 
 Route::get("logout", "AccountController@logout");
 
+Route::post("api-login", "AccountController@apiLoginSubmit");
+
 Route::get("forgot-password", "AccountController@forgotPassword");
 
 Route::get("reset-password", "AccountController@resetPassword");
diff --git a/app/views/account/credential-store.blade.php b/app/views/account/credential-store.blade.php
index a6b0b33..32e0f0d 100644
--- a/app/views/account/credential-store.blade.php
+++ b/app/views/account/credential-store.blade.php
@@ -57,15 +57,14 @@
                     @if ($credentialSummary->token != $defaultCredentialToken)
                     <form style="display: inline" action="{{ URL::to('/') }}/account/set-default-credential" method="post">
                         <input type="hidden" name="defaultToken" value="{{$credentialSummary->token}}"/>
-                        <button type="submit" class="btn btn-default">Make Default</button>
+                        <button type="submit" class="btn btn-default" title="Test">Make Default</button>
                     </form>
-                    @else
-                    <small>This is the default SSH public key that the gateway will use to authenticate to your compute and storage accounts.</small>
-                    @endif
-                    @if ($credentialSummary->canDelete)
                     <button data-token="{{$credentialSummary->token}}"
                         data-description="{{$credentialSummary->description}}"
-                        class="btn btn-danger delete-credential">Delete</button>
+                        class="btn btn-danger delete-credential"
+                        @if(!$credentialSummary->canDelete) disabled @endif>Delete</button>
+                    @else
+                    <small>This is the default SSH public key that the gateway will use to authenticate to your compute and storage accounts.</small>
                     @endif
                 </div>
             </div><!-- .row -->
diff --git a/app/views/account/dashboard.blade.php b/app/views/account/dashboard.blade.php
index 45abfa6..66e2241 100644
--- a/app/views/account/dashboard.blade.php
+++ b/app/views/account/dashboard.blade.php
@@ -225,6 +225,9 @@
             <h1>Gateway: {{Session::get("gateway_id")}}</h1>
             <h3>Let's get started!</h3>
         </div>
+        @if (Session::has('auto_provisioned_accounts'))
+            @include('partials/auto-provisioned-accounts', array("auto_provisioned_accounts" => Session::get('auto_provisioned_accounts')))
+        @endif
         <div class="row text-center admin-options">
 
             <div class="row well">
diff --git a/app/views/account/update.blade.php b/app/views/account/update.blade.php
index e2e905c..e5b2f37 100644
--- a/app/views/account/update.blade.php
+++ b/app/views/account/update.blade.php
@@ -65,36 +65,6 @@
                         </div>
 
                         <div class="form-group required">
-                            <label class="control-label">Gateway Admin Username</label>
-                            <input type="text" name="admin-username" value="{{ $gatewayData["adminUsername"] }}" class="form-control" required="required" />
-                        </div>
-
-                        <div class="form-group required">
-                            <label class="control-label">Gateway Admin Password</label>
-                            <input type="password" id="password" name="admin-password" class="form-control" required="required" title="" type="password" data-container="body" data-toggle="popover" data-placement="left" data-content="Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$*"/>
-                        </div>
-
-                        <div class="form-group required">
-                            <label class="control-label">Admin Password Confirmation</label>
-                            <input type="password" name="admin-password-confirm" class="form-control" required="required"/>
-                        </div>
-
-                        <div class="form-group required">
-                            <label class="control-label">Admin First Name</label>
-                            <input type="text" name="admin-firstname" class="form-control" required="required" value="{{ $gatewayData["adminFirstName"] }}"/>
-                        </div>
-
-                        <div class="form-group required">
-                            <label class="control-label">Admin Last Name</label>
-                            <input type="text" name="admin-lastname" class="form-control" required="required" value="{{ $gatewayData["adminLastName"] }}"/>
-                        </div>
-
-                        <div class="form-group required">
-                            <label class="control-label">Admin Email ID</label>
-                            <input type="text" name="admin-email" class="form-control" required="required" value="{{ $gatewayData["adminEmail"] }}"/>
-                        </div>
-
-                        <div class="form-group required">
                             <label class="control-label">Project Details</label>
                             <textarea type="text" name="project-details" maxlength="250" id="project-details" class="form-control" required="required"  data-container="body" data-toggle="popover" data-placement="left" data-content="This information will help us to understand and identify your gateway requirements, such as local or remote resources, user management, field of science and communities supported, applications and interfaces, license handling, allocation management, data management, etc... It will help us in serving you and providing you with the best option for you and your research community.">{{ $gatewayData["projectDetails"] }}</textarea>
                         </div>
@@ -118,10 +88,6 @@
 @parent
 <script>
 
-    $("#password").popover({
-    'trigger':'focus'
-    });
-
     $("#gateway-url").popover({
     'trigger':'focus'
     });
diff --git a/app/views/admin/manage-gateway.blade.php b/app/views/admin/manage-gateway.blade.php
index 5e72642..df4a997 100644
--- a/app/views/admin/manage-gateway.blade.php
+++ b/app/views/admin/manage-gateway.blade.php
@@ -275,6 +275,14 @@
                         <input type="text" name="identityServerUserName" id="identityServerUserName" class="form-control identityServerUserName"/>
                     </div>
                     <div class="form-group">
+                        <label class="control-label">Gateway Admin Password</label>
+                        <input type="password" id="password" name="gatewayAdminPassword" class="form-control identityServerPasswordToken" title="" type="password" data-container="body" data-toggle="popover" data-placement="left" data-content="Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$*"/>
+                    </div>
+                    <div class="form-group">
+                        <label class="control-label">Admin Password Confirmation</label>
+                        <input type="password" name="gatewayAdminPasswordConfirm" class="form-control"/>
+                    </div>
+                    <div class="form-group">
                         <label>Gateway Admin First Name</label>
                         <input type="text" name="gatewayAdminFirstName" id="gatewayAdminFirstName" class="form-control gatewayAdminFirstName"/>
                     </div>
@@ -613,6 +621,9 @@
         $(".reviewProposalDescription").val( gatewayObject.reviewProposalDescription);
         $(".gatewayAdminFirstName").val( gatewayObject.gatewayAdminFirstName);
         $(".gatewayAdminLastName").val( gatewayObject.gatewayAdminLastName);
+        if (gatewayObject.identityServerPasswordToken) {
+            $(".identityServerPasswordToken").attr("placeholder", "Current token: " + gatewayObject.identityServerPasswordToken);
+        }
         $(".emailAddress").val( gatewayObject.emailAddress);
         $(".identityServerUserName").val( gatewayObject.identityServerUserName);
         $(".oauthClientId").val( gatewayObject.oauthClientId);
@@ -668,6 +679,8 @@
                     $(thisButton).addClass("hide");
                 }
             });
+            // Disallow creating tenant until password is set
+            $("button[value=createTenant]").prop("disabled", !gatewayObject.identityServerPasswordToken);
             $(".approvedGateway").removeClass("hide"); {
                 $('#emailAddress').attr('readonly', false);
                 $('#gatewayURL').attr('readonly', false);
@@ -772,16 +785,29 @@
         $.ajax({
             url: "{{URL::to('/')}}/admin/update-gateway-request",
             method: "GET",
-            data: updateGatewayData
+            data: updateGatewayData,
+            dataType: 'json'
         }).done( function( data){
             $(".loading-gif").remove();
-            if( data == -1 ){
-                //errors only with -1
+            if( data.errors ){
+                var messages = data.validationMessages;
+                var errorMessages = [];
+                for (var field in data.validationMessages) {
+                    Array.prototype.push.apply(errorMessages, data.validationMessages[field]);
+                }
+                var errorMessagesList = $("<ul></ul>");
+                errorMessages.forEach((errorMessage) => {
+                    $("<li></li>").text(errorMessage).appendTo(errorMessagesList);
+                });
                 if( updateVal == "createTenant"){
-                $(".submit-actions").before("<div class='alert alert-danger fail-alert'>All fields are required to create the gateway! Please make sure you've first updated all the Gateway details accurately and try again. Ask the Gateway Provider to set a Password token if they haven't set it yet.");
+                    $(".submit-actions")
+                        .before("<div class='alert alert-danger fail-alert'>All fields are required to create the gateway! Please make sure you've first updated all the Gateway details accurately and try again.</div>")
+                        .append(errorMessagesList);
                 }
                 else{
-                    $(".submit-actions").before("<div class='alert alert-danger fail-alert'>Error updating Gateway. Please try again.");
+                    $("<div class='alert alert-danger fail-alert'>Error updating Gateway.</div>")
+                        .insertBefore(".submit-actions")
+                        .append(errorMessagesList);
                 }
             }
             else{
@@ -799,7 +825,7 @@
 
                 //refresh data next time if same popup is opened.
                 var gatewayIdWithoutSpaces = dataObj['gateway_id'].replace(/\s+/g, '-');
-                $("#view-" +  gatewayIdWithoutSpaces).data("gatewayobject", data);
+                $("#view-" +  gatewayIdWithoutSpaces).data("gatewayobject", data.gateway);
                 $("#view-" + gatewayIdWithoutSpaces ).parent().parent().find(".form-gatewayName").html( dataObj['gatewayName']);
                 $("#view-" + gatewayIdWithoutSpaces ).parent().parent().find(".form-gatewayURL").html( dataObj['gatewayURL']);
             }
@@ -860,8 +886,8 @@
     });
 
 
-    $(".qualityOfService").popover({
-        'trigger':'focus'
+    $("[data-toggle=popover]").popover({
+        'trigger': 'focus'
     });
 
     function editableInputs( elem, yes){
diff --git a/app/views/partials/auto-provisioned-accounts.blade.php b/app/views/partials/auto-provisioned-accounts.blade.php
new file mode 100644
index 0000000..58a3a29
--- /dev/null
+++ b/app/views/partials/auto-provisioned-accounts.blade.php
@@ -0,0 +1,53 @@
+
+<div class="row">
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">Automatically Configured Accounts</h3>
+        </div>
+        <div class="panel-body">
+            <p>
+                The following displays the results from attempting to
+                automatically configure your account on the following
+                cluster(s). All successfully configured accounts can be used
+                from this gateway.
+            </p>
+            <table class="table">
+                <thead>
+                    <tr>
+                        <th>Status</th>
+                        <th>Hostname</th>
+                        <th>Additional Info</th>
+                        <th>Error Message</th>
+                    </tr>
+                </thead>
+                <tbody>
+                    @foreach ($auto_provisioned_accounts as $auto_provisioned_account)
+                        <tr>
+                            <td>
+                                @if ($auto_provisioned_account["errorMessage"] != null)
+                                    <span class="glyphicon glyphicon-warning-sign" style="color: red;"></span> FAILED
+                                    <p>
+                                        <small>See <strong>Error Message</strong> for more information and contact Gateway Admin for help.</small>
+                                    </p>
+                                @elseif ($auto_provisioned_account["accountIsMissing"] === true)
+                                    <span class="glyphicon glyphicon-user" style="color: red;"></span> ACCOUNT MISSING
+                                    <p>
+                                        <small>See <strong>Additional Info</strong> for more information on how to create your account on {{{ $auto_provisioned_account["hostname"]}}}.</small>
+                                    </p>
+                                @elseif ($auto_provisioned_account["userComputeResourcePreference"] != null && $auto_provisioned_account["userComputeResourcePreference"]->validated)
+                                    <span class="glyphicon glyphicon-ok" style="color: green;"></span> OK
+                                @else
+                                    <span class="glyphicon glyphicon-question-sign" style="color: grey;"></span> UNKNOWN
+                                @endif
+                            </td>
+                            <td>{{{ $auto_provisioned_account["hostname"] }}}</td>
+                            {{-- Not escaping HTML to allow Gateway Admin to put HTML into additionalInfo field --}}
+                            <td>{{ $auto_provisioned_account["additionalInfo"] }}</td>
+                            <td>{{{ $auto_provisioned_account["errorMessage"] }}}</td>
+                        </tr>
+                    @endforeach
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/app/views/partials/user-compute-resource-preferences.blade.php b/app/views/partials/user-compute-resource-preferences.blade.php
index 49c3f85..caedb92 100644
--- a/app/views/partials/user-compute-resource-preferences.blade.php
+++ b/app/views/partials/user-compute-resource-preferences.blade.php
@@ -13,14 +13,15 @@
 
     <div class="col-md-9">
         <input type="text" name="loginUserName" class="form-control"
-               value="@if( isset( $preferences) ){{$preferences->loginUserName}}@endif"/>
+               value="@if( isset( $preferences) ){{$preferences->loginUserName}}@endif"
+               @if(isset($preferences) && !$preferences->editable) disabled @endif/>
     </div>
 </div>
 <div class="form-group">
     <label class="control-label col-md-3">Preferred Batch Queue</label>
 
     <div class="col-md-9">
-        <select name="preferredBatchQueue" class="form-control">
+        <select name="preferredBatchQueue" class="form-control" @if(isset($preferences) && !$preferences->editable) disabled @endif>
             <option value="">Select a Queue from list</option>
             @foreach( (array)$computeResource->batchQueues as $index => $queue)
             <option value="{{ $queue->queueName}}"
@@ -35,7 +36,8 @@
 
     <div class="col-md-9">
         <input type="text" name="scratchLocation" class="form-control"
-               value="@if( isset( $preferences) ){{$preferences->scratchLocation}}@endif"/>
+               value="@if( isset( $preferences) ){{$preferences->scratchLocation}}@endif"
+               @if(isset($preferences) && !$preferences->editable) disabled @endif/>
     </div>
 </div>
 
@@ -44,7 +46,8 @@
 
     <div class="col-md-9">
         <input type="text" name="allocationProjectNumber" class="form-control"
-               value="@if( isset( $preferences) ){{$preferences->allocationProjectNumber}}@endif"/>
+               value="@if( isset( $preferences) ){{$preferences->allocationProjectNumber}}@endif"
+               @if(isset($preferences) && !$preferences->editable) disabled @endif/>
     </div>
 </div>
 
@@ -52,7 +55,7 @@
     <label class="control-label col-md-3">Resource Specific SSH Key</label>
 
     <div class="col-md-9">
-        <select class="form-control" name="resourceSpecificCredentialStoreToken" >
+        <select class="form-control" name="resourceSpecificCredentialStoreToken" @if(isset($preferences) && !$preferences->editable) disabled @endif>
             <option value="" @if( isset( $preferences) && $preferences->resourceSpecificCredentialStoreToken == null) selected @endif>
                 No resource specific SSH key, just use the default one ({{{$defaultCredentialSummary->description}}})
             </option>
@@ -72,7 +75,8 @@
 
     <div class="col-md-9">
         <input type="text" name="qualityOfService" class="qualityOfService form-control"
-               value="@if( isset( $preferences) ){{$preferences->qualityOfService}}@endif" data-toggle="popover" data-placement="bottom" data-content="Format: <queue name1>=<qos1>,<queue name2>=<qos2>"/>
+               value="@if( isset( $preferences) ){{$preferences->qualityOfService}}@endif" data-toggle="popover" data-placement="bottom" data-content="Format: <queue name1>=<qos1>,<queue name2>=<qos2>"
+               @if(isset($preferences) && !$preferences->editable) disabled @endif/>
     </div>
 </div>
 
@@ -81,7 +85,8 @@
 
     <div class="col-md-9">
         <input type="text" name="reservation" class="form-control"
-               value="@if( isset( $preferences) ){{$preferences->reservation}}@endif"/>
+               value="@if( isset( $preferences) ){{$preferences->reservation}}@endif"
+               @if(isset($preferences) && !$preferences->editable) disabled @endif/>
     </div>
 </div>
 <?php
@@ -106,7 +111,8 @@
 
         <div class="input-group date datetimepicker1">
             <input type="text" name="reservationStartTime" class="form-control"
-                   value="{{$reservationStartTime}}"/>
+                   value="{{$reservationStartTime}}"
+                   @if(isset($preferences) && !$preferences->editable) disabled @endif/>
             <span class="input-group-addon">
                 <span class="glyphicon glyphicon-calendar"></span>
             </span>
@@ -118,7 +124,8 @@
 
         <div class="input-group date datetimepicker2">
             <input type="text" name="reservationEndTime" class="form-control"
-                   value="{{$reservationEndTime}}"/>
+                   value="{{$reservationEndTime}}"
+                   @if(isset($preferences) && !$preferences->editable) disabled @endif/>
             <span class="input-group-addon">
                 <span class="glyphicon glyphicon-calendar"></span>
             </span>
@@ -126,6 +133,7 @@
     </div>
 </div>
 
+@if(!isset($preferences) || $preferences->editable)
 <div class="row">
     <div class="form-group col-md-12 text-center">
         <input type="submit" class="btn btn-primary" value="Save"/>
@@ -138,5 +146,6 @@
         </button>
     </div>
 </div>
+@endif
 
 </div>