forked from rackspace/php-opencloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_auth.php
More file actions
31 lines (28 loc) · 887 Bytes
/
test_auth.php
File metadata and controls
31 lines (28 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* (c)2012 Rackspace Hosting. See COPYING for license details
* This script attempts to validate an authentication bug that appears daily.
*
*/
require('php-opencloud.php');
/**
* Relies upon environment variable settings — these are the same environment
* variables that are used by python-novaclient. Just make sure that they're
* set to the right values before running this test.
*/
define('AUTHURL', $_ENV['NOVA_URL']);
define('USERNAME', $_ENV['OS_USERNAME']);
define('TENANT', $_ENV['OS_TENANT_NAME']);
define('APIKEY', $_ENV['NOVA_API_KEY']);
$rackspace = new \OpenCloud\Rackspace(AUTHURL,
array( 'username' => USERNAME,
'apiKey' => APIKEY ));
while(TRUE) {
$rackspace->Authenticate();
$arr = $rackspace->ExportCredentials();
printf("%s Token [%s] expires in %5d seconds\n",
date('r'),
$arr['token'],
$arr['expiration']-time());
sleep(60);
}