Zend Framework  1.12
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zend_OpenId_Consumer Class Reference

Public Member Functions

 __construct (Zend_OpenId_Consumer_Storage $storage=null, $dumbMode=false)
 Constructs a Zend_OpenId_Consumer object with given $storage.
 
 login ($id, $returnTo=null, $root=null, $extensions=null, Zend_Controller_Response_Abstract $response=null)
 Performs check (with possible user interaction) of OpenID identity.
 
 check ($id, $returnTo=null, $root=null, $extensions=null, Zend_Controller_Response_Abstract $response=null)
 Performs immediate check (without user interaction) of OpenID identity.
 
 verify ($params, &$identity="", $extensions=null)
 Verifies authentication response from OpenID server.
 
 setHttpClient ($client)
 Sets HTTP client object to make HTTP requests.
 
 getHttpClient ()
 Returns HTTP client object that will be used to make HTTP requests.
 
 setSession (Zend_Session_Namespace $session)
 Sets session object to store climed_id.
 
 getSession ()
 Returns session object that is used to store climed_id.
 
 getError ()
 Returns error message that explains failure of login, check or verify.
 

Protected Member Functions

 _addAssociation ($url, $handle, $macFunc, $secret, $expires)
 Store assiciation in internal chace and external storage.
 
 _getAssociation ($url, &$handle, &$macFunc, &$secret, &$expires)
 Retrive assiciation information for given $url from internal cahce or external storage.
 
 _httpRequest ($url, $method= 'GET', array $params=array(), &$status=null)
 Performs HTTP request to given $url using given HTTP $method.
 
 _associate ($url, $version, $priv_key=null)
 Create (or reuse existing) association between OpenID consumer and OpenID server based on Diffie-Hellman key agreement.
 
 _discovery (&$id, &$server, &$version)
 Performs discovery of identity and finds OpenID URL, OpenID server URL and OpenID protocol version.
 
 _checkId ($immediate, $id, $returnTo=null, $root=null, $extensions=null, Zend_Controller_Response_Abstract $response=null)
 Performs check of OpenID identity.
 
 _setError ($message)
 Saves error message.
 

Protected Attributes

 $_signParams = array('op_endpoint', 'return_to', 'response_nonce', 'assoc_handle')
 Parameters required for signature.
 
 $_storage = null
 Reference to an implementation of storage object.
 
 $_dumbMode = false
 Enables or disables consumer to use association with server based on Diffie-Hellman key agreement.
 
 $_cache = array()
 Internal cache to prevent unnecessary access to storage.
 

Constructor & Destructor Documentation

__construct ( Zend_OpenId_Consumer_Storage  $storage = null,
  $dumbMode = false 
)

Constructs a Zend_OpenId_Consumer object with given $storage.

Enables or disables future association with server based on Diffie-Hellman key agreement.

Parameters
Zend_OpenId_Consumer_Storage$storageimplementation of custom storage object
bool$dumbModeEnables or disables consumer to use association with server based on Diffie-Hellman key agreement

Member Function Documentation

_addAssociation (   $url,
  $handle,
  $macFunc,
  $secret,
  $expires 
)
protected

Store assiciation in internal chace and external storage.

Parameters
string$urlOpenID server url
string$handleassociation handle
string$macFuncHMAC function (sha1 or sha256)
string$secretshared secret
integer$expiresexpiration UNIX time
Returns
void
_associate (   $url,
  $version,
  $priv_key = null 
)
protected

Create (or reuse existing) association between OpenID consumer and OpenID server based on Diffie-Hellman key agreement.

Returns true on success and false on failure.

Parameters
string$urlOpenID server url
float$versionOpenID protocol version
string$priv_keyfor testing only
Returns
bool
_checkId (   $immediate,
  $id,
  $returnTo = null,
  $root = null,
  $extensions = null,
Zend_Controller_Response_Abstract  $response = null 
)
protected

Performs check of OpenID identity.

This is the first step of OpenID authentication process. On success the function does not return (it does HTTP redirection to server and exits). On failure it returns false.

Parameters
bool$immediateenables or disables interaction with user
string$idOpenID identity
string$returnToHTTP URL to redirect response from server to
string$rootHTTP URL to identify consumer on server
mixed$extensionsextension object or array of extensions objects
Zend_Controller_Response_Abstract$responsean optional response object to perform HTTP or HTML form redirection
Returns
bool
_discovery ( $id,
$server,
$version 
)
protected

Performs discovery of identity and finds OpenID URL, OpenID server URL and OpenID protocol version.

Returns true on succees and false on failure.

Parameters
string&$idOpenID identity URL
string&$serverOpenID server URL
float&$versionOpenID protocol version
Returns
bool
Todo:
OpenID 2.0 (7.3) XRI and Yadis discovery
_getAssociation (   $url,
$handle,
$macFunc,
$secret,
$expires 
)
protected

Retrive assiciation information for given $url from internal cahce or external storage.

Parameters
string$urlOpenID server url
string&$handleassociation handle
string&$macFuncHMAC function (sha1 or sha256)
string&$secretshared secret
integer&$expiresexpiration UNIX time
Returns
void
_httpRequest (   $url,
  $method = 'GET',
array  $params = array(),
$status = null 
)
protected

Performs HTTP request to given $url using given HTTP $method.

Send additinal query specified by variable/value array, On success returns HTTP response without headers, false on failure.

Parameters
string$urlOpenID server url
string$methodHTTP request method 'GET' or 'POST'
array$paramsadditional qwery parameters to be passed with
int&$stausHTTP status code request
Returns
mixed
_setError (   $message)
protected

Saves error message.

Parameters
string$messageerror message
check (   $id,
  $returnTo = null,
  $root = null,
  $extensions = null,
Zend_Controller_Response_Abstract  $response = null 
)

Performs immediate check (without user interaction) of OpenID identity.

This is the first step of OpenID authentication process. On success the function does not return (it does HTTP redirection to server and exits). On failure it returns false.

Parameters
string$idOpenID identity
string$returnToHTTP URL to redirect response from server to
string$rootHTTP URL to identify consumer on server
mixed$extensionsextension object or array of extensions objects
Zend_Controller_Response_Abstract$responsean optional response object to perform HTTP or HTML form redirection
Returns
bool
getError ( )

Returns error message that explains failure of login, check or verify.

Returns
string
getHttpClient ( )

Returns HTTP client object that will be used to make HTTP requests.

Returns
Zend_Http_Client
getSession ( )

Returns session object that is used to store climed_id.

Returns
Zend_Session_Namespace
login (   $id,
  $returnTo = null,
  $root = null,
  $extensions = null,
Zend_Controller_Response_Abstract  $response = null 
)

Performs check (with possible user interaction) of OpenID identity.

This is the first step of OpenID authentication process. On success the function does not return (it does HTTP redirection to server and exits). On failure it returns false.

Parameters
string$idOpenID identity
string$returnToURL to redirect response from server to
string$rootHTTP URL to identify consumer on server
mixed$extensionsextension object or array of extensions objects
Zend_Controller_Response_Abstract$responsean optional response object to perform HTTP or HTML form redirection
Returns
bool
setHttpClient (   $client)

Sets HTTP client object to make HTTP requests.

Parameters
Zend_Http_Client$clientHTTP client object to be used
setSession ( Zend_Session_Namespace  $session)

Sets session object to store climed_id.

Parameters
Zend_Session_Namespace$sessionHTTP client object to be used
verify (   $params,
$identity = "",
  $extensions = null 
)

Verifies authentication response from OpenID server.

This is the second step of OpenID authentication process. The function returns true on successful authentication and false on failure.

Parameters
array$paramsHTTP query data from OpenID server
string&$identitythis argument is set to end-user's claimed identifier or OpenID provider local identifier.
mixed$extensionsextension object or array of extensions objects
Returns
bool

Member Data Documentation

array $_cache = array()
protected

Internal cache to prevent unnecessary access to storage.

Zend_OpenId_Consumer_Storage $_dumbMode = false
protected

Enables or disables consumer to use association with server based on Diffie-Hellman key agreement.

$_signParams = array('op_endpoint', 'return_to', 'response_nonce', 'assoc_handle')
protected

Parameters required for signature.

Zend_OpenId_Consumer_Storage $_storage = null
protected

Reference to an implementation of storage object.