File indexing completed on 2025-01-19 05:21:20

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_OpenId
0018  * @subpackage Zend_OpenId_Provider
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * Abstract class to implement external storage for OpenID consumer
0026  *
0027  * @category   Zend
0028  * @package    Zend_OpenId
0029  * @subpackage Zend_OpenId_Provider
0030  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0031  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0032  */
0033 abstract class Zend_OpenId_Provider_Storage
0034 {
0035 
0036     /**
0037      * Stores information about session identified by $handle
0038      *
0039      * @param string $handle assiciation handle
0040      * @param string $macFunc HMAC function (sha1 or sha256)
0041      * @param string $secret shared secret
0042      * @param string $expires expiration UNIX time
0043      * @return void
0044      */
0045     abstract public function addAssociation($handle, $macFunc, $secret, $expires);
0046 
0047     /**
0048      * Gets information about association identified by $handle
0049      * Returns true if given association found and not expired and false
0050      * otherwise
0051      *
0052      * @param string $handle assiciation handle
0053      * @param string &$macFunc HMAC function (sha1 or sha256)
0054      * @param string &$secret shared secret
0055      * @param string &$expires expiration UNIX time
0056      * @return bool
0057      */
0058     abstract public function getAssociation($handle, &$macFunc, &$secret, &$expires);
0059 
0060     /**
0061      * Register new user with given $id and $password
0062      * Returns true in case of success and false if user with given $id already
0063      * exists
0064      *
0065      * @param string $id user identity URL
0066      * @param string $password encoded user password
0067      * @return bool
0068      */
0069     abstract public function addUser($id, $password);
0070 
0071     /**
0072      * Returns true if user with given $id exists and false otherwise
0073      *
0074      * @param string $id user identity URL
0075      * @return bool
0076      */
0077     abstract public function hasUser($id);
0078 
0079     /**
0080      * Verify if user with given $id exists and has specified $password
0081      *
0082      * @param string $id user identity URL
0083      * @param string $password user password
0084      * @return bool
0085      */
0086     abstract public function checkUser($id, $password);
0087 
0088     /**
0089      * Returns array of all trusted/untrusted sites for given user identified
0090      * by $id
0091      *
0092      * @param string $id user identity URL
0093      * @return array
0094      */
0095     abstract public function getTrustedSites($id);
0096 
0097     /**
0098      * Stores information about trusted/untrusted site for given user
0099      *
0100      * @param string $id user identity URL
0101      * @param string $site site URL
0102      * @param mixed $trusted trust data from extensions or just a boolean value
0103      * @return bool
0104      */
0105     abstract public function addSite($id, $site, $trusted);
0106 }