diff options
author | tailor <cygnus@janrain.com> | 2007-02-14 22:37:26 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2007-02-14 22:37:26 +0000 |
commit | a01e702b8a34ec0b26ff72e2d5954e54b4880dd7 (patch) | |
tree | e31cc1e022422a51a40ffb1a814bf5a9704e0f00 /Auth/OpenID/SQLStore.php | |
parent | da2ec5feccef42c0004bfde3a286d00336a9b052 (diff) | |
download | php-openid-a01e702b8a34ec0b26ff72e2d5954e54b4880dd7.zip php-openid-a01e702b8a34ec0b26ff72e2d5954e54b4880dd7.tar.gz php-openid-a01e702b8a34ec0b26ff72e2d5954e54b4880dd7.tar.bz2 |
[project @ Removed settings table and auth key code from stores]
Diffstat (limited to 'Auth/OpenID/SQLStore.php')
-rw-r--r-- | Auth/OpenID/SQLStore.php | 87 |
1 files changed, 4 insertions, 83 deletions
diff --git a/Auth/OpenID/SQLStore.php b/Auth/OpenID/SQLStore.php index 6c23932..2f775a1 100644 --- a/Auth/OpenID/SQLStore.php +++ b/Auth/OpenID/SQLStore.php @@ -33,9 +33,8 @@ require_once 'Auth/OpenID/Interface.php'; * logic common to all of the SQL stores. * * The table names used are determined by the class variables - * settings_table_name, associations_table_name, and - * nonces_table_name. To change the name of the tables used, pass new - * table names into the constructor. + * associations_table_name and nonces_table_name. To change the name + * of the tables used, pass new table names into the constructor. * * To create the tables with the proper schema, see the createTables * method. @@ -67,10 +66,6 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { * connection handle or an instance of a subclass of * Auth_OpenID_DatabaseConnection. * - * @param string $settings_table This is an optional parameter to - * specify the name of the table used for this store's settings. - * The default value is 'oid_settings'. - * * @param associations_table: This is an optional parameter to * specify the name of the table used for storing associations. * The default value is 'oid_associations'. @@ -79,13 +74,12 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { * the name of the table used for storing nonces. The default * value is 'oid_nonces'. */ - function Auth_OpenID_SQLStore($connection, $settings_table = null, + function Auth_OpenID_SQLStore($connection, $associations_table = null, $nonces_table = null) { global $__Auth_OpenID_PEAR_AVAILABLE; - $this->settings_table_name = "oid_settings"; $this->associations_table_name = "oid_associations"; $this->nonces_table_name = "oid_nonces"; @@ -112,10 +106,6 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { $this->connection->setFetchMode(DB_FETCHMODE_ASSOC); } - if ($settings_table) { - $this->settings_table_name = $settings_table; - } - if ($associations_table) { $this->associations_table_name = $associations_table; } @@ -213,9 +203,6 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { $this->connection->query(sprintf("DELETE FROM %s", $this->nonces_table_name)); - - $this->connection->query(sprintf("DELETE FROM %s", - $this->settings_table_name)); } /** @@ -229,9 +216,6 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { $required_sql_keys = array( 'nonce_table', 'assoc_table', - 'settings_table', - 'get_auth', - 'create_auth', 'set_assoc', 'get_assoc', 'get_assocs', @@ -267,12 +251,6 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { 'get_assoc', 'get_assocs', 'remove_assoc') - ), - array( - 'value' => $this->settings_table_name, - 'keys' => array('settings_table', - 'get_auth', - 'create_auth') ) ); @@ -308,10 +286,9 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { $this->connection->autoCommit(true); $n = $this->create_nonce_table(); $a = $this->create_assoc_table(); - $s = $this->create_settings_table(); $this->connection->autoCommit(false); - if ($n && $a && $s) { + if ($n && $a) { return true; } else { return false; @@ -336,62 +313,6 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { return true; } - function create_settings_table() - { - if (!$this->tableExists($this->settings_table_name)) { - $r = $this->connection->query($this->sql['settings_table']); - return $this->resultToBool($r); - } - return true; - } - - /** - * @access private - */ - function _get_auth() - { - return $this->connection->getOne($this->sql['get_auth']); - } - - /** - * @access private - */ - function _create_auth($str) - { - return $this->connection->query($this->sql['create_auth'], - array($str)); - } - - function getAuthKey() - { - $value = $this->_get_auth(); - if (!$value) { - $auth_key = - Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN); - - $auth_key_s = $this->blobEncode($auth_key); - $this->_create_auth($auth_key_s); - } elseif ($this->isError($value)) { - trigger_error("Database error: " . $value->userinfo, - E_USER_WARNING); - return null; - } else { - $auth_key_s = $value; - $auth_key = $this->blobDecode($auth_key_s); - } - - $this->connection->commit(); - - if (strlen($auth_key) != $this->AUTH_KEY_LEN) { - $fmt = "Expected %d-byte string for auth key. Got key of length %d"; - trigger_error(sprintf($fmt, $this->AUTH_KEY_LEN, strlen($auth_key)), - E_USER_WARNING); - return null; - } - - return $auth_key; - } - /** * @access private */ |