summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-05-27 16:07:21 -0400
committerEvan Prodromou <evan@prodromou.name>2008-05-27 16:07:21 -0400
commit9977591b78210bcd200376e1476809db12384f2e (patch)
treef38089e726d1799951de298f59c962a42a21f48c /db
parent90b4873a00b0d8b4249a323fc84a7460024f491b (diff)
server-side storage model
First pass at a server-side storage model. New tables for consumers, tokens, and nonces, with associated classes. An OAuthDataStore class interfaces with the OAuth.php library to enable server logic. Some additional work to get pretty-OK random number generation into the utilities library. Use /dev/urandom if available; else use mt_rand(). darcs-hash:20080527200721-84dde-308c047af2ebc2c4d753c1e1e24af20fef862a7e.gz
Diffstat (limited to 'db')
-rw-r--r--db/stoica.sql36
1 files changed, 36 insertions, 0 deletions
diff --git a/db/stoica.sql b/db/stoica.sql
index 6a460b350..97f56bd15 100644
--- a/db/stoica.sql
+++ b/db/stoica.sql
@@ -76,4 +76,40 @@ create table notice (
modified timestamp comment 'date this record was modified',
index notice_profile_id_idx (profile_id)
+);
+
+/* tables for OAuth */
+
+create table consumer (
+ consumer_key varchar(255) primary key comment 'unique identifier, root URL',
+ seed char(32) not null comment 'seed for new tokens by this consumer',
+
+ created datetime not null comment 'date this record was created',
+ modified timestamp comment 'date this record was modified'
+);
+
+create table token (
+ consumer_key varchar(255) not null comment 'unique identifier, root URL' references consumer (consumer_key),
+ tok char(32) not null comment 'identifying value',
+ secret char(32) not null comment 'secret value',
+ type tinyint not null default 0 comment 'request or access',
+ state tinyint default 0 comment 'for requests; 0 = initial, 1 = authorized, 2 = used',
+
+ created datetime not null comment 'date this record was created',
+ modified timestamp comment 'date this record was modified',
+
+ constraint primary key (consumer_key, tok)
+);
+
+create table nonce (
+ consumer_key varchar(255) not null comment 'unique identifier, root URL',
+ tok char(32) not null comment 'identifying value',
+ nonce char(32) not null comment 'nonce',
+ ts datetime not null comment 'timestamp sent',
+
+ created datetime not null comment 'date this record was created',
+ modified timestamp comment 'date this record was modified',
+
+ constraint primary key (consumer_key, tok, nonce),
+ constraint foreign key (consumer_key, tok) references token (consumer_key, tok)
); \ No newline at end of file