1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 23:52:50 -05:00

Remove the u2f lib (#1820)

This commit is contained in:
Oscar Hinton
2022-01-24 12:14:04 +01:00
committed by GitHub
parent 5268f2781e
commit ac8ca46f0f
44 changed files with 3489 additions and 1247 deletions

View File

@ -1,121 +0,0 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Bit.Core.Enums;
using Bit.Core.Models;
using DbUp.Engine;
using Newtonsoft.Json;
namespace Bit.Migrator.DbScripts
{
class ScriptMigrateU2FToWebAuthn : IScript
{
public string ProvideScript(Func<IDbCommand> commandFactory)
{
var cmd = commandFactory();
cmd.CommandText = "SELECT Id, TwoFactorProviders FROM [dbo].[User] WHERE TwoFactorProviders IS NOT NULL";
var users = new List<object>();
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
var id = reader.GetGuid(0);
var twoFactorProviders = reader.GetString(1);
if (string.IsNullOrWhiteSpace(twoFactorProviders))
{
continue;
}
var providers = JsonConvert.DeserializeObject<Dictionary<TwoFactorProviderType, TwoFactorProvider>>(twoFactorProviders);
if (!providers.ContainsKey(TwoFactorProviderType.U2f))
{
continue;
}
var u2fProvider = providers[TwoFactorProviderType.U2f];
if (!u2fProvider.Enabled || !HasProperMetaData(u2fProvider))
{
continue;
}
var u2fKeys = LoadKeys(u2fProvider);
var webAuthnKeys = u2fKeys.Select(key => (key.Item1, key.Item2.ToWebAuthnData()));
var webAuthnProvider = new TwoFactorProvider
{
Enabled = true,
MetaData = webAuthnKeys.ToDictionary(x => x.Item1, x => (object)x.Item2)
};
providers[TwoFactorProviderType.WebAuthn] = webAuthnProvider;
users.Add(new User
{
Id = id,
TwoFactorProviders = JsonConvert.SerializeObject(providers),
});
}
}
foreach (User user in users)
{
var command = commandFactory();
command.CommandText = "UPDATE [dbo].[User] SET TwoFactorProviders = @twoFactorProviders WHERE Id = @id";
var idParameter = command.CreateParameter();
idParameter.ParameterName = "@id";
idParameter.Value = user.Id;
var twoFactorParameter = command.CreateParameter();
twoFactorParameter.ParameterName = "@twoFactorProviders";
twoFactorParameter.Value = user.TwoFactorProviders;
command.Parameters.Add(idParameter);
command.Parameters.Add(twoFactorParameter);
command.ExecuteNonQuery();
}
return "";
}
private bool HasProperMetaData(TwoFactorProvider provider)
{
return (provider?.MetaData?.Count ?? 0) > 0;
}
private List<Tuple<string, TwoFactorProvider.U2fMetaData>> LoadKeys(TwoFactorProvider provider)
{
var keys = new List<Tuple<string, TwoFactorProvider.U2fMetaData>>();
// Support up to 5 keys
for (var i = 1; i <= 5; i++)
{
var keyName = $"Key{i}";
if (provider.MetaData.ContainsKey(keyName))
{
var key = new TwoFactorProvider.U2fMetaData((dynamic)provider.MetaData[keyName]);
if (!key?.Compromised ?? false)
{
keys.Add(new Tuple<string, TwoFactorProvider.U2fMetaData>(keyName, key));
}
}
}
return keys;
}
private class User
{
public Guid Id { get; set; }
public string TwoFactorProviders { get; set; }
}
}
}

View File

@ -0,0 +1,154 @@
IF OBJECT_ID('[dbo].[U2f_Create]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[U2f_Create]
END
GO
IF OBJECT_ID('[dbo].[U2f_DeleteByUserId]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[U2f_DeleteByUserId]
END
GO
IF OBJECT_ID('[dbo].[U2f_DeleteOld]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[U2f_DeleteOld]
END
GO
IF OBJECT_ID('[dbo].[U2f_ReadByUserId]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[U2f_ReadByUserId]
END
GO
IF OBJECT_ID('[dbo].[U2f_ReadById]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[U2f_ReadById]
END
GO
IF EXISTS(SELECT * FROM sys.views WHERE [Name] = 'U2fView')
BEGIN
DROP VIEW [dbo].[U2fView];
END
GO
IF OBJECT_ID('[dbo].[U2f]') IS NOT NULL
BEGIN
DROP TABLE [dbo].[U2f]
END
GO
IF OBJECT_ID('[dbo].[User_DeleteById]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[User_DeleteById]
END
GO
CREATE PROCEDURE [dbo].[User_DeleteById]
@Id UNIQUEIDENTIFIER
WITH RECOMPILE
AS
BEGIN
SET NOCOUNT ON
DECLARE @BatchSize INT = 100
-- Delete ciphers
WHILE @BatchSize > 0
BEGIN
BEGIN TRANSACTION User_DeleteById_Ciphers
DELETE TOP(@BatchSize)
FROM
[dbo].[Cipher]
WHERE
[UserId] = @Id
SET @BatchSize = @@ROWCOUNT
COMMIT TRANSACTION User_DeleteById_Ciphers
END
BEGIN TRANSACTION User_DeleteById
-- Delete folders
DELETE
FROM
[dbo].[Folder]
WHERE
[UserId] = @Id
-- Delete devices
DELETE
FROM
[dbo].[Device]
WHERE
[UserId] = @Id
-- Delete collection users
DELETE
CU
FROM
[dbo].[CollectionUser] CU
INNER JOIN
[dbo].[OrganizationUser] OU ON OU.[Id] = CU.[OrganizationUserId]
WHERE
OU.[UserId] = @Id
-- Delete group users
DELETE
GU
FROM
[dbo].[GroupUser] GU
INNER JOIN
[dbo].[OrganizationUser] OU ON OU.[Id] = GU.[OrganizationUserId]
WHERE
OU.[UserId] = @Id
-- Delete organization users
DELETE
FROM
[dbo].[OrganizationUser]
WHERE
[UserId] = @Id
-- Delete provider users
DELETE
FROM
[dbo].[ProviderUser]
WHERE
[UserId] = @Id
-- Delete SSO Users
DELETE
FROM
[dbo].[SsoUser]
WHERE
[UserId] = @Id
-- Delete Emergency Accesses
DELETE
FROM
[dbo].[EmergencyAccess]
WHERE
[GrantorId] = @Id
OR
[GranteeId] = @Id
-- Delete Sends
DELETE
FROM
[dbo].[Send]
WHERE
[UserId] = @Id
-- Finally, delete the user
DELETE
FROM
[dbo].[User]
WHERE
[Id] = @Id
COMMIT TRANSACTION User_DeleteById
END

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.MySqlMigrations.Migrations
{
public partial class RemoveU2F : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "U2f");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "U2f",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
AppId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
Challenge = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
KeyHandle = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
UserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Version = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_U2f", x => x.Id);
table.ForeignKey(
name: "FK_U2f_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_U2f_UserId",
table: "U2f",
column: "UserId");
}
}
}

View File

@ -15,9 +15,9 @@ namespace Bit.MySqlMigrations.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 64)
.HasAnnotation("ProductVersion", "5.0.9");
.HasAnnotation("ProductVersion", "5.0.12");
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Cipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -64,7 +64,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Cipher");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Collection", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -92,7 +92,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Collection");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionCipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b =>
{
b.Property<Guid>("CollectionId")
.HasColumnType("char(36)");
@ -107,7 +107,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("CollectionCipher");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionGroup", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b =>
{
b.Property<Guid>("CollectionId")
.HasColumnType("char(36)");
@ -128,7 +128,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("CollectionGroups");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b =>
{
b.Property<Guid>("CollectionId")
.HasColumnType("char(36)");
@ -154,7 +154,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("CollectionUsers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Device", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -191,7 +191,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Device");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.EmergencyAccess", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -239,7 +239,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("EmergencyAccess");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Event", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -295,7 +295,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Event");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Folder", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -319,7 +319,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Folder");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Grant", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200)
@ -362,7 +362,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Grant");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Group", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -394,7 +394,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Group");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.GroupUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b =>
{
b.Property<Guid>("GroupId")
.HasColumnType("char(36)");
@ -414,7 +414,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("GroupUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Installation", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -438,7 +438,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Installation");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Organization", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -588,7 +588,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationSponsorship", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -639,7 +639,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("OrganizationSponsorship");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -691,7 +691,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("OrganizationUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Policy", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -721,7 +721,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Policy");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.Provider", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -770,7 +770,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Provider");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderOrganization", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -802,7 +802,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("ProviderOrganization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -843,7 +843,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("ProviderUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Send", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -900,7 +900,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Send");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.SsoConfig", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@ -928,7 +928,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("SsoConfig");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.SsoUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@ -956,7 +956,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("SsoUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.TaxRate", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b =>
{
b.Property<string>("Id")
.HasMaxLength(40)
@ -985,7 +985,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("TaxRate");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Transaction", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -1034,42 +1034,7 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("Transaction");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.U2f", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("AppId")
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("Challenge")
.HasMaxLength(200)
.HasColumnType("varchar(200)");
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime(6)");
b.Property<string>("KeyHandle")
.HasMaxLength(200)
.HasColumnType("varchar(200)");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.Property<string>("Version")
.HasMaxLength(20)
.HasColumnType("varchar(20)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("U2f");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.User", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
@ -1189,13 +1154,13 @@ namespace Bit.MySqlMigrations.Migrations
b.ToTable("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Cipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("Ciphers")
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("Ciphers")
.HasForeignKey("UserId");
@ -1204,9 +1169,9 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Collection", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany()
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
@ -1215,15 +1180,15 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionCipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Cipher", "Cipher")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher")
.WithMany("CollectionCiphers")
.HasForeignKey("CipherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.Collection", "Collection")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection")
.WithMany("CollectionCiphers")
.HasForeignKey("CollectionId")
.OnDelete(DeleteBehavior.Cascade)
@ -1234,15 +1199,15 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Collection");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionGroup", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Collection", "Collection")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection")
.WithMany("CollectionGroups")
.HasForeignKey("CollectionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.Group", "Group")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group")
.WithMany()
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
@ -1253,21 +1218,21 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Group");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Collection", "Collection")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection")
.WithMany("CollectionUsers")
.HasForeignKey("CollectionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.OrganizationUser", "OrganizationUser")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
.WithMany("CollectionUsers")
.HasForeignKey("OrganizationUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.User", null)
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
.WithMany("CollectionUsers")
.HasForeignKey("UserId");
@ -1276,9 +1241,9 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("OrganizationUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Device", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
@ -1287,13 +1252,13 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.EmergencyAccess", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.User", "Grantee")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee")
.WithMany()
.HasForeignKey("GranteeId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "Grantor")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor")
.WithMany()
.HasForeignKey("GrantorId")
.OnDelete(DeleteBehavior.Cascade)
@ -1304,9 +1269,9 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Grantor");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Folder", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("Folders")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
@ -1315,9 +1280,9 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Group", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("Groups")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
@ -1326,21 +1291,21 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.GroupUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Group", "Group")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group")
.WithMany("GroupUsers")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.OrganizationUser", "OrganizationUser")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
.WithMany()
.HasForeignKey("OrganizationUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.User", null)
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
.WithMany("GroupUsers")
.HasForeignKey("UserId");
@ -1349,17 +1314,17 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("OrganizationUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationSponsorship", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Installation", "Installation")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Installation", "Installation")
.WithMany()
.HasForeignKey("InstallationId");
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "SponsoredOrganization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization")
.WithMany()
.HasForeignKey("SponsoredOrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "SponsoringOrganization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization")
.WithMany()
.HasForeignKey("SponsoringOrganizationId");
@ -1370,15 +1335,15 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("SponsoringOrganization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("OrganizationUsers")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("OrganizationUsers")
.HasForeignKey("UserId");
@ -1387,9 +1352,9 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Policy", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("Policies")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
@ -1398,15 +1363,15 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderOrganization", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany()
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.Provider.Provider", "Provider")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderId")
.OnDelete(DeleteBehavior.Cascade)
@ -1417,15 +1382,15 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Provider");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Provider.Provider", "Provider")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId");
@ -1434,13 +1399,13 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Send", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany()
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId");
@ -1449,9 +1414,9 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.SsoConfig", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("SsoConfigs")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
@ -1460,13 +1425,13 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.SsoUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("SsoUsers")
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("SsoUsers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
@ -1477,13 +1442,13 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Transaction", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("Transactions")
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("Transactions")
.HasForeignKey("UserId");
@ -1492,23 +1457,12 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.U2f", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
.WithMany("U2fs")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Cipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
{
b.Navigation("CollectionCiphers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Collection", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
{
b.Navigation("CollectionCiphers");
@ -1517,12 +1471,12 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("CollectionUsers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Group", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b =>
{
b.Navigation("GroupUsers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Organization", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b =>
{
b.Navigation("Ciphers");
@ -1539,12 +1493,12 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("Transactions");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
{
b.Navigation("CollectionUsers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.User", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b =>
{
b.Navigation("Ciphers");
@ -1559,8 +1513,6 @@ namespace Bit.MySqlMigrations.Migrations
b.Navigation("SsoUsers");
b.Navigation("Transactions");
b.Navigation("U2fs");
});
#pragma warning restore 612, 618
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,47 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Bit.PostgresMigrations.Migrations
{
public partial class RemoveU2F : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "U2f");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "U2f",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
AppId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
Challenge = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
KeyHandle = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
Version = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_U2f", x => x.Id);
table.ForeignKey(
name: "FK_U2f_User_UserId",
column: x => x.UserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_U2f_UserId",
table: "U2f",
column: "UserId");
}
}
}

View File

@ -17,10 +17,10 @@ namespace Bit.PostgresMigrations.Migrations
modelBuilder
.HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False")
.HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.9")
.HasAnnotation("ProductVersion", "5.0.12")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Cipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -67,7 +67,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Cipher");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Collection", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -95,7 +95,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Collection");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionCipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b =>
{
b.Property<Guid>("CollectionId")
.HasColumnType("uuid");
@ -110,7 +110,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("CollectionCipher");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionGroup", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b =>
{
b.Property<Guid>("CollectionId")
.HasColumnType("uuid");
@ -131,7 +131,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("CollectionGroups");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b =>
{
b.Property<Guid>("CollectionId")
.HasColumnType("uuid");
@ -157,7 +157,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("CollectionUsers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Device", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -194,7 +194,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Device");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.EmergencyAccess", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -242,7 +242,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("EmergencyAccess");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Event", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -298,7 +298,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Event");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Folder", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -322,7 +322,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Folder");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Grant", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b =>
{
b.Property<string>("Key")
.HasMaxLength(200)
@ -365,7 +365,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Grant");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Group", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -397,7 +397,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Group");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.GroupUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b =>
{
b.Property<Guid>("GroupId")
.HasColumnType("uuid");
@ -417,7 +417,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("GroupUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Installation", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -441,7 +441,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Installation");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Organization", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -592,7 +592,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationSponsorship", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -643,7 +643,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("OrganizationSponsorship");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -695,7 +695,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("OrganizationUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Policy", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -725,7 +725,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Policy");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.Provider", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -774,7 +774,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Provider");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderOrganization", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -806,7 +806,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("ProviderOrganization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -847,7 +847,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("ProviderUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Send", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -904,7 +904,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Send");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.SsoConfig", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@ -933,7 +933,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("SsoConfig");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.SsoUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
@ -963,7 +963,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("SsoUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.TaxRate", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b =>
{
b.Property<string>("Id")
.HasMaxLength(40)
@ -992,7 +992,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("TaxRate");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Transaction", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -1041,43 +1041,7 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("Transaction");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.U2f", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<string>("AppId")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("Challenge")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime>("CreationDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("KeyHandle")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.Property<string>("Version")
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("U2f");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.User", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
@ -1198,13 +1162,13 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Cipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("Ciphers")
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("Ciphers")
.HasForeignKey("UserId");
@ -1213,9 +1177,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Collection", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany()
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
@ -1224,15 +1188,15 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionCipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Cipher", "Cipher")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Cipher", "Cipher")
.WithMany("CollectionCiphers")
.HasForeignKey("CipherId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.Collection", "Collection")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection")
.WithMany("CollectionCiphers")
.HasForeignKey("CollectionId")
.OnDelete(DeleteBehavior.Cascade)
@ -1243,15 +1207,15 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Collection");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionGroup", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Collection", "Collection")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection")
.WithMany("CollectionGroups")
.HasForeignKey("CollectionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.Group", "Group")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group")
.WithMany()
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
@ -1262,21 +1226,21 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Group");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.CollectionUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Collection", "Collection")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Collection", "Collection")
.WithMany("CollectionUsers")
.HasForeignKey("CollectionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.OrganizationUser", "OrganizationUser")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
.WithMany("CollectionUsers")
.HasForeignKey("OrganizationUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.User", null)
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
.WithMany("CollectionUsers")
.HasForeignKey("UserId");
@ -1285,9 +1249,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("OrganizationUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Device", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Device", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
@ -1296,13 +1260,13 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.EmergencyAccess", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.User", "Grantee")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantee")
.WithMany()
.HasForeignKey("GranteeId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "Grantor")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "Grantor")
.WithMany()
.HasForeignKey("GrantorId")
.OnDelete(DeleteBehavior.Cascade)
@ -1313,9 +1277,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Grantor");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Folder", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("Folders")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
@ -1324,9 +1288,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Group", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("Groups")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
@ -1335,21 +1299,21 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.GroupUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Group", "Group")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Group", "Group")
.WithMany("GroupUsers")
.HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.OrganizationUser", "OrganizationUser")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
.WithMany()
.HasForeignKey("OrganizationUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.User", null)
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
.WithMany("GroupUsers")
.HasForeignKey("UserId");
@ -1358,17 +1322,17 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("OrganizationUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationSponsorship", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Installation", "Installation")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Installation", "Installation")
.WithMany()
.HasForeignKey("InstallationId");
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "SponsoredOrganization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoredOrganization")
.WithMany()
.HasForeignKey("SponsoredOrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "SponsoringOrganization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "SponsoringOrganization")
.WithMany()
.HasForeignKey("SponsoringOrganizationId");
@ -1379,15 +1343,15 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("SponsoringOrganization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("OrganizationUsers")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("OrganizationUsers")
.HasForeignKey("UserId");
@ -1396,9 +1360,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Policy", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("Policies")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
@ -1407,15 +1371,15 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderOrganization", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany()
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.Provider.Provider", "Provider")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderId")
.OnDelete(DeleteBehavior.Cascade)
@ -1426,15 +1390,15 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Provider");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Provider.Provider", "Provider")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId");
@ -1443,13 +1407,13 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Send", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany()
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany()
.HasForeignKey("UserId");
@ -1458,9 +1422,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.SsoConfig", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("SsoConfigs")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
@ -1469,13 +1433,13 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Organization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.SsoUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("SsoUsers")
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("SsoUsers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
@ -1486,13 +1450,13 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Transaction", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Organization", "Organization")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.Organization", "Organization")
.WithMany("Transactions")
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("Transactions")
.HasForeignKey("UserId");
@ -1501,23 +1465,12 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.U2f", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.User", "User")
.WithMany("U2fs")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Cipher", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
{
b.Navigation("CollectionCiphers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Collection", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
{
b.Navigation("CollectionCiphers");
@ -1526,12 +1479,12 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("CollectionUsers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Group", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b =>
{
b.Navigation("GroupUsers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Organization", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b =>
{
b.Navigation("Ciphers");
@ -1548,12 +1501,12 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Transactions");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.OrganizationUser", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
{
b.Navigation("CollectionUsers");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.User", b =>
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b =>
{
b.Navigation("Ciphers");
@ -1568,8 +1521,6 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("SsoUsers");
b.Navigation("Transactions");
b.Navigation("U2fs");
});
#pragma warning restore 612, 618
}

View File

@ -19,6 +19,7 @@ namespace Bit.Setup
Url = _context.Config.Url
};
// Needed for backwards compatability with migrated U2F tokens.
Helpers.WriteLine(_context, "Building FIDO U2F app id.");
Directory.CreateDirectory("/bitwarden/web/");
var template = Helpers.ReadTemplate("AppId");

View File

@ -88,10 +88,6 @@ server {
proxy_pass http://web:5000/duo-connector.html;
}
location = /u2f-connector.html {
proxy_pass http://web:5000/u2f-connector.html;
}
location = /webauthn-connector.html {
proxy_pass http://web:5000/webauthn-connector.html;
}