10 * Require the base class file.
12 require_once "Auth/OpenID/SQLStore.php";
15 * An SQL store that uses MySQL as its backend.
19 class Auth_OpenID_MySQLStore extends Auth_OpenID_SQLStore {
25 $this->sql['nonce_table'] =
26 "CREATE TABLE %s (\n".
27 " server_url VARCHAR(2047) NOT NULL,\n".
28 " timestamp INTEGER NOT NULL,\n".
29 " salt CHAR(40) NOT NULL,\n".
30 " UNIQUE (server_url(255), timestamp, salt)\n".
33 $this->sql['assoc_table'] =
34 "CREATE TABLE %s (\n".
35 " server_url BLOB NOT NULL,\n".
36 " handle VARCHAR(255) NOT NULL,\n".
37 " secret BLOB NOT NULL,\n".
38 " issued INTEGER NOT NULL,\n".
39 " lifetime INTEGER NOT NULL,\n".
40 " assoc_type VARCHAR(64) NOT NULL,\n".
41 " PRIMARY KEY (server_url(255), handle)\n".
44 $this->sql['set_assoc'] =
45 "REPLACE INTO %s (server_url, handle, secret, issued,\n".
46 " lifetime, assoc_type) VALUES (?, ?, !, ?, ?, ?)";
48 $this->sql['get_assocs'] =
49 "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
50 "WHERE server_url = ?";
52 $this->sql['get_assoc'] =
53 "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ".
54 "WHERE server_url = ? AND handle = ?";
56 $this->sql['remove_assoc'] =
57 "DELETE FROM %s WHERE server_url = ? AND handle = ?";
59 $this->sql['add_nonce'] =
60 "INSERT INTO %s (server_url, timestamp, salt) VALUES (?, ?, ?)";
62 $this->sql['clean_nonce'] =
63 "DELETE FROM %s WHERE timestamp < ?";
65 $this->sql['clean_assoc'] =
66 "DELETE FROM %s WHERE issued + lifetime < ?";
72 function blobEncode($blob)
74 return "0x" . bin2hex($blob);