php-cloudfiles
[ class tree: php-cloudfiles ] [ index: php-cloudfiles ] [ all elements ]

Class: CF_Authentication

Source Location: /cloudfiles.php

Class Overview


Class for handling Cloud Files Authentication, call it's authenticate() method to obtain authorized service urls and an authentication token.


Variables

Methods



Class Details

[line 114]
Class for handling Cloud Files Authentication, call it's authenticate() method to obtain authorized service urls and an authentication token.

Example:

  1.  # Create the authentication instance
  2.  #
  3.  $auth new CF_Authentication("username""api_key");
  4.  
  5.  # NOTE: For UK Customers please specify your AuthURL Manually
  6.  # There is a Predfined constant to use EX:
  7.  #
  8.  # $auth = new CF_Authentication("username, "api_key", NULL, UK_AUTHURL);
  9.  # Using the UK_AUTHURL keyword will force the api to use the UK AuthUrl.
  10.  # rather then the US one. The NULL Is passed for legacy purposes and must
  11.  # be passed to function correctly.
  12.  
  13.  # NOTE: Some versions of cURL include an outdated certificate authority (CA)
  14.  #       file.  This API ships with a newer version obtained directly from
  15.  #       cURL's web site (http://curl.haxx.se).  To use the newer CA bundle,
  16.  #       call the CF_Authentication instance's 'ssl_use_cabundle()' method.
  17.  #
  18.  # $auth->ssl_use_cabundle(); # bypass cURL's old CA bundle
  19.  
  20.  # Perform authentication request
  21.  #
  22.  $auth->authenticate();




[ Top ]


Class Variables

$account =

[line 120]



Tags:

access:  public

Type:   mixed


[ Top ]

$api_key =

[line 118]



Tags:

access:  public

Type:   mixed


[ Top ]

$auth_host =

[line 119]



Tags:

access:  public

Type:   mixed


[ Top ]

$auth_token =

[line 127]



Tags:

access:  public

Type:   mixed


[ Top ]

$cdnm_url =

[line 126]



Tags:

access:  public

Type:   mixed


[ Top ]

$dbug =

[line 116]



Tags:

access:  public

Type:   mixed


[ Top ]

$storage_url =

[line 125]

Instance variables that are set after successful authentication



Tags:

access:  public

Type:   mixed


[ Top ]

$username =

[line 117]



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor __construct [line 137]

CF_Authentication __construct( [string $username = NULL], [string $api_key = NULL], [string $account = NULL], [string $auth_host = US_AUTHURL])

Class constructor (PHP 5 syntax)



Parameters:

string   $username   Mosso username
string   $api_key   Mosso API Access Key
string   $account   Account name
string   $auth_host   Authentication service URI

[ Top ]

method authenticate [line 202]

boolean authenticate( [string $version = DEFAULT_CF_API_VERSION])

Attempt to validate Username/API Access Key

Attempts to validate credentials with the authentication service. It either returns True or throws an Exception. Accepts a single (optional) argument for the storage system API version.

Example:

  1.  # Create the authentication instance
  2.  #
  3.  $auth new CF_Authentication("username""api_key");
  4.  
  5.  # Perform authentication request
  6.  #
  7.  $auth->authenticate();




Tags:

return:  True if successfully authenticated
throws:  AuthenticationException invalid credentials
throws:  InvalidResponseException invalid response


Parameters:

string   $version   API version for Auth service (optional)

[ Top ]

method authenticated [line 292]

boolean authenticated( )

Make sure the CF_Authentication instance has authenticated.

Ensures that the instance variables necessary to communicate with Cloud Files have been set from a previous authenticate() call.




Tags:

return:  True if successfully authenticated


[ Top ]

method export_credentials [line 273]

array export_credentials( )

Grab Cloud Files info to be Cached for later use with the load_cached_credentials method.

Example:

  1.  #Create an Auth instance
  2.  $auth new CF_Authentication("UserName","API_Key");
  3.  $auth->authenticate();
  4.  $array $auth->export_credentials();




Tags:

return:  of url's and an auth token.


[ Top ]

method load_cached_credentials [line 242]

boolean load_cached_credentials( string $auth_token, string $storage_url, string $cdnm_url)

Use Cached Token and Storage URL's rather then grabbing from the Auth System

Example:

  1.  #Create an Auth instance
  2.  $auth new CF_Authentication();
  3.  #Pass Cached URL's and Token as Args
  4.  $auth->load_cached_credentials("auth_token""storage_url""cdn_management_url");




Tags:

return:  True if successful
throws:  SyntaxException If any of the Required Arguments are missing


Parameters:

string   $auth_token   A Cloud Files Auth Token (Required)
string   $storage_url   The Cloud Files Storage URL (Required)
string   $cdnm_url   CDN Management URL (Required)

[ Top ]

method setDebug [line 303]

void setDebug( $bool)

Toggle debugging - set cURL verbose flag



Parameters:

   $bool  

[ Top ]

method ssl_use_cabundle [line 174]

void ssl_use_cabundle( [string $path = NULL])

Use the Certificate Authority bundle included with this API

Most versions of PHP with cURL support include an outdated Certificate Authority (CA) bundle (the file that lists all valid certificate signing authorities). The SSL certificates used by the Cloud Files storage system are perfectly valid but have been created/signed by a CA not listed in these outdated cURL distributions.

As a work-around, we've included an updated CA bundle obtained directly from cURL's web site (http://curl.haxx.se). You can direct the API to use this CA bundle by calling this method prior to making any remote calls. The best place to use this method is right after the CF_Authentication instance has been instantiated.

You can specify your own CA bundle by passing in the full pathname to the bundle. You can use the included CA bundle by leaving the argument blank.




Parameters:

string   $path   Specify path to CA bundle (default to included)

[ Top ]


Documentation generated on Wed, 07 Sep 2011 15:19:54 -0500 by phpDocumentor 1.4.3