Repository: airavata-php-gateway Updated Branches: refs/heads/develop f9fc0161e -> 8ae298859
updating thrift files and AuthzContext file Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/8ae29885 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/8ae29885 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/8ae29885 Branch: refs/heads/develop Commit: 8ae2988590c0e18e94a1d5b9aebe62c4e3e82c1b Parents: f9fc016 Author: scnakandala <[email protected]> Authored: Mon May 2 14:49:51 2016 -0400 Committer: scnakandala <[email protected]> Committed: Mon May 2 14:49:51 2016 -0400 ---------------------------------------------------------------------- app/controllers/AccountController.php | 3 +- app/filters.php | 2 + app/libraries/Airavata/API/Airavata.php | 59 ++++++++++++++------ app/libraries/Airavata/Model/Security/Types.php | 48 +++++++++++++++- 4 files changed, 94 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8ae29885/app/controllers/AccountController.php ---------------------------------------------------------------------- diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 89b408b..ec429e3 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -117,7 +117,8 @@ class AccountController extends BaseController $authzToken = new Airavata\Model\Security\AuthzToken(); $authzToken->accessToken = $accessToken; - $authzToken->claimsMap = array('userName'=>$username); + $authzToken->gatewayId = Config::get('pga_config.airavata')['gateway-id']; + $authzToken->userName = $username; Session::put('authz-token',$authzToken); Session::put('oauth-refresh-code',$refreshToken); Session::put('oauth-expiration-time',$expirationTime); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8ae29885/app/filters.php ---------------------------------------------------------------------- diff --git a/app/filters.php b/app/filters.php index 638be33..89a92b2 100755 --- a/app/filters.php +++ b/app/filters.php @@ -27,6 +27,8 @@ App::before(function ($request) { $expirationTime = time() + $response->expires_in - 300; $authzToken = Session::get('authz-token'); $authzToken->accessToken = $accessToken; + $authzToken->gatewayId = Config::get('pga_config.airavata')['gateway-id']; + $authzToken->userName = Session::get('username'); Session::put('authz-token',$authzToken); Session::put('oauth-refresh-code',$refreshToken); Session::put('oauth-expiration-time',$expirationTime); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8ae29885/app/libraries/Airavata/API/Airavata.php ---------------------------------------------------------------------- diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php index 54f8228..9f570e8 100644 --- a/app/libraries/Airavata/API/Airavata.php +++ b/app/libraries/Airavata/API/Airavata.php @@ -253,10 +253,12 @@ interface AiravataIf { * @param gatewayId * The identifier for the requested Gateway. * - * @param userName + * @param portalUserName * The User for which the credential should be registered. For community accounts, this user is the name of the * community user name. For computational resources, this user name need not be the same user name on resoruces. * + * @param loginUserName + * * @param password * * @return airavataCredStoreToken @@ -267,14 +269,15 @@ interface AiravataIf { * * @param \Airavata\Model\Security\AuthzToken $authzToken * @param string $gatewayId - * @param string $userName + * @param string $portalUserName + * @param string $loginUserName * @param string $password * @return string * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException * @throws \Airavata\API\Error\AiravataSystemException */ - public function registerPwdCredential(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $userName, $password); + public function registerPwdCredential(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $portalUserName, $loginUserName, $password); /** * Get a Public Key by Providing the Token * @@ -4486,18 +4489,19 @@ class AiravataClient implements \Airavata\API\AiravataIf { throw new \Exception("generateAndRegisterSSHKeys failed: unknown result"); } - public function registerPwdCredential(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $userName, $password) + public function registerPwdCredential(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $portalUserName, $loginUserName, $password) { - $this->send_registerPwdCredential($authzToken, $gatewayId, $userName, $password); + $this->send_registerPwdCredential($authzToken, $gatewayId, $portalUserName, $loginUserName, $password); return $this->recv_registerPwdCredential(); } - public function send_registerPwdCredential(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $userName, $password) + public function send_registerPwdCredential(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayId, $portalUserName, $loginUserName, $password) { $args = new \Airavata\API\Airavata_registerPwdCredential_args(); $args->authzToken = $authzToken; $args->gatewayId = $gatewayId; - $args->userName = $userName; + $args->portalUserName = $portalUserName; + $args->loginUserName = $loginUserName; $args->password = $password; $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); if ($bin_accel) @@ -17116,7 +17120,11 @@ class Airavata_registerPwdCredential_args { /** * @var string */ - public $userName = null; + public $portalUserName = null; + /** + * @var string + */ + public $loginUserName = null; /** * @var string */ @@ -17135,10 +17143,14 @@ class Airavata_registerPwdCredential_args { 'type' => TType::STRING, ), 3 => array( - 'var' => 'userName', + 'var' => 'portalUserName', 'type' => TType::STRING, ), 4 => array( + 'var' => 'loginUserName', + 'type' => TType::STRING, + ), + 5 => array( 'var' => 'password', 'type' => TType::STRING, ), @@ -17151,8 +17163,11 @@ class Airavata_registerPwdCredential_args { if (isset($vals['gatewayId'])) { $this->gatewayId = $vals['gatewayId']; } - if (isset($vals['userName'])) { - $this->userName = $vals['userName']; + if (isset($vals['portalUserName'])) { + $this->portalUserName = $vals['portalUserName']; + } + if (isset($vals['loginUserName'])) { + $this->loginUserName = $vals['loginUserName']; } if (isset($vals['password'])) { $this->password = $vals['password']; @@ -17196,13 +17211,20 @@ class Airavata_registerPwdCredential_args { break; case 3: if ($ftype == TType::STRING) { - $xfer += $input->readString($this->userName); + $xfer += $input->readString($this->portalUserName); } else { $xfer += $input->skip($ftype); } break; case 4: if ($ftype == TType::STRING) { + $xfer += $input->readString($this->loginUserName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: + if ($ftype == TType::STRING) { $xfer += $input->readString($this->password); } else { $xfer += $input->skip($ftype); @@ -17234,13 +17256,18 @@ class Airavata_registerPwdCredential_args { $xfer += $output->writeString($this->gatewayId); $xfer += $output->writeFieldEnd(); } - if ($this->userName !== null) { - $xfer += $output->writeFieldBegin('userName', TType::STRING, 3); - $xfer += $output->writeString($this->userName); + if ($this->portalUserName !== null) { + $xfer += $output->writeFieldBegin('portalUserName', TType::STRING, 3); + $xfer += $output->writeString($this->portalUserName); + $xfer += $output->writeFieldEnd(); + } + if ($this->loginUserName !== null) { + $xfer += $output->writeFieldBegin('loginUserName', TType::STRING, 4); + $xfer += $output->writeString($this->loginUserName); $xfer += $output->writeFieldEnd(); } if ($this->password !== null) { - $xfer += $output->writeFieldBegin('password', TType::STRING, 4); + $xfer += $output->writeFieldBegin('password', TType::STRING, 5); $xfer += $output->writeString($this->password); $xfer += $output->writeFieldEnd(); } http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8ae29885/app/libraries/Airavata/Model/Security/Types.php ---------------------------------------------------------------------- diff --git a/app/libraries/Airavata/Model/Security/Types.php b/app/libraries/Airavata/Model/Security/Types.php index f388971..7b9c143 100644 --- a/app/libraries/Airavata/Model/Security/Types.php +++ b/app/libraries/Airavata/Model/Security/Types.php @@ -25,6 +25,14 @@ class AuthzToken { */ public $accessToken = null; /** + * @var string + */ + public $gatewayId = null; + /** + * @var string + */ + public $userName = null; + /** * @var array */ public $claimsMap = null; @@ -37,6 +45,14 @@ class AuthzToken { 'type' => TType::STRING, ), 2 => array( + 'var' => 'gatewayId', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'userName', + 'type' => TType::STRING, + ), + 4 => array( 'var' => 'claimsMap', 'type' => TType::MAP, 'ktype' => TType::STRING, @@ -54,6 +70,12 @@ class AuthzToken { if (isset($vals['accessToken'])) { $this->accessToken = $vals['accessToken']; } + if (isset($vals['gatewayId'])) { + $this->gatewayId = $vals['gatewayId']; + } + if (isset($vals['userName'])) { + $this->userName = $vals['userName']; + } if (isset($vals['claimsMap'])) { $this->claimsMap = $vals['claimsMap']; } @@ -87,6 +109,20 @@ class AuthzToken { } break; case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->gatewayId); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->userName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: if ($ftype == TType::MAP) { $this->claimsMap = array(); $_size0 = 0; @@ -124,11 +160,21 @@ class AuthzToken { $xfer += $output->writeString($this->accessToken); $xfer += $output->writeFieldEnd(); } + if ($this->gatewayId !== null) { + $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2); + $xfer += $output->writeString($this->gatewayId); + $xfer += $output->writeFieldEnd(); + } + if ($this->userName !== null) { + $xfer += $output->writeFieldBegin('userName', TType::STRING, 3); + $xfer += $output->writeString($this->userName); + $xfer += $output->writeFieldEnd(); + } if ($this->claimsMap !== null) { if (!is_array($this->claimsMap)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } - $xfer += $output->writeFieldBegin('claimsMap', TType::MAP, 2); + $xfer += $output->writeFieldBegin('claimsMap', TType::MAP, 4); { $output->writeMapBegin(TType::STRING, TType::STRING, count($this->claimsMap)); {
