web/Zend/OpenId/Provider/Storage.php
changeset 0 4eba9c11703f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/Zend/OpenId/Provider/Storage.php	Mon Dec 13 18:29:26 2010 +0100
@@ -0,0 +1,106 @@
+<?php
+
+/**
+ * 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
+ * @package    Zend_OpenId
+ * @subpackage Zend_OpenId_Provider
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id: Storage.php 20096 2010-01-06 02:05:09Z bkarwin $
+ */
+
+/**
+ * Abstract class to implement external storage for OpenID consumer
+ *
+ * @category   Zend
+ * @package    Zend_OpenId
+ * @subpackage Zend_OpenId_Provider
+ * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+abstract class Zend_OpenId_Provider_Storage
+{
+
+    /**
+     * Stores information about session identified by $handle
+     *
+     * @param string $handle assiciation handle
+     * @param string $macFunc HMAC function (sha1 or sha256)
+     * @param string $secret shared secret
+     * @param string $expires expiration UNIX time
+     * @return void
+     */
+    abstract public function addAssociation($handle, $macFunc, $secret, $expires);
+
+    /**
+     * Gets information about association identified by $handle
+     * Returns true if given association found and not expired and false
+     * otherwise
+     *
+     * @param string $handle assiciation handle
+     * @param string &$macFunc HMAC function (sha1 or sha256)
+     * @param string &$secret shared secret
+     * @param string &$expires expiration UNIX time
+     * @return bool
+     */
+    abstract public function getAssociation($handle, &$macFunc, &$secret, &$expires);
+
+    /**
+     * Register new user with given $id and $password
+     * Returns true in case of success and false if user with given $id already
+     * exists
+     *
+     * @param string $id user identity URL
+     * @param string $password encoded user password
+     * @return bool
+     */
+    abstract public function addUser($id, $password);
+
+    /**
+     * Returns true if user with given $id exists and false otherwise
+     *
+     * @param string $id user identity URL
+     * @return bool
+     */
+    abstract public function hasUser($id);
+
+    /**
+     * Verify if user with given $id exists and has specified $password
+     *
+     * @param string $id user identity URL
+     * @param string $password user password
+     * @return bool
+     */
+    abstract public function checkUser($id, $password);
+
+    /**
+     * Returns array of all trusted/untrusted sites for given user identified
+     * by $id
+     *
+     * @param string $id user identity URL
+     * @return array
+     */
+    abstract public function getTrustedSites($id);
+
+    /**
+     * Stores information about trusted/untrusted site for given user
+     *
+     * @param string $id user identity URL
+     * @param string $site site URL
+     * @param mixed $trusted trust data from extensions or just a boolean value
+     * @return bool
+     */
+    abstract public function addSite($id, $site, $trusted);
+}