API Documentation

Zend/OpenId/Consumer.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_OpenId  
Subpackage
Zend_OpenId_Consumer  
Version
$Id: Consumer.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_OpenId_Consumer

Package: Zend\OpenId\Zend\OpenId\Consumer

OpenID consumer implementation

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotectedarray  $_cache= 'array()'

Internal cache to prevent unnecessary access to storage

Default valuearray()Details
Type
array
Propertyprotected\Zend_OpenId_Consumer_Storage  $_dumbMode= 'false'

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

Default valuefalseDetails
Type
\Zend_OpenId_Consumer_Storage
Propertyprivatestring  $_error= ''''

Last error message for logi, check or verify failure

Default value''Details
Type
string
Propertyprivate\Zend_Http_Client  $_httpClient= 'null'

HTTP client to make HTTP requests

Default valuenullDetails
Type
\Zend_Http_Client
Propertyprivate\Zend_Session_Namespace  $_session= 'null'

HTTP session to store climed_id between requests

Default valuenullDetails
Type
\Zend_Session_Namespace
Propertyprotected\Zend_OpenId_Consumer_Storage  $_storage= 'null'

Reference to an implementation of storage object

Default valuenullDetails
Type
\Zend_OpenId_Consumer_Storage

Methods

methodpublic__construct( \Zend_OpenId_Consumer_Storage $storage = null, bool $dumbMode = false ) : void

Constructs a Zend_OpenId_Consumer object with given $storage.

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

Parameters
Name Type Description
$storage \Zend_OpenId_Consumer_Storage

implementation of custom storage object

$dumbMode bool

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

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

Store assiciation in internal chace and external storage

Parameters
Name Type Description
$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

methodprotected_associate( string $url, float $version, string $priv_key = null ) : bool

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
Name Type Description
$url string

OpenID server url

$version float

OpenID protocol version

$priv_key string

for testing only

Returns
Type Description
bool
methodprotected_checkId( bool $immediate, string $id, string $returnTo = null, string $root = null, mixed $extensions = null, \Zend_Controller_Response_Abstract $response = null ) : bool

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
Name Type Description
$immediate bool

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
Type Description
bool
methodprotected_discovery( string $id, string $server, float $version ) : bool

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

Parameters
Name Type Description
$id string

&$id OpenID identity URL

$server string

&$server OpenID server URL

$version float

&$version OpenID protocol version

Returns
Type Description
bool
Details
Todo
OpenID 2.0 (7.3) XRI and Yadis discovery  
methodprotected_getAssociation( string $url, string $handle, string $macFunc, string $secret, integer $expires ) : void

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

Parameters
Name Type Description
$url string

OpenID server url

$handle string

&$handle association handle

$macFunc string

&$macFunc HMAC function (sha1 or sha256)

$secret string

&$secret shared secret

$expires integer

&$expires expiration UNIX time

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

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
Name Type Description
$url string

OpenID server url

$method string

HTTP request method 'GET' or 'POST'

$params array

additional qwery parameters to be passed with

$status int

&$staus HTTP status code request

Returns
Type Description
mixed
methodprotected_setError( string $message ) : void

Saves error message

Parameters
Name Type Description
$message string

error message

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

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
Name Type Description
$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
Type Description
bool
methodpublicgetError( ) : string

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

Returns
Type Description
string
methodpublicgetHttpClient( ) : \Zend_Http_Client

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

Returns
Type Description
\Zend_Http_Client
methodpublicgetSession( ) : \Zend_Session_Namespace

Returns session object that is used to store climed_id

Returns
Type Description
\Zend_Session_Namespace
methodpubliclogin( string $id, string $returnTo = null, string $root = null, mixed $extensions = null, \Zend_Controller_Response_Abstract $response = null ) : bool

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
Name Type Description
$id string

OpenID identity

$returnTo string

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
Type Description
bool
methodpublicsetHttpClient( \Zend_Http_Client $client ) : void

Sets HTTP client object to make HTTP requests

Parameters
Name Type Description
$client \Zend_Http_Client

HTTP client object to be used

methodpublicsetSession( \Zend_Session_Namespace $session ) : void

Sets session object to store climed_id

Parameters
Name Type Description
$session \Zend_Session_Namespace

HTTP client object to be used

methodpublicverify( array $params, string $identity = "", mixed $extensions = null ) : bool

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
Name Type Description
$params array

HTTP query data from OpenID server

$identity string

&$identity this argument is set to end-user's claimed identifier or OpenID provider local identifier.

$extensions mixed

extension object or array of extensions objects

Returns
Type Description
bool
Documentation was generated by DocBlox 0.15.1.