1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00
bitwarden-server/util/MySqlMigrations/Scripts/2022-09-12_00_PasswordlessAuth.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
1.4 KiB
MySQL
Raw Normal View History

[SG-167] Implement Passwordless Authentication via Notifications (#2276) * [SG-549] Commit Initial AuthRequest Repository (#2174) * Model Passwordless * Scaffold database for Passwordless * Implement SQL Repository * [SG-167] Base Passwordless API (#2185) * Implement Passwordless notifications * Implement Controller * Add documentation to BaseRequestValidator * Register AuthRequestRepo * Remove ExpirationDate from the AuthRequest table * [SG-407] Create job to delete expired requests (#2187) * chore: init * remove exp date * fix: log name * [SG-167] Added fingerprint phrase to response model. (#2233) * Remove FailedLoginAttempt logic * Block unknown devices * Add EF Support for passwordless * Got SignalR working for responses * Added delete job method to EF repo * Implement a GetMany API endpoint for AuthRequests * Ran dotnet format * Fix a merge issues * Redated migration scripts * tried sorting sqlproj * Remove FailedLoginAttempts from SQL * Groom Postgres script * Remove extra commas from migration script * Correct isSpent() * [SG-167] Adde identity validation for passwordless requests. Registered IAuthRepository. * [SG-167] Added origin of the request to response model * Use display name for device identifier in response * Add datetime conversions back to postgres migration script * [SG-655] Add anonymous endpoint for checking if a device & user combo match * [review] Consolidate error conditions Co-authored-by: Brandon Maharaj <107377945+BrandonM-Bitwarden@users.noreply.github.com> Co-authored-by: André Filipe da Silva Bispo <andrefsbispo@hotmail.com> Co-authored-by: André Bispo <abispo@bitwarden.com>
2022-09-26 19:21:13 +02:00
START TRANSACTION;
CREATE TABLE `AuthRequest` (
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
`UserId` char(36) COLLATE ascii_general_ci NOT NULL,
`Type` tinyint unsigned NOT NULL,
`RequestDeviceIdentifier` varchar(50) CHARACTER SET utf8mb4 NULL,
`RequestDeviceType` tinyint unsigned NOT NULL,
`RequestIpAddress` varchar(50) CHARACTER SET utf8mb4 NULL,
`RequestFingerprint` longtext CHARACTER SET utf8mb4 NULL,
`ResponseDeviceId` char(36) COLLATE ascii_general_ci NULL,
`AccessCode` varchar(25) CHARACTER SET utf8mb4 NULL,
`PublicKey` longtext CHARACTER SET utf8mb4 NULL,
`Key` longtext CHARACTER SET utf8mb4 NULL,
`MasterPasswordHash` longtext CHARACTER SET utf8mb4 NULL,
`CreationDate` datetime(6) NOT NULL,
`ResponseDate` datetime(6) NULL,
`AuthenticationDate` datetime(6) NULL,
CONSTRAINT `PK_AuthRequest` PRIMARY KEY (`Id`),
CONSTRAINT `FK_AuthRequest_Device_ResponseDeviceId` FOREIGN KEY (`ResponseDeviceId`) REFERENCES `Device` (`Id`),
CONSTRAINT `FK_AuthRequest_User_UserId` FOREIGN KEY (`UserId`) REFERENCES `User` (`Id`) ON DELETE CASCADE
) CHARACTER SET=utf8mb4;
CREATE INDEX `IX_AuthRequest_ResponseDeviceId` ON `AuthRequest` (`ResponseDeviceId`);
CREATE INDEX `IX_AuthRequest_UserId` ON `AuthRequest` (`UserId`);
INSERT INTO `__EFMigrationsHistory` (`MigrationId`, `ProductVersion`)
VALUES ('20220912144222_PasswordlessAuthRequests', '6.0.4');
COMMIT;