1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Merge pull request #796 from bitwarden/sso-dal

Additional SSO & Org Identifier work
This commit is contained in:
Matt Portune
2020-06-26 10:47:17 -04:00
committed by GitHub
12 changed files with 372 additions and 2 deletions

View File

@ -0,0 +1,8 @@
namespace Bit.Core.Enums
{
public enum SsoType : byte
{
// TODO proper SsoType values
Test = 1
}
}

View File

@ -12,6 +12,7 @@ namespace Bit.Core.Models.Table
private Dictionary<TwoFactorProviderType, TwoFactorProvider> _twoFactorProviders;
public Guid Id { get; set; }
public string Identifier { get; set; }
public string Name { get; set; }
public string BusinessName { get; set; }
public string BusinessAddress1 { get; set; }

View File

@ -0,0 +1,14 @@
using System;
namespace Bit.Core.Models.Table
{
public class SsoConfig
{
public long? Id { get; set; }
public bool Enabled { get; set; } = true;
public Guid OrganizationId { get; set; }
public string Data { get; set; }
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow;
}
}

View File

@ -69,8 +69,10 @@
<Folder Include="dbo\User Defined Types\" />
</ItemGroup>
<ItemGroup>
<Build Include="dbo\Stored Procedures\SsoConfig_Create.sql" />
<Build Include="dbo\Stored Procedures\SsoConfig_ReadByIdentifier.sql" />
<Build Include="dbo\Stored Procedures\SsoConfig_ReadByOrganizationId.sql" />
<Build Include="dbo\Stored Procedures\SsoConfig_Update.sql" />
<Build Include="dbo\Tables\Grant.sql" />
<Build Include="dbo\Tables\SsoConfig.sql" />
<Build Include="dbo\Tables\User.sql" />

View File

@ -1,5 +1,6 @@
CREATE PROCEDURE [dbo].[Organization_Create]
@Id UNIQUEIDENTIFIER,
@Identifier NVARCHAR(50),
@Name NVARCHAR(50),
@BusinessName NVARCHAR(50),
@BusinessAddress1 NVARCHAR(50),
@ -41,6 +42,7 @@ BEGIN
INSERT INTO [dbo].[Organization]
(
[Id],
[Identifier],
[Name],
[BusinessName],
[BusinessAddress1],
@ -79,6 +81,7 @@ BEGIN
VALUES
(
@Id,
@Identifier,
@Name,
@BusinessName,
@BusinessAddress1,

View File

@ -1,5 +1,6 @@
CREATE PROCEDURE [dbo].[Organization_Update]
@Id UNIQUEIDENTIFIER,
@Identifier NVARCHAR(50),
@Name NVARCHAR(50),
@BusinessName NVARCHAR(50),
@BusinessAddress1 NVARCHAR(50),
@ -41,6 +42,7 @@ BEGIN
UPDATE
[dbo].[Organization]
SET
[Identifier] = @Identifier,
[Name] = @Name,
[BusinessName] = @BusinessName,
[BusinessAddress1] = @BusinessAddress1,

View File

@ -0,0 +1,32 @@
CREATE PROCEDURE [dbo].[SsoConfig_Create]
@Id BIGINT OUTPUT,
@Enabled BIT,
@OrganizationId UNIQUEIDENTIFIER,
@Data NVARCHAR(MAX),
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7)
AS
BEGIN
SET NOCOUNT ON
INSERT INTO [dbo].[SsoConfig]
(
[Id],
[Enabled],
[OrganizationId],
[Data],
[CreationDate],
[RevisionDate]
)
VALUES
(
@Id,
@Enabled,
@OrganizationId,
@Data,
@CreationDate,
@RevisionDate
)
SET @Id = SCOPE_IDENTITY();
END

View File

@ -0,0 +1,22 @@
CREATE PROCEDURE [dbo].[SsoConfig_Update]
@Id BIGINT,
@Enabled BIT,
@OrganizationId UNIQUEIDENTIFIER,
@Data NVARCHAR(MAX),
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7)
AS
BEGIN
SET NOCOUNT ON
UPDATE
[dbo].[SsoConfig]
SET
[Enabled] = @Enabled,
[OrganizationId] = @OrganizationId,
[Data] = @Data,
[CreationDate] = @CreationDate,
[RevisionDate] = @RevisionDate
WHERE
[Id] = @Id
END

View File

@ -2,7 +2,6 @@
[Id] BIGINT IDENTITY (1, 1) NOT NULL,
[Enabled] BIT NOT NULL,
[OrganizationId] UNIQUEIDENTIFIER NOT NULL,
[Identifier] NVARCHAR (50) NULL,
[Data] NVARCHAR (MAX) NULL,
[CreationDate] DATETIME2 (7) NOT NULL,
[RevisionDate] DATETIME2 (7) NOT NULL,