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

[40/51] [partial] airavata-php-gateway git commit: importing PGA into new repo - details are discussed at AIRAVATA-1627

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/UserStoreManager/UserStoreManager.stub.php
----------------------------------------------------------------------
diff --git a/app/libraries/UserStoreManager/UserStoreManager.stub.php b/app/libraries/UserStoreManager/UserStoreManager.stub.php
new file mode 100755
index 0000000..d92ccb9
--- /dev/null
+++ b/app/libraries/UserStoreManager/UserStoreManager.stub.php
@@ -0,0 +1,1568 @@
+<?php
+
+/**
+ * This file contains the DTOs and the method stubs for
+ * WSO2 IS 4.6.0 RemoteUserStoreManger service.
+ */
+
+class ClaimDTO {
+
+    /**
+     * @var string $claimUri
+     * @access public
+     */
+    public $claimUri;
+
+    /**
+     * @var string $description
+     * @access public
+     */
+    public $description;
+
+    /**
+     * @var string $dialectURI
+     * @access public
+     */
+    public $dialectURI;
+
+    /**
+     * @var int $displayOrder
+     * @access public
+     */
+    public $displayOrder;
+
+    /**
+     * @var string $displayTag
+     * @access public
+     */
+    public $displayTag;
+
+    /**
+     * @var string $regEx
+     * @access public
+     */
+    public $regEx;
+
+    /**
+     * @var boolean $required
+     * @access public
+     */
+    public $required;
+
+    /**
+     * @var boolean $supportedByDefault
+     * @access public
+     */
+    public $supportedByDefault;
+
+    /**
+     * @var string $value
+     * @access public
+     */
+    public $value;
+
+}
+
+class PermissionDTO {
+
+    /**
+     * @var string $action
+     * @access public
+     */
+    public $action;
+
+    /**
+     * @var string $resourceId
+     * @access public
+     */
+    public $resourceId;
+
+}
+
+class Tenant {
+
+    /**
+     * @var boolean $active
+     * @access public
+     */
+    public $active;
+
+    /**
+     * @var string $adminFirstName
+     * @access public
+     */
+    public $adminFirstName;
+
+    /**
+     * @var string $adminFullName
+     * @access public
+     */
+    public $adminFullName;
+
+    /**
+     * @var string $adminLastName
+     * @access public
+     */
+    public $adminLastName;
+
+    /**
+     * @var string $adminName
+     * @access public
+     */
+    public $adminName;
+
+    /**
+     * @var string $adminPassword
+     * @access public
+     */
+    public $adminPassword;
+
+    /**
+     * @var string $createdDate YYYY-MM-DD
+     * @access public
+     */
+    public $createdDate;
+
+    /**
+     * @var string $domain
+     * @access public
+     */
+    public $domain;
+
+    /**
+     * @var string $email
+     * @access public
+     */
+    public $email;
+
+    /**
+     * @var int $id
+     * @access public
+     */
+    public $id;
+
+    /**
+     * @var RealmConfiguration $realmConfig
+     * @access public
+     */
+    public $realmConfig;
+
+}
+
+class RealmConfiguration {
+
+    /**
+     * @var string $addAdmin
+     * @access public
+     */
+    public $addAdmin;
+
+    /**
+     * @var string $adminPassword
+     * @access public
+     */
+    public $adminPassword;
+
+    /**
+     * @var string $adminRoleName
+     * @access public
+     */
+    public $adminRoleName;
+
+    /**
+     * @var string $adminUserName
+     * @access public
+     */
+    public $adminUserName;
+
+    /**
+     * @var string $authorizationManagerClass
+     * @access public
+     */
+    public $authorizationManagerClass;
+
+    /**
+     * @var string $authzProperties
+     * @access public
+     */
+    public $authzProperties;
+
+    /**
+     * @var string $description
+     * @access public
+     */
+    public $description;
+
+    /**
+     * @var string $everyOneRoleName
+     * @access public
+     */
+    public $everyOneRoleName;
+
+    /**
+     * @var string $multipleCredentialProps
+     * @access public
+     */
+    public $multipleCredentialProps;
+
+    /**
+     * @var boolean $passwordsExternallyManaged
+     * @access public
+     */
+    public $passwordsExternallyManaged;
+
+    /**
+     * @var string $persistedTimestamp YYYY-MM-DD
+     * @access public
+     */
+    public $persistedTimestamp;
+
+    /**
+     * @var boolean $primary
+     * @access public
+     */
+    public $primary;
+
+    /**
+     * @var string $realmClassName
+     * @access public
+     */
+    public $realmClassName;
+
+    /**
+     * @var string $realmProperties
+     * @access public
+     */
+    public $realmProperties;
+
+    /**
+     * @var RealmConfiguration $secondaryRealmConfig
+     * @access public
+     */
+    public $secondaryRealmConfig;
+
+    /**
+     * @var int $tenantId
+     * @access public
+     */
+    public $tenantId;
+
+    /**
+     * @var string $userStoreClass
+     * @access public
+     */
+    public $userStoreClass;
+
+    /**
+     * @var string $userStoreProperties
+     * @access public
+     */
+    public $userStoreProperties;
+
+}
+
+class ClaimValue {
+
+    /**
+     * @var string $claimURI
+     * @access public
+     */
+    public $claimURI;
+
+    /**
+     * @var string $value
+     * @access public
+     */
+    public $value;
+
+}
+
+class AddUserClaimValues {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var ClaimValue $claims
+     * @access public
+     */
+    public $claims;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class GetUserClaimValuesForClaims {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $claims
+     * @access public
+     */
+    public $claims;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class GetUserClaimValuesForClaimsResponse {
+
+    /**
+     * @var ClaimValue $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetTenantIdofUser {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $username;
+
+}
+
+class GetTenantIdofUserResponse {
+
+    /**
+     * @var int $return
+     * @access public
+     */
+    public $return; // int
+
+}
+
+class AddUserClaimValue {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $claimURI
+     * @access public
+     */
+    public $claimURI;
+
+    /**
+     * @var string $claimValue
+     * @access public
+     */
+    public $claimValue;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class GetUserClaimValues {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class GetUserClaimValuesResponse {
+
+    /**
+     * @var ClaimDTO $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetTenantId {
+    
+}
+
+class GetTenantIdResponse {
+
+    /**
+     * @var int $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class AddUser {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $credential
+     * @access public
+     */
+    public $credential;
+
+    /**
+     * @var string $roleList
+     * @access public
+     */
+    public $roleList;
+
+    /**
+     * @var ClaimValue $claims
+     * @access public
+     */
+    public $claims;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+    /**
+     * @var boolean $requiredPasswordChange
+     * @access public
+     */
+    public $requirePasswordChange;
+
+}
+
+class AddRole {
+
+    /**
+     * @var string $roleName
+     * @access public
+     */
+    public $roleName;
+
+    /**
+     * @var string $userList
+     * @access public
+     */
+    public $userList;
+
+    /**
+     * @var PermissionDTO $permissions
+     * @access public
+     */
+    public $permissions;
+
+}
+
+class GetUserList {
+
+    /**
+     * @var string $claimUri
+     * @access public
+     */
+    public $claimUri;
+
+    /**
+     * @var string $claimValue
+     * @access public
+     */
+    public $claimValue;
+
+    /**
+     * @var string $profile
+     * @access public
+     */
+    public $profile;
+
+}
+
+class GetUserListResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class UpdateCredential {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $newCredential
+     * @access public
+     */
+    public $newCredential;
+
+    /**
+     * @var string $oldCredential
+     * @access public
+     */
+    public $oldCredential;
+
+}
+
+class UpdateUserListOfRole {
+
+    /**
+     * @var string $roleName
+     * @access public
+     */
+    public $roleName;
+
+    /**
+     * @var string $deletedUsers
+     * @access public
+     */
+    public $deletedUsers;
+
+    /**
+     * @var string $newUsers
+     * @access public
+     */
+    public $newUsers;
+
+}
+
+class UpdateRoleListOfUser {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $deletedRoles
+     * @access public
+     */
+    public $deletedRoles;
+
+    /**
+     * @var string $newRoles
+     * @access public
+     */
+    public $newRoles;
+
+}
+
+class SetUserClaimValue {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $claimURI
+     * @access public
+     */
+    public $claimURI;
+
+    /**
+     * @var string $claimValue
+     * @access public
+     */
+    public $claimValue;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class SetUserClaimValues {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var ClaimValue $claims
+     * @access public
+     */
+    public $claims;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class DeleteUserClaimValue {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $claimURI
+     * @access public
+     */
+    public $claimURI;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class DeleteUserClaimValues {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $claims
+     * @access public
+     */
+    public $claims;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class GetHybridRoles {
+    
+}
+
+class GetHybridRolesResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetPasswordExpirationTime {
+
+    /**
+     * @var string $username
+     * @access public
+     */
+    public $username;
+
+}
+
+class GetPasswordExpirationTimeResponse {
+
+    /**
+     * @var long $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class UpdateRoleName {
+
+    /**
+     * @var string $roleName
+     * @access public
+     */
+    public $roleName;
+
+    /**
+     * @var string $newRoleName
+     * @access public
+     */
+    public $newRoleName;
+
+}
+
+class ListUsers {
+
+    /**
+     * @var string $filter
+     * @access public
+     */
+    public $filter;
+
+    /**
+     * @var int $maxItemLimit
+     * @access public
+     */
+    public $maxItemLimit;
+
+}
+
+class ListUsersResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class IsExistingUser {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+}
+
+class IsExistingUserResponse {
+
+    /**
+     * @var boolean $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class IsExistingRole {
+
+    /**
+     * @var string $roleName
+     * @access public
+     */
+    public $roleName;
+
+}
+
+class IsExistingRoleResponse {
+
+    /**
+     * @var boolean $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetRoleNames {
+    
+}
+
+class GetRoleNamesResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetProfileNames {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+}
+
+class GetProfileNamesResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetUserListOfRole {
+
+    /**
+     * @var string $roleName
+     * @access public
+     */
+    public $roleName;
+
+}
+
+class GetUserListOfRoleResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetUserClaimValue {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $claim
+     * @access public
+     */
+    public $claim;
+
+    /**
+     * @var string $profileName
+     * @access public
+     */
+    public $profileName;
+
+}
+
+class GetUserClaimValueResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetAllProfileNames {
+    
+}
+
+class GetAllProfileNamesResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class UpdateCredentialByAdmin {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $newCredential
+     * @access public
+     */
+    public $newCredential;
+
+}
+
+class DeleteUser {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+}
+
+class DeleteRole {
+
+    /**
+     * @var string $roleName
+     * @access public
+     */
+    public $roleName;
+
+}
+
+class GetUserId {
+
+    /**
+     * @var string $username
+     * @access public
+     */
+    public $username;
+
+}
+
+class GetUserIdResponse {
+
+    /**
+     * @var int $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetRoleListOfUser {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+}
+
+class getRoleListOfUserResponse {
+
+    /**
+     * @var string $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class GetProperties {
+
+    /**
+     * @var Tenant $tenant
+     * @access public
+     */
+    public $tenant;
+
+}
+
+class GetPropertiesResponse {
+
+    /**
+     * @var Array<string> $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class IsReadOnly {
+    
+}
+
+class IsReadOnlyResponse {
+
+    /**
+     * @var boolean $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class Authenticate {
+
+    /**
+     * @var string $userName
+     * @access public
+     */
+    public $userName;
+
+    /**
+     * @var string $credential
+     * @access public
+     */
+    public $credential;
+
+}
+
+class AuthenticateResponse {
+
+    /**
+     * @var boolean $return
+     * @access public
+     */
+    public $return;
+
+}
+
+class UserStoreException {
+    
+}
+
+/**
+ * UserStoreManagerService class
+ * 
+ */
+class UserStoreManagerStub extends SoapClient {
+
+    private static $classmap = array(
+        'ClaimDTO' => 'ClaimDTO',
+        'PermissionDTO' => 'PermissionDTO',
+        'Tenant' => 'Tenant',
+        'RealmConfiguration' => 'RealmConfiguration',
+        'ClaimValue' => 'ClaimValue',
+        'addUserClaimValues' => 'AddUserClaimValues',
+        'getUserClaimValuesForClaims' => 'GetUserClaimValuesForClaims',
+        'getUserClaimValuesForClaimsResponse' => 'GetUserClaimValuesForClaimsResponse',
+        'getTenantIdofUser' => 'GetTenantIdofUser',
+        'getTenantIdofUserResponse' => 'GetTenantIdofUserResponse',
+        'addUserClaimValue' => 'AddUserClaimValue',
+        'getUserClaimValues' => 'GetUserClaimValues',
+        'getUserClaimValuesResponse' => 'GetUserClaimValuesResponse',
+        'getTenantId' => 'GetTenantId',
+        'getTenantIdResponse' => 'GetTenantIdResponse',
+        'addUser' => 'AddUser',
+        'addRole' => 'AddRole',
+        'getUserList' => 'GetUserList',
+        'getUserListResponse' => 'GetUserListResponse',
+        'updateCredential' => 'UpdateCredential',
+        'updateUserListOfRole' => 'UpdateUserListOfRole',
+        'updateRoleListOfUser' => 'UpdateRoleListOfUser',
+        'setUserClaimValue' => 'SetUserClaimValue',
+        'setUserClaimValues' => 'SetUserClaimValues',
+        'deleteUserClaimValue' => 'DeleteUserClaimValue',
+        'deleteUserClaimValues' => 'DeleteUserClaimValues',
+        'getHybridRoles' => 'GetHybridRoles',
+        'getHybridRolesResponse' => 'GetHybridRolesResponse',
+        'getPasswordExpirationTime' => 'GetPasswordExpirationTime',
+        'getPasswordExpirationTimeResponse' => 'GetPasswordExpirationTimeResponse',
+        'updateRoleName' => 'UpdateRoleName',
+        'listUsers' => 'ListUsers',
+        'listUsersResponse' => 'ListUsersResponse',
+        'isExistingUser' => 'IsExistingUser',
+        'isExistingUserResponse' => 'IsExistingUserResponse',
+        'isExistingRole' => 'IsExistingRole',
+        'isExistingRoleResponse' => 'IsExistingRoleResponse',
+        'getRoleNames' => 'GetRoleNames',
+        'getRoleNamesResponse' => 'GetRoleNamesResponse',
+        'getProfileNames' => 'GetProfileNames',
+        'getProfileNamesResponse' => 'GetProfileNamesResponse',
+        'getUserListOfRole' => 'GetUserListOfRole',
+        'getUserListOfRoleResponse' => 'GetUserListOfRoleResponse',
+        'getUserClaimValue' => 'GetUserClaimValue',
+        'getUserClaimValueResponse' => 'GetUserClaimValueResponse',
+        'getAllProfileNames' => 'GetAllProfileNames',
+        'getAllProfileNamesResponse' => 'GetAllProfileNamesResponse',
+        'updateCredentialByAdmin' => 'UpdateCredentialByAdmin',
+        'deleteUser' => 'DeleteUser',
+        'deleteRole' => 'DeleteRole',
+        'getUserId' => 'GetUserId',
+        'getUserIdResponse' => 'GetUserIdResponse',
+        'getRoleListOfUser' => 'GetRoleListOfUser',
+        'getRoleListOfUserResponse' => 'GetRoleListOfUserResponse',
+        'getProperties' => 'GetProperties',
+        'getPropertiesResponse' => 'GetPropertiesResponse',
+        'isReadOnly' => 'IsReadOnly',
+        'isReadOnlyResponse' => 'IsReadOnlyResponse',
+        'authenticate' => 'Authenticate',
+        'authenticateResponse' => 'AuthenticateResponse',
+        'Tenant' => 'Tenant'
+    );
+
+    public function RemoteUserStoreManagerStub($wsdl, $options = array()) {
+        foreach (self::$classmap as $key => $value) {
+            if (!isset($options['classmap'][$key])) {
+                $options['classmap'][$key] = $value;
+            }
+        }
+        parent::__construct($wsdl, $options);
+    }
+
+    /**
+     * Function to authenticate 
+     *
+     * @param Authenticate $parameters
+     * @return AuthenticateResponse
+     */
+    public function authenticate(Authenticate $parameters) {
+        return $this->__soapCall('authenticate', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function get user list
+     *
+     * @param GetUserList $parameters
+     * @return GetUserListResponse
+     */
+    public function getUserList(GetUserList $parameters) {
+        return $this->__soapCall('getUserList', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get the user claim value
+     *
+     * @param GetUserClaimValue $parameters
+     * @return GetUserClaimValueResponse
+     */
+    public function getUserClaimValue(GetUserClaimValue $parameters) {
+        return $this->__soapCall('getUserClaimValue', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get the user list of role
+     *
+     * @param GetUserListOfRole $parameters
+     * @return GetUserListOfRoleResponse
+     */
+    public function getUserListOfRole(GetUserListOfRole $parameters) {
+        return $this->__soapCall('getUserListOfRole', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to check whether the service is read only 
+     *
+     * @param IsReadOnly $parameters
+     * @return IsReadOnlyResponse
+     */
+    public function isReadOnly(IsReadOnly $parameters) {
+        return $this->__soapCall('isReadOnly', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to update the credentials
+     *
+     * @param UpdateCredential $parameters
+     * @return void
+     */
+    public function updateCredential(UpdateCredential $parameters) {
+        return $this->__soapCall('updateCredential', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to set user claim value 
+     *
+     * @param SetUserClaimValue $parameters
+     * @return void
+     */
+    public function setUserClaimValue(setUserClaimValue $parameters) {
+        return $this->__soapCall('setUserClaimValue', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get the claim values for claims
+     *
+     * @param GetUserClaimValuesForClaims $parameters
+     * @return GetUserClaimValuesForClaimsResponse
+     */
+    public function getUserClaimValuesForClaims(GetUserClaimValuesForClaims $parameters) {
+        return $this->__soapCall('getUserClaimValuesForClaims', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to delete user claim values 
+     *
+     * @param DeleteUserClaimValues $parameters
+     * @return void
+     */
+    public function deleteUserClaimValues(DeleteUserClaimValues $parameters) {
+        return $this->__soapCall('deleteUserClaimValues', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to delete user claim value 
+     *
+     * @param DeleteUserClaimValue $parameters
+     * @return void
+     */
+    public function deleteUserClaimValue(DeleteUserClaimValue $parameters) {
+        return $this->__soapCall('deleteUserClaimValue', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to check whether use is existing 
+     *
+     * @param IsExistingUser $parameters
+     * @return IsExistingUserResponse
+     */
+    public function isExistingUser(IsExistingUser $parameters) {
+        return $this->__soapCall('isExistingUser', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to update credential by admin
+     *
+     * @param UpdateCredentialByAdmin $parameters
+     * @return void
+     */
+    public function updateCredentialByAdmin(UpdateCredentialByAdmin $parameters) {
+        return $this->__soapCall('updateCredentialByAdmin', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get the tenant id
+     *
+     * @param GetTenantId $parameters
+     * @return GetTenantIdResponse
+     */
+    public function getTenantId(GetTenantId $parameters) {
+        return $this->__soapCall('getTenantId', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get role names 
+     *
+     * @param GetRoleNames $parameters
+     * @return GetRoleNamesResponse
+     */
+    public function getRoleNames(GetRoleNames $parameters) {
+        return $this->__soapCall('getRoleNames', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Funtion to get properties
+     *
+     * @param GetProperties $parameters
+     * @return GetPropertiesResponse
+     */
+    public function getProperties(GetProperties $parameters) {
+        return $this->__soapCall('getProperties', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get user id
+     *
+     * @param GetUserId $parameters
+     * @return GetUserIdResponse
+     */
+    public function getUserId(GetUserId $parameters) {
+        return $this->__soapCall('getUserId', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get all the profile names  
+     *
+     * @param GetAllProfileNames $parameters
+     * @return GetAllProfileNamesResponse
+     */
+    public function getAllProfileNames(GetAllProfileNames $parameters) {
+        return $this->__soapCall('getAllProfileNames', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get the password expiration time 
+     *
+     * @param GetPasswordExpirationTime $parameters
+     * @return GetPasswordExpirationTimeResponse
+     */
+    public function getPasswordExpirationTime(GetPasswordExpirationTime $parameters) {
+        return $this->__soapCall('getPasswordExpirationTime', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to list users
+     *
+     * @param ListUsers $parameters
+     * @return ListUsersResponse
+     */
+    public function listUsers(ListUsers $parameters) {
+        return $this->__soapCall('listUsers', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to delete role 
+     *
+     * @param DeleteRole $parameters
+     * @return void
+     */
+    public function deleteRole(DeleteRole $parameters) {
+        return $this->__soapCall('deleteRole', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to delete user 
+     *
+     * @param DeleteUser $parameters
+     * @return void
+     */
+    public function deleteUser(DeleteUser $parameters) {
+        return $this->__soapCall('deleteUser', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function get the role list of the user 
+     *
+     * @param GetRoleListOfUser $parameters
+     * @return GetRoleListOfUserResponse
+     */
+    public function getRoleListOfUser(GetRoleListOfUser $parameters) {
+        return $this->__soapCall('getRoleListOfUser', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to update the role name
+     *
+     * @param UpdateRoleName $parameters
+     * @return void
+     */
+    public function updateRoleName(UpdateRoleName $parameters) {
+        return $this->__soapCall('updateRoleName', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to check whether a role is existing 
+     *
+     * @param IsExistingRole $parameters
+     * @return IsExistingRoleResponse
+     */
+    public function isExistingRole(IsExistingRole $parameters) {
+        return $this->__soapCall('isExistingRole', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to update role list of user 
+     *
+     * @param UpdateRoleListOfUser $parameters
+     * @return void
+     */
+    public function updateRoleListOfUser(UpdateRoleListOfUser $parameters) {
+        return $this->__soapCall('updateRoleListOfUser', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get user claim values 
+     *
+     * @param GetUserClaimValues $parameters
+     * @return GetUserClaimValuesResponse
+     */
+    public function getUserClaimValues(GetUserClaimValues $parameters) {
+        return $this->__soapCall('getUserClaimValues', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get hybrid roles
+     *
+     * @param GetHybridRoles $parameters
+     * @return GetHybridRolesResponse
+     */
+    public function getHybridRoles(GetHybridRoles $parameters) {
+        return $this->__soapCall('getHybridRoles', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to add user claim values 
+     *
+     * @param AddUserClaimValues $parameters
+     * @return void
+     */
+    public function addUserClaimValues(AddUserClaimValues $parameters) {
+        return $this->__soapCall('addUserClaimValues', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to add user 
+     *
+     * @param AddUser $parameters
+     * @return void
+     */
+    public function addUser(AddUser $parameters) {
+        return $this->__soapCall('addUser', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to add role 
+     *
+     * @param AddRole $parameters
+     * @return void
+     */
+    public function addRole(AddRole $parameters) {
+        return $this->__soapCall('addRole', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to update user list of roles 
+     *
+     * @param UpdateUserListOfRole $parameters
+     * @return void
+     */
+    public function updateUserListOfRole(UpdateUserListOfRole $parameters) {
+        return $this->__soapCall('updateUserListOfRole', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get the tenant Id 
+     *
+     * @param GetTenantIdofUser $parameters
+     * @return GetTenantIdofUserResponse
+     */
+    public function getTenantIdofUser(GetTenantIdofUser $parameters) {
+        return $this->__soapCall('getTenantIdofUser', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to set user claim values 
+     *
+     * @param SetUserClaimValues $parameters
+     * @return void
+     */
+    public function setUserClaimValues(SetUserClaimValues $parameters) {
+        return $this->__soapCall('setUserClaimValues', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to add user claim value 
+     *
+     * @param AddUserClaimValue $parameters
+     * @return void
+     */
+    public function addUserClaimValue(AddUserClaimValue $parameters) {
+        return $this->__soapCall('addUserClaimValue', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+    /**
+     * Function to get the profile names
+     *
+     * @param GetProfileNames $parameters
+     * @return GetProfileNamesResponse
+     */
+    public function getProfileNames(GetProfileNames $parameters) {
+        return $this->__soapCall('getProfileNames', array($parameters), array(
+                    'uri' => 'http://service.ws.um.carbon.wso2.org',
+                    'soapaction' => ''
+        ));
+    }
+
+}
+
+?>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/WSISClient.php
----------------------------------------------------------------------
diff --git a/app/libraries/WSISClient.php b/app/libraries/WSISClient.php
new file mode 100755
index 0000000..93a9262
--- /dev/null
+++ b/app/libraries/WSISClient.php
@@ -0,0 +1,264 @@
+<?php
+
+require_once 'UserStoreManager/UserStoreManager.php';
+
+/**
+ * WSISClient class
+ * 
+ * This class provides a unified interface for the
+ * WSO2 IS 4.6.0 service APIs.
+ */
+class WSISClient {
+
+    /**
+     * @var UserStoreManager
+     * @access private
+     */
+    private $userStoreManager;
+
+    /**
+     * @var string
+     * @access private
+     */
+    private $server;
+    
+    /**
+     * @var string
+     * @access private
+     */
+    private $service_url;
+
+
+    /**
+     * Constructor
+     * 
+     * @param string $admin_username
+     * @param string $admin_password
+     * @param string $server
+     * @param string $service_url
+     * @param string $cafile_path
+     * @param bool   $verify_peer
+     * @param bool   $allow_selfsigned_cer
+     * @throws Exception
+     */
+    public function __construct($admin_username, $admin_password = null, $server,
+            $service_url,$cafile_path, $verify_peer, $allow_selfsigned_cert) {
+        
+        $context = stream_context_create(array(
+            'ssl' => array(
+                'verify_peer' => $verify_peer,
+                "allow_self_signed"=> $allow_selfsigned_cert,
+                'cafile' => $cafile_path,
+                'CN_match' => $server,
+        )));
+
+        $parameters = array(
+            'login' => $admin_username,
+            'password' => $admin_password,
+            'stream_context' => $context,
+            'trace' => 1,
+            'features' => SOAP_WAIT_ONE_WAY_CALLS
+        );
+
+        $this->server = $server;
+        $this->service_url = $service_url;
+        
+        try {
+            $this->userStoreManager = new UserStoreManager($service_url, $parameters);
+        } catch (Exception $ex) {
+            print_r( $ex); exit;
+            throw new Exception("Unable to instantiate client", 0, $ex);
+        }
+    }
+
+    
+    /**
+     * Function to add new user
+     * 
+     * @param string $userName
+     * @param string $password
+     * @return void
+     * @throws Exception
+     */
+    public function addUser($userName, $password, $fullName) {
+        try {
+            $this->userStoreManager->addUser($userName, $password, $fullName);
+        } catch (Exception $ex) {
+            throw new Exception("Unable to add new user", 0, $ex);
+        }
+    }
+    
+    /**
+     * Function to delete existing user
+     * 
+     * @param string $username
+     * @return void
+     * @throws Exception
+     */
+    public function deleteUser($username) {
+        try {
+            $this->userStoreManager->deleteUser($username);
+        } catch (Exception $ex) {
+            throw new Exception("Unable to delete user", 0, $ex);
+        }
+    }
+
+    
+    /**
+     * Function to authenticate user
+     * 
+     * @param string $username
+     * @param string $password
+     * @return boolean
+     * @throws Exception
+     */
+    public function authenticate($username, $password){
+        try {
+            return $this->userStoreManager->authenticate($username, $password);
+        } catch (Exception $ex) {
+            var_dump( $ex); exit;
+            throw new Exception("Unable to authenticate user", 0, $ex);
+        }
+    }
+    
+    /**
+     * Function to check whether username exists
+     * 
+     * @param string $username
+     * @return boolean
+     * @throws Exception
+     */
+    public function username_exists($username){
+        try {
+            return $this->userStoreManager->isExistingUser($username);
+        } catch (Exception $ex) {
+            throw new Exception("Unable to verify username exists", 0, $ex);
+        }
+    }
+
+    /**
+     * Function to check whether a role is existing 
+     *
+     * @param string $roleName 
+     * @return IsExistingRoleResponse
+     */
+    public function is_existing_role( $roleName){
+        try {
+            return $this->userStoreManager->isExistingRole( $roleName);
+        } catch (Exception $ex) {
+            throw new Exception("Unable to check if the role exists", 0, $ex);
+        }
+    }
+
+    /**
+     * Function to add new role by providing the role name.
+     * 
+     * @param string $roleName
+     */
+    public function add_role($roleName){
+        try {
+            return $this->userStoreManager->addRole( $roleName);
+        } catch (Exception $ex) {
+            throw new Exception("Unable to add this role", 0, $ex);
+        }
+    }
+    
+    /**
+    * Function to get the list of all existing roles
+    *
+    * @return roles list
+    */
+    public function get_all_roles(){
+        try {
+            return $this->userStoreManager->getRoleNames();
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get all roles", 0, $ex);
+        }
+    }
+
+    /**
+    * Function to get role of a user
+    *
+    * @return user role
+    */
+    public function get_user_roles( $username){
+        try {
+            return $this->userStoreManager->getRoleListOfUser( $username);
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get User roles.", 0, $ex);
+        }
+    }
+
+    /**
+     * Function to get the user list of role
+     *
+     * @param GetUserListOfRole $parameters
+     * @return GetUserListOfRoleResponse
+     */
+    public function get_userlist_of_role( $role){
+        try {
+            return $this->userStoreManager->getRoleListOfUser( $role);
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get user list of roles.", 0, $ex);
+        }   
+    }
+
+    /**
+     * Function to update role list of user 
+     *
+     * @param UpdateRoleListOfUser $parameters
+     * @return void
+     */
+    public function update_user_roles( $username, $roles){
+        try {
+            return $this->userStoreManager->updateRoleListOfUser( $username, $roles);
+        } catch (Exception $ex) {
+            throw new Exception("Unable to update role of the user.", 0, $ex);
+        }
+    }
+
+    /**
+     * Function to list users
+     *
+     * @param void
+     * @return void
+     */
+    public function list_users(){
+        try {
+            return $this->userStoreManager->listUsers();
+        } catch (Exception $ex) {
+            var_dump( $ex->debug_message); 
+            throw new Exception("Unable to list users.", 0, $ex);
+        }
+    }
+
+    /**
+     * Function to get the tenant id
+     *
+     * @param GetTenantId $parameters
+     * @return GetTenantIdResponse
+     */
+    public function get_tenant_id(){
+        try {
+            return $this->userStoreManager->getTenantId();
+        } catch (Exception $ex) {
+            var_dump( $ex->debug_message); 
+            throw new Exception("Unable to get the tenant Id.", 0, $ex);
+        }
+    }
+
+    /**
+    * Function create a new Tenant
+    *
+    * @param Tenant $parameters
+    * @return void
+    */
+    public function create_tenant( $inputs){
+        try {
+            return $this->userStoreManager->createTenant( $inputs);
+        } catch (Exception $ex) {
+            var_dump( $ex); 
+            throw new Exception("Unable to create Tenant.", 0, $ex);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/id_utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/id_utilities.php b/app/libraries/id_utilities.php
new file mode 100755
index 0000000..9db7450
--- /dev/null
+++ b/app/libraries/id_utilities.php
@@ -0,0 +1,172 @@
+<?php
+/**
+ * Interface for ID management
+ */
+
+interface IdUtilities
+{
+    /**
+     * Connect to the user database.
+     * @return mixed|void
+     */
+    public function connect();
+
+    /**
+     * Return true if the given username exists in the database.
+     * @param $username
+     * @return bool
+     */
+    public function username_exists($username);
+
+    /**
+     * Authenticate user given username and password.
+     * @param $username
+     * @param $password
+     * @return int|mixed
+     */
+    public function authenticate($username, $password);
+
+    /**
+     * Create new user
+     *
+     * @param $username
+     * @param $password
+     * @param $first_name
+     * @param $last_name
+     * @param $email
+     * @param $organization
+     * @param $address
+     * @param $country
+     * @param $telephone
+     * @param $mobile
+     * @param $im
+     * @param $url
+     * @return mixed
+     */
+    public function add_user($username, $password, $first_name, $last_name, $email, $organization,
+            $address, $country,$telephone, $mobile, $im, $url);
+
+    /**
+     * Function to remove an existing user
+     *
+     * @param $username
+     * @return void
+     */
+    public function remove_user($username);
+
+    /**
+     * Get the user profile
+     * @param $username
+     * @return mixed|void
+     */
+    public function get_user_profile($username);
+
+    /**
+     * Update the user profile
+     *
+     * @param $username
+     * @param $first_name
+     * @param $last_name
+     * @param $email
+     * @param $organization
+     * @param $address
+     * @param $country
+     * @param $telephone
+     * @param $mobile
+     * @param $im
+     * @param $url
+     * @return mixed
+     */
+    public function update_user_profile($username, $first_name, $last_name, $email, $organization, $address,
+        $country, $telephone, $mobile, $im, $url);
+
+    /**
+     * Function to update user password
+     *
+     * @param $username
+     * @param $current_password
+     * @param $new_password
+     * @return mixed
+     */
+    public function change_password($username, $current_password, $new_password);
+
+    /**
+     * Function to check whether a user has permission for a particular permission string(api method).
+     *
+     * @param $username
+     * @param $permission_string
+     * @return bool
+     */
+    public function checkPermissionForUser($username, $permission_string);
+
+    /**
+     * Function to get all the permissions that a particular user has.
+     *
+     * @param $username
+     * @return mixed
+     */
+    public function getUserPermissions($username);
+
+    /**
+     * Function to get the entire list of roles in the application
+     *
+     * @return mixed
+     */
+    public function getRoleNames();
+    
+    /**
+     * Function to check whether a role is existing 
+     *
+     * @param string $roleName 
+     * @return IsExistingRoleResponse
+     */
+    public function isExistingRole( $roleName);
+
+    /**
+     * Function to add new role by providing the role name.
+     * 
+     * @param string $roleName
+     */
+    public function addRole($roleName);
+
+    /**
+     * Function to get the role list of a user
+     *
+     * @param $username
+     * @return mixed
+     */
+    public function getRoleListOfUser($username);
+    /**
+     * Function to update role list of user 
+     *
+     * @param UpdateRoleListOfUser $parameters
+     * @return void
+     */
+    public function updateRoleListOfUser( $username, $roles);
+
+    /**
+     * Function to get the user list of a particular role
+     *
+     * @param $role
+     * @return mixed
+     */
+    public function getUserListOfRole($role);
+
+    /**
+     * Function to add a role to a user
+     *
+     * @param $username
+     * @param $role
+     * @return void
+     */
+    public function addUserToRole($username, $role);
+
+    /**
+     * Function to role from user
+     *
+     * @param $username
+     * @param $role
+     * @return void
+     */
+    public function removeUserFromRole($username, $role);
+} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/userapi_config.ini
----------------------------------------------------------------------
diff --git a/app/libraries/userapi_config.ini b/app/libraries/userapi_config.ini
new file mode 100755
index 0000000..ad96b5d
--- /dev/null
+++ b/app/libraries/userapi_config.ini
@@ -0,0 +1,14 @@
+;Tenant admin's username
+admin-username = "admin@phprg.scigap.org"
+
+;Tenant admin's password
+admin-password = "prodphprgadmin@scigap.org"
+
+;user api server host
+server-host = "gw127.iu.xsede.org"
+
+;user api server port
+server-port = "9930"
+
+;thrift transport timeout
+thrift-timeout = "5000"

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/userapi_utilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/userapi_utilities.php b/app/libraries/userapi_utilities.php
new file mode 100755
index 0000000..31cf1f7
--- /dev/null
+++ b/app/libraries/userapi_utilities.php
@@ -0,0 +1,394 @@
+<?php
+/**
+ * Basic Airavata UserAPI utility functions
+ */
+/**
+ * Import Thrift and Airavata
+ */
+/*$GLOBALS['THRIFT_ROOT'] = './lib/Thrift/';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TSocket.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TProtocol.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TBinaryProtocol.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TApplicationException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TProtocolException.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Base/TBase.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TType.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TMessageType.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'Factory/TStringFuncFactory.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/TStringFunc.php';
+require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/Core.php';
+
+$GLOBALS['AIRAVATA_ROOT'] = './lib/Airavata/';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'UserAPI/UserAPI.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'UserAPI/Models/Types.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'UserAPI/Error/Types.php';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'UserAPI/Types.php';
+
+require_once './lib/UserAPIClientFactory.php';
+require_once './id_utilities.php';
+require_once './wsis_utilities.php';
+
+use \Airavata\UserAPI\UserAPIClient;
+use \Airavata\UserAPI\UserAPIClientFactory;
+use \Airavata\UserAPI\Models\UserProfile;
+use \Airavata\UserAPI\Models\APIPermissions;
+use \Airavata\UserAPI\Models\AuthenticationResponse;
+
+/**
+ * Utilities for ID management with Airavata UserAPI*/
+ */
+
+class UserAPIUtilities implements IdUtilities{
+
+    const USER_API_CONFIG_PATH = 'userapi_config.ini';
+
+    /**
+     * UserAPI client
+     *
+     * @var UserAPIClient
+     * @access private
+     */
+    private $userapi_client;
+
+
+    /**
+     * UserAPI client factory
+     *
+     * @var UserAPIClientFactory
+     * @access private
+     */
+    private $userapi_client_factory;
+
+    /**
+     * Path to the user api token file
+     */
+    const USERAPI_TOKEN_DB_PATH = 'userapi_tokens.xml';
+
+    /**
+     * Connect to the identity store.
+     * @return mixed|void
+     */
+    public function connect() {
+        try {
+            global $userapi_config;
+
+            if (file_exists(self::USER_API_CONFIG_PATH)) {
+                $userapi_config = parse_ini_file(self::USER_API_CONFIG_PATH);
+            } else {
+                throw new Exception("Error: Cannot open userapi_config.xml file!");
+            }
+
+            if (!$userapi_config) {
+                throw new Exception('Error: Unable to read userapi_config.xml!');
+            }
+
+            $properties = array();
+            $properties['userapiServerHost'] = $userapi_config['server-host'];
+            $properties['userapiServerPort'] = $userapi_config['server-port'];
+            $properties['thriftTimeout'] = $userapi_config['thrift-timeout'];
+
+            $this->userapi_client_factory = new UserAPIClientFactory($properties);
+            $this->userapi_client = $this->userapi_client_factory->getUserAPIClient();
+            //testing the API
+            $this->userapi_client->getAPIVersion();
+        } catch (Exception $ex) {
+            print_r( $ex); exit;
+            throw new Exception('Unable to instantiate UserAPI client.', 0, NULL);
+        }
+    }
+
+    /**
+     * Return true if the given username exists in the identity server.
+     * @param $username
+     * @return bool
+     */
+    public function username_exists($username) {
+        try{
+            return $this->userapi_client->checkUsernameExists($username,$this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to check whether username exists", 0, NULL);
+        }
+
+    }
+
+    /**
+     * authenticate a given user
+     * @param $username
+     * @param $password
+     * @return boolean
+     */
+    public function authenticate($username, $password) {
+        try{
+            $apiPermissions = $this->userapi_client->authenticateUser($username, $password, $this->getAPIToken());
+            return true;
+        } catch (Exception $ex) {
+            throw new Exception("Unable to authenticate user", 0, NULL);
+        }
+    }
+
+    /**
+     * Add a new user to the identity server.
+     * @param $username
+     * @param $password
+     * @return void
+     */
+    public function add_user($username, $password, $first_name, $last_name, $email, $organization,
+                             $address, $country,$telephone, $mobile, $im, $url) {
+        try{
+            $profile = new UserProfile();
+            $profile->firstName = $first_name;
+            $profile->lastName = $last_name;
+            $profile->emailAddress = $email;
+            $profile->organization = $organization;
+            $profile->address = $address;
+            $profile->country = $country;
+            $profile->telephone = $telephone;
+            $profile->mobile = $mobile;
+            $profile->im = $im;
+            $profile->url = $url;
+
+            $this->userapi_client->createNewUser($username, $password, $profile, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to add new user", 0, NULL);
+        }
+    }
+
+    /**
+     * Get the user profile
+     * @param $username
+     * @return mixed|void
+     */
+    public function get_user_profile($username)
+    {
+        try{
+            $profile_obj = $this->userapi_client->getUserProfile($username, $this->getAPIToken());
+            $profile_arr = array();
+            $profile_arr['first_name'] = $profile_obj->firstName;
+            $profile_arr['last_name'] = $profile_obj->lastName;
+            $profile_arr['email_address'] = $profile_obj->emailAddress;
+            $profile_arr['organization'] = $profile_obj->organization;
+            $profile_arr['address'] = $profile_obj->address;
+            $profile_arr['country'] = $profile_obj->country;
+            $profile_arr['telephone'] = $profile_obj->telephone;
+            $profile_arr['mobile'] = $profile_obj->mobile;
+            $profile_arr['im'] = $profile_obj->im;
+            $profile_arr['url'] = $profile_obj->url;
+            return $profile_arr;
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get user profile", 0, NULL);
+        }
+    }
+
+    /**
+     * Update the user profile
+     *
+     * @param $username
+     * @param $first_name
+     * @param $last_name
+     * @param $email
+     * @param $organization
+     * @param $address
+     * @param $country
+     * @param $telephone
+     * @param $mobile
+     * @param $im
+     * @param $url
+     * @return mixed
+     */
+    public function update_user_profile($username, $first_name, $last_name, $email, $organization, $address,
+                                        $country, $telephone, $mobile, $im, $url)
+    {
+        try{
+            $profile = new UserProfile();
+            $profile->firstName = $first_name;
+            $profile->lastName = $last_name;
+            $profile->emailAddress = $email;
+            $profile->organization = $organization;
+            $profile->address = $address;
+            $profile->country = $country;
+            $profile->telephone = $telephone;
+            $profile->mobile = $mobile;
+            $profile->im = $im;
+            $profile->url = $url;
+            $this->userapi_client->updateUserProfile($username, $profile, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to update user profile", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to update user password
+     *
+     * @param $username
+     * @param $current_password
+     * @param $new_password
+     * @return mixed
+     */
+    public function change_password($username, $current_password, $new_password)
+    {
+        try{
+            $this->userapi_client->updateUserPassword($username, $new_password, $current_password, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to update user password", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to get the API token for the gateway
+     * @throws Exception
+     */
+    private function getAPIToken(){
+        $userapi_token_db = simplexml_load_file(self::USERAPI_TOKEN_DB_PATH);
+        $userapi_config = parse_ini_file(self::USER_API_CONFIG_PATH);
+        $token = $userapi_token_db->userapi_token[0]->token_string;
+        $issue_time = $userapi_token_db->userapi_token[0]->issue_time;
+        $life_time = $userapi_token_db->userapi_token[0]->life_time;
+        if (file_exists(self::USER_API_CONFIG_PATH)) {
+            if(empty($token) || (time()-$issue_time )>($life_time-5000)){
+                $authenticationResponse  = $this->userapi_client->authenticateGateway($userapi_config['admin-username'],
+                    $userapi_config['admin-password']);
+                $userapi_token_db->userapi_token[0]->token_string = $authenticationResponse->accessToken;
+                $token = $authenticationResponse->accessToken;
+                $userapi_token_db->userapi_token[0]->issue_time = time();
+                $userapi_token_db->userapi_token[0]->life_time = $authenticationResponse->expiresIn;
+
+                //Format XML to save indented tree rather than one line
+                $dom = new DOMDocument('1.0');
+                $dom->preserveWhiteSpace = false;
+                $dom->formatOutput = true;
+                $dom->loadXML($userapi_token_db->asXML());
+                $dom->save(self::USERAPI_TOKEN_DB_PATH);
+            }
+        } else {
+            throw new Exception("Error: Cannot open userapi_config.xml file!");
+        }
+        return $token;
+    }
+
+    /**
+     * Function to remove an existing user
+     *
+     * @param $username
+     * @return void
+     */
+    public function remove_user($username)
+    {
+        try{
+            $this->userapi_client->removeUser($username, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to remove user", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to check whether a user has permission for a particular permission string(api method).
+     *
+     * @param $username
+     * @param $permission_string
+     * @return bool
+     */
+    public function checkPermissionForUser($username, $permission_string)
+    {
+        try{
+            return $this->userapi_client->checkPermission($username,$permission_string, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to check permission for user", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to get all the permissions that a particular user has.
+     *
+     * @param $username
+     * @return mixed
+     */
+    public function getUserPermissions($username)
+    {
+        try{
+            $apiPermissions = $this->userapi_client->getUserPermissions($username, $this->getAPIToken());
+            $result['airavata-api'] = $apiPermissions->airavataAPIPermissions;
+            $result['app-catalog'] = $apiPermissions->airavataAppCatalogPermissions;
+            return $result;
+        } catch (Exception $ex) {
+            throw new Exception("Unable add user to role", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to get the entire list of roles in the application
+     *
+     * @return mixed
+     */
+    public function getRoleList()
+    {
+        try{
+            return $this->userapi_client->getAllRoleNames($this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get roles list", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to get the role list of a user
+     *
+     * @param $username
+     * @return mixed
+     */
+    public function getRoleListOfUser($username)
+    {
+        try{
+            return $this->userapi_client->getRoleListOfUser($username, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get role list of user", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to get the user list of a particular role
+     *
+     * @param $role
+     * @return mixed
+     */
+    public function getUserListOfRole($role)
+    {
+        try{
+            return $this->userapi_client->getUserListOfRole($role, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to get user list of role", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to add a role to a user
+     *
+     * @param $username
+     * @param $role
+     * @return mixed
+     */
+    public function addUserToRole($username, $role)
+    {
+        try{
+            return $this->userapi_client->addUserToRole($username,$role, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to add user to role", 0, NULL);
+        }
+    }
+
+    /**
+     * Function to role from user
+     *
+     * @param $username
+     * @param $role
+     * @return mixed
+     */
+    public function removeUserFromRole($username, $role)
+    {
+        try{
+            return $this->userapi_client->removeUserFromRole($username,$role, $this->getAPIToken());
+        } catch (Exception $ex) {
+            throw new Exception("Unable to remove user from role", 0, NULL);
+        }
+    }
+}