OpenID consumer implementation

category Zend
package Zend_OpenId
subpackage Zend_OpenId_Consumer
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Constructs a Zend_OpenId_Consumer object with given $storage.

__construct(\Zend_OpenId_Consumer_Storage $storage = null, boolean $dumbMode = false

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

Parameters

$storage

\Zend_OpenId_Consumer_Storage

implementation of custom storage object

$dumbMode

boolean

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

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

check(string $id, string $returnTo = null, string $root = null, mixed $extensions = null, \Zend_Controller_Response_Abstract $response = null) : boolean

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

$id

string

OpenID identity

$returnTo

string

HTTP URL to redirect response from server to

$root

string

HTTP URL to identify consumer on server

$extensions

mixed

extension object or array of extensions objects

$response

\Zend_Controller_Response_Abstract

an optional response object to perform HTTP or HTML form redirection

Returns

boolean

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

getError() : string

Returns

string

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

getHttpClient() : \Zend_Http_Client

Returns

\Zend_Http_Client

Returns session object that is used to store climed_id

getSession() : \Zend_Session_Namespace

Returns

\Zend_Session_Namespace

Sets HTTP client object to make HTTP requests

setHttpClient(\Zend_Http_Client $client) 

Parameters

$client

\Zend_Http_Client

HTTP client object to be used

Sets session object to store climed_id

setSession(\Zend_Session_Namespace $session) 

Parameters

$session

\Zend_Session_Namespace

HTTP client object to be used

Verifies authentication response from OpenID server.

verify(array $params, $identity = "", mixed $extensions = null) : boolean

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

Parameters

$params

array

HTTP query data from OpenID server

$identity

$extensions

mixed

extension object or array of extensions objects

Returns

boolean

Store assiciation in internal chace and external storage

_addAssociation(string $url, string $handle, string $macFunc, string $secret, integer $expires) : void

Parameters

$url

string

OpenID server url

$handle

string

association handle

$macFunc

string

HMAC function (sha1 or sha256)

$secret

string

shared secret

$expires

integer

expiration UNIX time

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.

_associate(string $url, float $version, string $priv_key = null) : boolean

Parameters

$url

string

OpenID server url

$version

float

OpenID protocol version

$priv_key

string

for testing only

Returns

boolean

Performs check of OpenID identity.

_checkId(boolean $immediate, string $id, string $returnTo = null, string $root = null, mixed $extensions = null, \Zend_Controller_Response_Abstract $response = null) : boolean

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

$immediate

boolean

enables or disables interaction with user

$id

string

OpenID identity

$returnTo

string

HTTP URL to redirect response from server to

$root

string

HTTP URL to identify consumer on server

$extensions

mixed

extension object or array of extensions objects

$response

\Zend_Controller_Response_Abstract

an optional response object to perform HTTP or HTML form redirection

Returns

boolean

Performs discovery of identity and finds OpenID URL, OpenID server URL and OpenID protocol version. Returns true on succees and false on failure.

_discovery($id, $server, $version) : boolean
todo OpenID 2.0 (7.3) XRI and Yadis discovery

Parameters

$id

$server

$version

Returns

boolean

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

_getAssociation(string $url, $handle, $macFunc, $secret, $expires) : void

Parameters

$url

string

OpenID server url

$handle

$macFunc

$secret

$expires

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

_httpRequest(string $url, string $method = 'GET', array $params = array(), $status = null) : mixed

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

Parameters

$url

string

OpenID server url

$method

string

HTTP request method 'GET' or 'POST'

$params

array

additional qwery parameters to be passed with

$status

Returns

mixed

Saves error message

_setError(string $message) 

Parameters

$message

string

error message

 Properties

 

Internal cache to prevent unnecessary access to storage

$_cache : array

Default

array()
 

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

$_dumbMode : \Zend_OpenId_Consumer_Storage

Default

false
 

Parameters required for signature

$_signParams 

Default

array('op_endpoint', 'return_to', 'response_nonce', 'assoc_handle')
 

Reference to an implementation of storage object

$_storage : \Zend_OpenId_Consumer_Storage

Default

null
 

Last error message for logi, check or verify failure

$_error : string

Default

''
 

HTTP client to make HTTP requests

$_httpClient : \Zend_Http_Client

Default

null
 

HTTP session to store climed_id between requests

$_session : \Zend_Session_Namespace

Default

null