Fixed new problem with identity services and tenant name.

Tenant Name seems to not be supported currently.
This commit is contained in:
Technosophos
2012-08-07 12:29:07 -05:00
parent febebd4b94
commit 06d7cf1a92
2 changed files with 37 additions and 22 deletions

View File

@@ -323,7 +323,7 @@ class IdentityServices /*implements Serializable*/ {
* HPCloud console. * HPCloud console.
* @param string $tenantName * @param string $tenantName
* The tenant Name for this account. This can be obtained through the * The tenant Name for this account. This can be obtained through the
* HPCloud console. * HPCloud console. NOTE: This is currently unused.
* @throws HPCloud::Transport::AuthorizationException * @throws HPCloud::Transport::AuthorizationException
* If authentication failed. * If authentication failed.
* @throws HPCloud::Exception * @throws HPCloud::Exception
@@ -343,10 +343,12 @@ class IdentityServices /*implements Serializable*/ {
$ops['tenantId'] = $tenantId; $ops['tenantId'] = $tenantId;
} }
// Not currently working.
// If a tenant name is provided, add it to the auth array. // If a tenant name is provided, add it to the auth array.
if (!empty($tenantName)) { //if (!empty($tenantName)) {
$ops['tenantName'] = $tenantName; // $ops['tenantName'] = $tenantName;
} //}
return $this->authenticate($ops); return $this->authenticate($ops);
} }
@@ -402,9 +404,9 @@ class IdentityServices /*implements Serializable*/ {
if (!empty($tenantId)) { if (!empty($tenantId)) {
$ops['tenantId'] = $tenantId; $ops['tenantId'] = $tenantId;
} }
if (!empty($tenantName)) { //if (!empty($tenantName)) {
$ops['tenantName'] = $tenantName; // $ops['tenantName'] = $tenantName;
} //}
return $this->authenticate($ops); return $this->authenticate($ops);
} }

View File

@@ -89,8 +89,15 @@ class PHPStreamTransport implements Transporter {
$metadata = stream_get_meta_data($res); $metadata = stream_get_meta_data($res);
if (\HPCloud\Bootstrap::hasConfig('transport.debug')) { if (\HPCloud\Bootstrap::hasConfig('transport.debug')) {
fwrite(STDOUT, implode(PHP_EOL, $metadata['wrapper_data'])); $msg = implode(PHP_EOL, $metadata['wrapper_data']);
fprintf(STDOUT, "\nWaiting to read %d bytes.\n", $metadata['unread_bytes']); $msg .= sprintf("\nWaiting to read %d bytes.\n", $metadata['unread_bytes']);
if (defined('STDOUT')) {
fwrite(STDOUT, $msg);
}
else {
print $msg;
}
} }
$response = new Response($res, $metadata); $response = new Response($res, $metadata);
@@ -250,7 +257,7 @@ class PHPStreamTransport implements Transporter {
} }
// Enable debugging: // Enable debugging:
elseif (\HPCloud\Bootstrap::hasConfig('transport.debug')) { elseif (\HPCloud\Bootstrap::hasConfig('transport.debug')) {
fwrite(STDOUT, "Sending debug messages to STDOUT\n"); //fwrite(STDOUT, "Sending debug messages to STDOUT\n");
$params['notification'] = array($this, 'printNotifications'); $params['notification'] = array($this, 'printNotifications');
} }
@@ -259,42 +266,48 @@ class PHPStreamTransport implements Transporter {
return $context; return $context;
} }
public function printNotifications($code, $severity, $msg, $msgcode, $bytes, $len) { public function printNotifications($code, $severity, $msg, $msgcode, $bytes, $len) {
static $filesize = 'Unknown'; static $filesize = 'Unknown';
switch ($code) { switch ($code) {
case STREAM_NOTIFY_RESOLVE: case STREAM_NOTIFY_RESOLVE:
fprintf(STDOUT, "Resolved. %s\n", $msg); $out = sprintf("Resolved. %s\n", $msg);
break; break;
case STREAM_NOTIFY_FAILURE: case STREAM_NOTIFY_FAILURE:
fprintf(STDOUT, "socket-level failure: %s\n", $msg); $out = sprintf("socket-level failure: %s\n", $msg);
break; break;
case STREAM_NOTIFY_COMPLETED: case STREAM_NOTIFY_COMPLETED:
fprintf(STDOUT, "Transaction complete. %s\n", $msg); $out = sprintf("Transaction complete. %s\n", $msg);
break; break;
//case STREAM_NOTIFY_REDIRECT: //case STREAM_NOTIFY_REDIRECT:
// fprintf(STDOUT, "Redirect... %s\n", $msg); // $out = sprintf("Redirect... %s\n", $msg);
// break; // break;
case STREAM_NOTIFY_CONNECT: case STREAM_NOTIFY_CONNECT:
fprintf(STDOUT, "Connect... %s\n", $msg); $out = sprintf("Connect... %s\n", $msg);
break; break;
case STREAM_NOTIFY_FILE_SIZE_IS: case STREAM_NOTIFY_FILE_SIZE_IS:
fprintf(STDOUT, "Content-length: %d\n", $len); $out = sprintf("Content-length: %d\n", $len);
$filesize = $len; $filesize = $len;
break; break;
case STREAM_NOTIFY_MIME_TYPE_IS: case STREAM_NOTIFY_MIME_TYPE_IS:
fprintf(STDOUT, "Content-Type: %s\n", $msg); $out = sprintf("Content-Type: %s\n", $msg);
break; break;
case STREAM_NOTIFY_PROGRESS: case STREAM_NOTIFY_PROGRESS:
fwrite(STDOUT, $msg . PHP_EOL); fwrite($msg . PHP_EOL);
fprintf(STDOUT, "%d bytes of %s\n", $bytes, $filesize); $out = sprintf("%d bytes of %s\n", $bytes, $filesize);
break; break;
default: default:
fprintf(STDOUT, "Code: %d, Message: %s\n", $code, $msg); $out = sprintf("Code: %d, Message: %s\n", $code, $msg);
break; break;
} }
} // Circumvent output buffering for PHPUnit.
if (defined('STDOUT')) {
fwrite(STDOUT, $out);
}
else {
print $out;
}
}
} }