feat(auth): renew sessions with 30-day idle and 90-day absolute limits
This commit is contained in:
@@ -17,7 +17,8 @@ psql <<'SQL'
|
||||
INSERT INTO project_accounts(project,id,google_subject,email)
|
||||
VALUES ('fixture','00000000-0000-0000-0000-000000000001','existing-google','existing@example.invalid');
|
||||
INSERT INTO project_sessions VALUES
|
||||
('existing-session','fixture','00000000-0000-0000-0000-000000000001',now()+interval '1 hour');
|
||||
('existing-session','fixture','00000000-0000-0000-0000-000000000001',now()+interval '1 hour'),
|
||||
('expired-session','fixture','00000000-0000-0000-0000-000000000001',now()-interval '1 hour');
|
||||
SQL
|
||||
psql <<'SQLROLE'
|
||||
CREATE ROLE foundry_fixture LOGIN;
|
||||
@@ -33,6 +34,12 @@ BEGIN
|
||||
JOIN account_identities i ON (i.project,i.account_id)=(a.project,a.id)
|
||||
WHERE s.token_hash='existing-session' AND i.provider='google' AND i.subject='existing-google'
|
||||
) THEN RAISE EXCEPTION 'Existing Google login was lost'; END IF;
|
||||
IF EXISTS (SELECT 1 FROM project_sessions WHERE token_hash='expired-session' AND expires_at>now()) THEN
|
||||
RAISE EXCEPTION 'Migration revived expired session';
|
||||
END IF;
|
||||
IF NOT EXISTS (SELECT 1 FROM project_sessions WHERE token_hash='existing-session' AND absolute_expires_at>now()+interval '89 days') THEN
|
||||
RAISE EXCEPTION 'Missing absolute session deadline';
|
||||
END IF;
|
||||
END $$;
|
||||
BEGIN;
|
||||
INSERT INTO project_accounts(project,id,email) VALUES
|
||||
|
||||
Reference in New Issue
Block a user