diff --git a/src/Core/GlobalSettings.cs b/src/Core/GlobalSettings.cs
index 69612b09e9..b9442e6446 100644
--- a/src/Core/GlobalSettings.cs
+++ b/src/Core/GlobalSettings.cs
@@ -278,6 +278,7 @@ namespace Bit.Core
public class SsoSettings
{
+ public int CacheLifetimeInSeconds { get; set; } = 60;
public virtual SamlSettings Saml { get; set; } = new SamlSettings();
public class SamlSettings
diff --git a/src/Core/Resources/SharedResources.en.resx b/src/Core/Resources/SharedResources.en.resx
index 58f26f2e56..16b5d096fd 100644
--- a/src/Core/Resources/SharedResources.en.resx
+++ b/src/Core/Resources/SharedResources.en.resx
@@ -412,4 +412,22 @@
Error performing pre validation.
+
+ Error
+
+
+ There was an unexpected error during single sign-on. Please close this page and try again.
+
+
+ There was an unexpected error during single sign-on. Please go back to <a href="{0}">{0}</a> or close this page and try again.
+
+
+ Request ID
+
+
+ Redirecting
+
+
+ You are now being returned to the application. Once complete, you may close this tab.
+
diff --git a/src/Core/Utilities/StaticStore.cs b/src/Core/Utilities/StaticStore.cs
index cf694eea5c..9dc1e92004 100644
--- a/src/Core/Utilities/StaticStore.cs
+++ b/src/Core/Utilities/StaticStore.cs
@@ -436,6 +436,10 @@ namespace Bit.Core.Utilities
SeatPrice = 6,
AdditionalStoragePricePerGb = 0.5M
},
+ new Plan
+ {
+ Type = PlanType.Custom
+ },
};
#endregion
diff --git a/src/Sql/dbo/Stored Procedures/Organization_DeleteById.sql b/src/Sql/dbo/Stored Procedures/Organization_DeleteById.sql
index 3fdb9948f7..ddbbafefff 100644
--- a/src/Sql/dbo/Stored Procedures/Organization_DeleteById.sql
+++ b/src/Sql/dbo/Stored Procedures/Organization_DeleteById.sql
@@ -23,15 +23,25 @@ BEGIN
COMMIT TRANSACTION Organization_DeleteById_Ciphers
END
+ BEGIN TRANSACTION Organization_DeleteById
+
DELETE
FROM
[dbo].[SsoUser]
WHERE
[OrganizationId] = @Id
+ DELETE
+ FROM
+ [dbo].[SsoConfig]
+ WHERE
+ [OrganizationId] = @Id
+
DELETE
FROM
[dbo].[Organization]
WHERE
[Id] = @Id
+
+ COMMIT TRANSACTION Organization_DeleteById
END
\ No newline at end of file
diff --git a/util/Migrator/DbScripts/2020-09-02_00_DeleteSsoConfig.sql b/util/Migrator/DbScripts/2020-09-02_00_DeleteSsoConfig.sql
new file mode 100644
index 0000000000..7175b6e600
--- /dev/null
+++ b/util/Migrator/DbScripts/2020-09-02_00_DeleteSsoConfig.sql
@@ -0,0 +1,54 @@
+IF OBJECT_ID('[dbo].[Organization_DeleteById]') IS NOT NULL
+BEGIN
+ DROP PROCEDURE [dbo].[Organization_DeleteById]
+END
+GO
+
+CREATE PROCEDURE [dbo].[Organization_DeleteById]
+ @Id UNIQUEIDENTIFIER
+AS
+BEGIN
+ SET NOCOUNT ON
+
+ EXEC [dbo].[User_BumpAccountRevisionDateByOrganizationId] @Id
+
+ DECLARE @BatchSize INT = 100
+ WHILE @BatchSize > 0
+ BEGIN
+ BEGIN TRANSACTION Organization_DeleteById_Ciphers
+
+ DELETE TOP(@BatchSize)
+ FROM
+ [dbo].[Cipher]
+ WHERE
+ [UserId] IS NULL
+ AND [OrganizationId] = @Id
+
+ SET @BatchSize = @@ROWCOUNT
+
+ COMMIT TRANSACTION Organization_DeleteById_Ciphers
+ END
+
+ BEGIN TRANSACTION Organization_DeleteById
+
+ DELETE
+ FROM
+ [dbo].[SsoUser]
+ WHERE
+ [OrganizationId] = @Id
+
+ DELETE
+ FROM
+ [dbo].[SsoConfig]
+ WHERE
+ [OrganizationId] = @Id
+
+ DELETE
+ FROM
+ [dbo].[Organization]
+ WHERE
+ [Id] = @Id
+
+ COMMIT TRANSACTION Organization_DeleteById
+END
+GO