public function authenticateAsUser($username, $password, $tenantId = NULL, $tenantName = NULL) {
    $ops = array(
      'passwordCredentials' => array(
        'username' => $username,
        'password' => $password,
      ),
    );

    // If a tenant ID is provided, added it to the auth array.
    if (!empty($tenantId)) {
      $ops['tenantId'] = $tenantId;
    }
    elseif (!empty($tenantName)) {
      $ops['tenantName'] = $tenantName;
    }


    return $this->authenticate($ops);
  }
public function authenticateAsUser($username, $password, $tenantId = NULL, $tenantName = NULL) {
    $ops = array(
      'passwordCredentials' => array(
        'username' => $username,
        'password' => $password,
      ),
    );

    // If a tenant ID is provided, added it to the auth array.
    if (!empty($tenantId)) {
      $ops['tenantId'] = $tenantId;
    }
    elseif (!empty($tenantName)) {
      $ops['tenantName'] = $tenantName;
    }


    return $this->authenticate($ops);
  }
public function authenticateAsUser ( $ username , $ password , $ tenantId = NULL , $ tenantName = NULL ) { $ ops = array ( 'passwordCredentials' => array ( 'username' => $ username , 'password' => $ password , ) , ) ; // If a tenant ID is provided, added it to the auth array. if ( ! empty ( $ tenantId ) ) { $ ops [ 'tenantId' ] = $ tenantId ; } elseif ( ! empty ( $ tenantName ) ) { $ ops [ 'tenantName' ] = $ tenantName ; } return $ this -> authenticate ( $ ops ) ; }
Authenticate to Identity Services with username, password, and either
tenant ID or tenant Name.

Given a username and password, authenticate to Identity Services.
Identity Services will then issue a token that can be used to access other
services.

If a tenant ID is provided, this will also associate the user with the
given tenant ID. If a tenant Name is provided, this will associate the user
with the given tenant Name. Only the tenant ID or tenant Name needs to be
given, not both.

If no tenant ID or tenant Name is given, it will likely be necessary to
rescope() the request (See also tenants()).

Other authentication methods:

- authenticateAsAccount()
- authenticate()

@param string $username
A valid username.
@param string $password
A password string.
@param string $tenantId
The tenant ID for this account. This can be obtained through the
HPCloud console.
@param string $tenantName
The tenant Name for this account. This can be obtained through the
HPCloud console.
@throws HPCloud::Transport::AuthorizationException
If authentication failed.
@throws HPCloud::Exception
For abnormal network conditions. The message will give an indication as
to the underlying problem.
Authenticate to Identity Services with username password and either tenant ID or tenant Name .