aboutsummaryrefslogtreecommitdiff
path: root/migrations/postgresql
diff options
context:
space:
mode:
author0x0fbc <[email protected]>2024-07-24 09:50:35 -0500
committerGitHub <[email protected]>2024-07-24 16:50:35 +0200
commitb4b2701905752f90080dd46ba10a90c5c584a38e (patch)
tree5e24bde1efd339e8401451e49a945319238be60b /migrations/postgresql
parentde66e56b6c951192bcb47987b34ac21e2bcea43a (diff)
downloadvaultwarden-b4b2701905752f90080dd46ba10a90c5c584a38e.tar.gz
vaultwarden-b4b2701905752f90080dd46ba10a90c5c584a38e.zip
Add support for MFA with Duo's Universal Prompt (#4637)
* Add initial working Duo Universal Prompt support. * Add db schema and models for Duo 2FA state storage * store duo states in the database and validate during authentication * cleanup & comments * bump state/nonce length * replace stray use of TimeDelta * more cleanup * bind Duo oauth flow to device id, drop redundant device type handling * drop redundant alphanum string generation code * error handling cleanup * directly use JWT_VALIDITY_SECS constant instead of copying it to DuoClient instances * remove redundant explicit returns, rustfmt * rearrange constants, update comments, error message * override charset on duo state column to ascii for mysql * Reduce twofactor_duo_ctx state/nonce column size in postgres and maria * Add fixes suggested by clippy * rustfmt * Update to use the make_http_request * Don't handle OrganizationDuo * move Duo API endpoint fmt strings out of macros and into format! calls * Add missing indentation Co-authored-by: Daniel García <[email protected]> * remove redundant expiry check when purging Duo contexts --------- Co-authored-by: BlackDex <[email protected]> Co-authored-by: Daniel García <[email protected]>
Diffstat (limited to 'migrations/postgresql')
-rw-r--r--migrations/postgresql/2024-06-05-131359_add_2fa_duo_store/down.sql1
-rw-r--r--migrations/postgresql/2024-06-05-131359_add_2fa_duo_store/up.sql8
2 files changed, 9 insertions, 0 deletions
diff --git a/migrations/postgresql/2024-06-05-131359_add_2fa_duo_store/down.sql b/migrations/postgresql/2024-06-05-131359_add_2fa_duo_store/down.sql
new file mode 100644
index 00000000..0b5d4cd8
--- /dev/null
+++ b/migrations/postgresql/2024-06-05-131359_add_2fa_duo_store/down.sql
@@ -0,0 +1 @@
+DROP TABLE twofactor_duo_ctx;
diff --git a/migrations/postgresql/2024-06-05-131359_add_2fa_duo_store/up.sql b/migrations/postgresql/2024-06-05-131359_add_2fa_duo_store/up.sql
new file mode 100644
index 00000000..ebc8be1b
--- /dev/null
+++ b/migrations/postgresql/2024-06-05-131359_add_2fa_duo_store/up.sql
@@ -0,0 +1,8 @@
+CREATE TABLE twofactor_duo_ctx (
+ state VARCHAR(64) NOT NULL,
+ user_email VARCHAR(255) NOT NULL,
+ nonce VARCHAR(64) NOT NULL,
+ exp BIGINT NOT NULL,
+
+ PRIMARY KEY (state)
+); \ No newline at end of file