OpenId/Consumer.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_OpenId
- Subpackage
- Zend_OpenId_Consumer
- Version
- $Id: Consumer.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_OpenId_Consumer
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
array $_cache = array()
array()
Details- Type
- array
\Zend_OpenId_Consumer_Storage $_dumbMode = false
false
Detailsstring $_error = ''
''
Details- Type
- string
\Zend_Session_Namespace $_session = null
null
Details$_signParams = array('op_endpoint', 'return_to', 'response_nonce', 'assoc_handle')
array('op_endpoint', 'return_to', 'response_nonce', 'assoc_handle')
Details- Type
- n/a
Methods
__construct(\Zend_OpenId_Consumer_Storage $storage = null, bool $dumbMode = false) : void
Constructs a Zend_OpenId_Consumer object with given $storage.
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 |
_addAssociation(string $url, string $handle, string $macFunc, string $secret, integer $expires) : void
Store assiciation in internal chace and external storage
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 |
_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.
Name | Type | Description |
---|---|---|
$url | string | OpenID server url |
$version | float | OpenID protocol version |
$priv_key | string | for testing only |
Type | Description |
---|---|
bool |
_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.
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 |
Type | Description |
---|---|
bool |
_discovery( $id, $server, $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.
Name | Type | Description |
---|---|---|
$id | ||
$server | ||
$version |
Type | Description |
---|---|
bool |
- Todo
- OpenID 2.0 (7.3) XRI and Yadis discovery
_getAssociation(string $url, $handle, $macFunc, $secret, $expires) : void
Retrive assiciation information for given $url from internal cahce or external storage
Name | Type | Description |
---|---|---|
$url | string | OpenID server url |
$handle | ||
$macFunc | ||
$secret | ||
$expires |
_httpRequest(string $url, string $method = 'GET', array $params = array(), $status = null) : mixed
Performs HTTP request to given $url using given HTTP $method.
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 |
Type | Description |
---|---|
mixed |
_setError(string $message) : void
Saves error message
Name | Type | Description |
---|---|---|
$message | string | error message |
check(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.
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 |
Type | Description |
---|---|
bool |
getError() : string
Returns error message that explains failure of login, check or verify
Type | Description |
---|---|
string |
getHttpClient() : \Zend_Http_Client
Returns HTTP client object that will be used to make HTTP requests
Type | Description |
---|---|
\Zend_Http_Client |
getSession() : \Zend_Session_Namespace
Returns session object that is used to store climed_id
Type | Description |
---|---|
\Zend_Session_Namespace |
login(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.
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 |
Type | Description |
---|---|
bool |
setHttpClient(\Zend_Http_Client $client) : void
Sets HTTP client object to make HTTP requests
Name | Type | Description |
---|---|---|
$client | \Zend_Http_Client | HTTP client object to be used |
setSession(\Zend_Session_Namespace $session) : void
Sets session object to store climed_id
Name | Type | Description |
---|---|---|
$session | \Zend_Session_Namespace | HTTP client object to be used |
verify(array $params, $identity = "", mixed $extensions = null) : bool
Verifies authentication response from OpenID server.
Name | Type | Description |
---|---|---|
$params | array | HTTP query data from OpenID server |
$identity | ||
$extensions | mixed | extension object or array of extensions objects |
Type | Description |
---|---|
bool |