auth: complete account authorization flows
(cherry picked from commit 04f4527df32ad5c35720cccc41d27fe51549612f)
This commit is contained in:
parent
af41d18478
commit
6dc42942c8
21 changed files with 1780 additions and 50 deletions
14
deploy/migrations/0070_account_auth_srp.down.sql
Normal file
14
deploy/migrations/0070_account_auth_srp.down.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
DROP INDEX IF EXISTS authorizations_user_hash_idx;
|
||||
|
||||
ALTER TABLE account_passwords
|
||||
DROP COLUMN IF EXISTS recovery_code_expires_at,
|
||||
DROP COLUMN IF EXISTS recovery_code,
|
||||
DROP COLUMN IF EXISTS recovery_email,
|
||||
DROP COLUMN IF EXISTS srp_b,
|
||||
DROP COLUMN IF EXISTS srp_b_secret,
|
||||
DROP COLUMN IF EXISTS srp_verifier,
|
||||
DROP COLUMN IF EXISTS srp_id,
|
||||
DROP COLUMN IF EXISTS current_algo_p,
|
||||
DROP COLUMN IF EXISTS current_algo_g,
|
||||
DROP COLUMN IF EXISTS current_algo_salt2,
|
||||
DROP COLUMN IF EXISTS current_algo_salt1;
|
||||
21
deploy/migrations/0070_account_auth_srp.up.sql
Normal file
21
deploy/migrations/0070_account_auth_srp.up.sql
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
-- 0070_account_auth_srp: durable SRP 2FA and authorization management fields.
|
||||
|
||||
ALTER TABLE account_passwords
|
||||
ADD COLUMN IF NOT EXISTS current_algo_salt1 BYTEA NOT NULL DEFAULT ''::bytea,
|
||||
ADD COLUMN IF NOT EXISTS current_algo_salt2 BYTEA NOT NULL DEFAULT ''::bytea,
|
||||
ADD COLUMN IF NOT EXISTS current_algo_g INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS current_algo_p BYTEA NOT NULL DEFAULT ''::bytea,
|
||||
ADD COLUMN IF NOT EXISTS srp_id BIGINT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN IF NOT EXISTS srp_verifier BYTEA NOT NULL DEFAULT ''::bytea,
|
||||
ADD COLUMN IF NOT EXISTS srp_b_secret BYTEA NOT NULL DEFAULT ''::bytea,
|
||||
ADD COLUMN IF NOT EXISTS srp_b BYTEA NOT NULL DEFAULT ''::bytea,
|
||||
ADD COLUMN IF NOT EXISTS recovery_email VARCHAR(256) NOT NULL DEFAULT '',
|
||||
ADD COLUMN IF NOT EXISTS recovery_code VARCHAR(32) NOT NULL DEFAULT '',
|
||||
ADD COLUMN IF NOT EXISTS recovery_code_expires_at TIMESTAMPTZ;
|
||||
|
||||
UPDATE authorizations
|
||||
SET hash = auth_key_id
|
||||
WHERE hash = 0;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS authorizations_user_hash_idx
|
||||
ON authorizations (user_id, hash);
|
||||
Loading…
Add table
Add a link
Reference in a new issue