auth
auth/sql/postgres_init.sql
Implement postgres version of authCodeStore. Create an authCodeStore that keeps data in Postgres. Again, we run into the problem where Scopes can't be stored in Postgres arrays, as discussed in 762953f6a7f2. I wish we could do better, but for now, it will suffice. We also added the postgres authCodeStore to our slice of authCodeStores to test when the correct environment variables are present. Wrote initialization SQL for the tables required by the postgres authCodeStore. Added SQL to the SQL script that empties our database, to properly empty our new tables.
1.1 --- a/sql/postgres_init.sql Tue Apr 07 01:00:26 2015 -0400 1.2 +++ b/sql/postgres_init.sql Tue Apr 07 02:51:13 2015 -0400 1.3 @@ -77,3 +77,20 @@ 1.4 scope VARCHAR(64) NOT NULL, 1.5 PRIMARY KEY(token, scope) 1.6 ); 1.7 + 1.8 +CREATE TABLE IF NOT EXISTS authorization_codes ( 1.9 + code VARCHAR(36) PRIMARY KEY, 1.10 + created TIMESTAMPTZ NOT NULL, 1.11 + expires_in INTEGER NOT NULL, 1.12 + client_id VARCHAR(36) NOT NULL, 1.13 + redirect_uri TEXT NOT NULL, 1.14 + state TEXT NOT NULL, 1.15 + profile_id VARCHAR(36) NOT NULL, 1.16 + used BOOLEAN NOT NULL 1.17 +); 1.18 + 1.19 +CREATE TABLE IF NOT EXISTS authorization_codes_scopes ( 1.20 + code VARCHAR(36) NOT NULL, 1.21 + scope VARCHAR(64) NOT NULL, 1.22 + PRIMARY KEY(code, scope) 1.23 +);