mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[EC-261] SCIM (#2105)
* scim project stub * some scim models and v2 controllers * implement some v2 scim endpoints * fix spacing * api key auth * EC-261 - SCIM Org API Key and connection type config * EC-261 - Fix lint errors/formatting * updates for okta implementation testing * fix var ref * updates from testing with Okta * implement scim context via provider parsing * support single and list of ids for add/remove groups * log ops not handled * touch up scim context * group list filtering * EC-261 - Additional SCIM provider types * EC-265 - UseScim flag and license update * EC-265 - SCIM provider type of default (0) * EC-265 - Add Scim URL and update connection validation * EC-265 - Model validation and cleanup for SCIM keys * implement scim org connection * EC-265 - Ensure ServiceUrl is not persisted to DB * EC-265 - Exclude provider type from DB if not configured * EC-261 - EF Migrations for SCIM * add docker builds for scim * EC-261 - Fix failing permissions tests * EC-261 - Fix unit tests and pgsql migrations * Formatting fixes from linter * EC-265 - Remove service URL from scim config * EC-265 - Fix unit tests, removed wayward validation * EC-265 - Require self-hosted for billing sync org conn * EC-265 - Fix formatting issues - whitespace * EC-261 - PR feedback and cleanup * scim constants rename * no scim settings right now * update project name * delete package lock * update appsettings configs for scim * use default scim provider for context Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com>
This commit is contained in:
1607
util/PostgresMigrations/Migrations/20220707162231_UseScimFlag.Designer.cs
generated
Normal file
1607
util/PostgresMigrations/Migrations/20220707162231_UseScimFlag.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations
|
||||
{
|
||||
public partial class UseScimFlag : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "UseScim",
|
||||
table: "Organization",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UseScim",
|
||||
table: "Organization");
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
@ -16,9 +18,10 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63)
|
||||
.HasAnnotation("ProductVersion", "5.0.12")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
.HasAnnotation("ProductVersion", "6.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
|
||||
{
|
||||
@ -64,7 +67,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cipher");
|
||||
b.ToTable("Cipher", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
|
||||
@ -92,7 +95,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.ToTable("Collection");
|
||||
b.ToTable("Collection", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionCipher", b =>
|
||||
@ -107,7 +110,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("CipherId");
|
||||
|
||||
b.ToTable("CollectionCipher");
|
||||
b.ToTable("CollectionCipher", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.CollectionGroup", b =>
|
||||
@ -191,7 +194,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Device");
|
||||
b.ToTable("Device", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.EmergencyAccess", b =>
|
||||
@ -239,7 +242,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("GrantorId");
|
||||
|
||||
b.ToTable("EmergencyAccess");
|
||||
b.ToTable("EmergencyAccess", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Event", b =>
|
||||
@ -298,7 +301,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Event");
|
||||
b.ToTable("Event", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Folder", b =>
|
||||
@ -322,7 +325,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Folder");
|
||||
b.ToTable("Folder", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Grant", b =>
|
||||
@ -365,7 +368,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("Grant");
|
||||
b.ToTable("Grant", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Group", b =>
|
||||
@ -397,7 +400,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.ToTable("Group");
|
||||
b.ToTable("Group", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.GroupUser", b =>
|
||||
@ -417,7 +420,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("GroupUser");
|
||||
b.ToTable("GroupUser", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Installation", b =>
|
||||
@ -441,7 +444,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Installation");
|
||||
b.ToTable("Installation", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Organization", b =>
|
||||
@ -577,6 +580,9 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<bool>("UseResetPassword")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("UseScim")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("UseSso")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
@ -588,7 +594,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Organization");
|
||||
b.ToTable("Organization", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationApiKey", b =>
|
||||
@ -613,7 +619,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.ToTable("OrganizationApiKey");
|
||||
b.ToTable("OrganizationApiKey", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationConnection", b =>
|
||||
@ -637,7 +643,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.ToTable("OrganizationConnection");
|
||||
b.ToTable("OrganizationConnection", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationSponsorship", b =>
|
||||
@ -680,7 +686,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("SponsoringOrganizationId");
|
||||
|
||||
b.ToTable("OrganizationSponsorship");
|
||||
b.ToTable("OrganizationSponsorship", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
|
||||
@ -717,7 +723,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<DateTime>("RevisionDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<byte>("Status")
|
||||
b.Property<short>("Status")
|
||||
.HasColumnType("smallint");
|
||||
|
||||
b.Property<byte>("Type")
|
||||
@ -732,7 +738,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("OrganizationUser");
|
||||
b.ToTable("OrganizationUser", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Policy", b =>
|
||||
@ -762,7 +768,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.ToTable("Policy");
|
||||
b.ToTable("Policy", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Provider", b =>
|
||||
@ -811,7 +817,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Provider");
|
||||
b.ToTable("Provider", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderOrganization", b =>
|
||||
@ -843,7 +849,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("ProviderId");
|
||||
|
||||
b.ToTable("ProviderOrganization");
|
||||
b.ToTable("ProviderOrganization", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.ProviderUser", b =>
|
||||
@ -884,7 +890,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("ProviderUser");
|
||||
b.ToTable("ProviderUser", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Send", b =>
|
||||
@ -941,15 +947,16 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Send");
|
||||
b.ToTable("Send", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoConfig", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
@ -970,15 +977,16 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("OrganizationId");
|
||||
|
||||
b.ToTable("SsoConfig");
|
||||
b.ToTable("SsoConfig", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.SsoUser", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
@ -1000,7 +1008,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("SsoUser");
|
||||
b.ToTable("SsoUser", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.TaxRate", b =>
|
||||
@ -1029,7 +1037,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("TaxRate");
|
||||
b.ToTable("TaxRate", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Transaction", b =>
|
||||
@ -1078,7 +1086,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Transaction");
|
||||
b.ToTable("Transaction", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.User", b =>
|
||||
@ -1208,7 +1216,7 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("User");
|
||||
b.ToTable("User", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Cipher", b =>
|
||||
|
@ -1,6 +1,6 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "User" ADD "UnknownDeviceVerificationEnabled" boolean NOT NULL DEFAULT 1;
|
||||
ALTER TABLE "User" ADD "UnknownDeviceVerificationEnabled" boolean NOT NULL DEFAULT true;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220524170740_DeviceUnknownVerification', '5.0.12');
|
||||
|
@ -0,0 +1,8 @@
|
||||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE "Organization" ADD "UseScim" boolean NOT NULL DEFAULT FALSE;
|
||||
|
||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||
VALUES ('20220707162231_UseScimFlag', '6.0.4');
|
||||
|
||||
COMMIT;
|
Reference in New Issue
Block a user