-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: OpenIdConnect supports PostgreSQL (#744)
- Loading branch information
Showing
28 changed files
with
411 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...Connect.EFCore.PostgreSql/EntityConfigurations/ApiResourceClaimEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ApiResourceClaimEntityTypeConfiguration : IEntityTypeConfiguration<ApiResourceClaim> | ||
{ | ||
public void Configure(EntityTypeBuilder<ApiResourceClaim> builder) | ||
{ | ||
builder.HasKey(x => x.Id); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...penIdConnect.EFCore.PostgreSql/EntityConfigurations/ApiResourceEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ApiResourceEntityTypeConfiguration : IEntityTypeConfiguration<ApiResource> | ||
{ | ||
public void Configure(EntityTypeBuilder<ApiResource> builder) | ||
{ | ||
builder.Property(x => x.Name).HasMaxLength(200).IsRequired(); | ||
builder.Property(x => x.DisplayName).HasMaxLength(200); | ||
builder.Property(x => x.Description).HasMaxLength(1000); | ||
builder.Property(x => x.AllowedAccessTokenSigningAlgorithms).HasMaxLength(100); | ||
builder.HasIndex(x => x.Name).IsUnique().HasFilter("NOT \"IsDeleted\""); | ||
builder.HasMany(x => x.Secrets).WithOne(x => x.ApiResource).HasForeignKey(x => x.ApiResourceId).OnDelete(DeleteBehavior.Cascade); | ||
builder.HasMany(x => x.ApiScopes).WithOne(x => x.ApiResource).HasForeignKey(x => x.ApiResourceId).IsRequired().OnDelete(DeleteBehavior.Cascade); | ||
builder.HasMany(x => x.UserClaims).WithOne(x => x.ApiResource).HasForeignKey(x => x.ApiResourceId).OnDelete(DeleteBehavior.Cascade); | ||
builder.HasMany(x => x.Properties).WithOne(x => x.ApiResource).HasForeignKey(x => x.ApiResourceId).OnDelete(DeleteBehavior.Cascade); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...nect.EFCore.PostgreSql/EntityConfigurations/ApiResourcePropertyEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ApiResourcePropertyEntityTypeConfiguration : IEntityTypeConfiguration<ApiResourceProperty> | ||
{ | ||
public void Configure(EntityTypeBuilder<ApiResourceProperty> builder) | ||
{ | ||
builder.Property(x => x.Key).HasMaxLength(250).IsRequired(); | ||
builder.Property(x => x.Value).HasMaxLength(2000).IsRequired(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...Connect.EFCore.PostgreSql/EntityConfigurations/ApiResourceScopeEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ApiResourceScopeEntityTypeConfiguration : IEntityTypeConfiguration<ApiResourceScope> | ||
{ | ||
public void Configure(EntityTypeBuilder<ApiResourceScope> builder) | ||
{ | ||
builder.HasKey(apiResourceScope => apiResourceScope.Id); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...onnect.EFCore.PostgreSql/EntityConfigurations/ApiResourceSecretEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ApiResourceSecretEntityTypeConfiguration : IEntityTypeConfiguration<ApiResourceSecret> | ||
{ | ||
public void Configure(EntityTypeBuilder<ApiResourceSecret> builder) | ||
{ | ||
builder.Property(x => x.Description).HasMaxLength(1000); | ||
builder.Property(x => x.Value).HasMaxLength(4000).IsRequired(); | ||
builder.Property(x => x.Type).HasMaxLength(250).IsRequired(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...nIdConnect.EFCore.PostgreSql/EntityConfigurations/ApiScopeClaimEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ApiScopeClaimEntityTypeConfiguration : IEntityTypeConfiguration<ApiScopeClaim> | ||
{ | ||
public void Configure(EntityTypeBuilder<ApiScopeClaim> builder) | ||
{ | ||
builder.HasKey(apiScopeClaim => apiScopeClaim.Id); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...n.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/ApiScopeEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ApiScopeEntityTypeConfiguration : IEntityTypeConfiguration<ApiScope> | ||
{ | ||
public void Configure(EntityTypeBuilder<ApiScope> builder) | ||
{ | ||
builder.HasIndex(apiScope => apiScope.Name).IsUnique(); | ||
|
||
builder.Property(apiScope => apiScope.Name).HasMaxLength(200).IsRequired(); | ||
builder.Property(apiScope => apiScope.DisplayName).HasMaxLength(200); | ||
builder.Property(apiScope => apiScope.Description).HasMaxLength(1000); | ||
|
||
builder.HasMany(apiScope => apiScope.UserClaims).WithOne(apiScope => apiScope.ApiScope).HasForeignKey(apiScope => apiScope.ApiScopeId).IsRequired().OnDelete(DeleteBehavior.Cascade); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...Connect.EFCore.PostgreSql/EntityConfigurations/ApiScopePropertyEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ApiScopePropertyEntityTypeConfiguration : IEntityTypeConfiguration<ApiScopeProperty> | ||
{ | ||
public void Configure(EntityTypeBuilder<ApiScopeProperty> builder) | ||
{ | ||
builder.Property(x => x.Key).HasMaxLength(250).IsRequired(); | ||
builder.Property(x => x.Value).HasMaxLength(2000).IsRequired(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...penIdConnect.EFCore.PostgreSql/EntityConfigurations/ClientClaimEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientClaimEntityTypeConfiguration : IEntityTypeConfiguration<ClientClaim> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientClaim> builder) | ||
{ | ||
builder.Property(x => x.Type).HasMaxLength(250).IsRequired(); | ||
builder.Property(x => x.Value).HasMaxLength(250).IsRequired(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...Connect.EFCore.PostgreSql/EntityConfigurations/ClientCorsOriginEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientCorsOriginEntityTypeConfiguration : IEntityTypeConfiguration<ClientCorsOrigin> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientCorsOrigin> builder) | ||
{ | ||
builder.Property(x => x.Origin).HasMaxLength(150).IsRequired(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ion.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/ClientEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientEntityTypeConfiguration : IEntityTypeConfiguration<Client> | ||
{ | ||
public void Configure(EntityTypeBuilder<Client> builder) | ||
{ | ||
builder.Property(x => x.ClientId).HasMaxLength(200).IsRequired(); | ||
builder.Property(x => x.ProtocolType).HasMaxLength(200).IsRequired(); | ||
builder.Property(x => x.ClientName).HasMaxLength(200); | ||
builder.Property(x => x.ClientUri).HasMaxLength(2000); | ||
builder.Property(x => x.LogoUri).HasMaxLength(2000); | ||
builder.Property(x => x.Description).HasMaxLength(1000); | ||
builder.Property(x => x.FrontChannelLogoutUri).HasMaxLength(2000); | ||
builder.Property(x => x.BackChannelLogoutUri).HasMaxLength(2000); | ||
builder.Property(x => x.ClientClaimsPrefix).HasMaxLength(200); | ||
builder.Property(x => x.PairWiseSubjectSalt).HasMaxLength(200); | ||
builder.Property(x => x.UserCodeType).HasMaxLength(100); | ||
builder.Property(x => x.AllowedIdentityTokenSigningAlgorithms).HasMaxLength(100); | ||
builder.HasIndex(x => x.ClientId); | ||
builder.HasIndex(x => x.ClientId).IsUnique().HasFilter("NOT \"IsDeleted\""); | ||
|
||
builder.HasMany(x => x.AllowedGrantTypes).WithOne(x => x.Client); | ||
builder.HasMany(x => x.RedirectUris).WithOne(x => x.Client); | ||
builder.HasMany(x => x.PostLogoutRedirectUris).WithOne(x => x.Client); | ||
builder.HasMany(x => x.AllowedScopes).WithOne(x => x.Client); | ||
builder.HasMany(x => x.ClientSecrets).WithOne(x => x.Client); | ||
builder.HasMany(x => x.Claims).WithOne(x => x.Client); | ||
builder.HasMany(x => x.IdentityProviderRestrictions).WithOne(x => x.Client); | ||
builder.HasMany(x => x.AllowedCorsOrigins).WithOne(x => x.Client); | ||
builder.HasMany(x => x.Properties).WithOne(x => x.Client); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...dConnect.EFCore.PostgreSql/EntityConfigurations/ClientGrantTypeEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientGrantTypeEntityTypeConfiguration : IEntityTypeConfiguration<ClientGrantType> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientGrantType> builder) | ||
{ | ||
builder.Property(x => x.GrantType).HasMaxLength(250).IsRequired(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ect.EFCore.PostgreSql/EntityConfigurations/ClientIdPRestrictionEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientIdPRestrictionEntityTypeConfiguration : IEntityTypeConfiguration<ClientIdPRestriction> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientIdPRestriction> builder) | ||
{ | ||
builder.Property(x => x.Provider).HasMaxLength(200).IsRequired(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ore.PostgreSql/EntityConfigurations/ClientPostLogoutRedirectUriEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientPostLogoutRedirectUriEntityTypeConfiguration : IEntityTypeConfiguration<ClientPostLogoutRedirectUri> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientPostLogoutRedirectUri> builder) | ||
{ | ||
builder.HasKey(x => x.Id); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...IdConnect.EFCore.PostgreSql/EntityConfigurations/ClientPropertyEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientPropertyEntityTypeConfiguration : IEntityTypeConfiguration<ClientProperty> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientProperty> builder) | ||
{ | ||
builder.Property(x => x.Key).HasMaxLength(250).IsRequired(); | ||
builder.Property(x => x.Value).HasMaxLength(2000).IsRequired(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...onnect.EFCore.PostgreSql/EntityConfigurations/ClientRedirectUriEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientRedirectUriEntityTypeConfiguration : IEntityTypeConfiguration<ClientRedirectUri> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientRedirectUri> builder) | ||
{ | ||
builder.Property(x => x.RedirectUri).HasMaxLength(2000).IsRequired(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...penIdConnect.EFCore.PostgreSql/EntityConfigurations/ClientScopeEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientScopeEntityTypeConfiguration : IEntityTypeConfiguration<ClientScope> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientScope> builder) | ||
{ | ||
builder.Property(x => x.Scope).HasMaxLength(200).IsRequired(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...enIdConnect.EFCore.PostgreSql/EntityConfigurations/ClientSecretEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class ClientSecretEntityTypeConfiguration : IEntityTypeConfiguration<ClientSecret> | ||
{ | ||
public void Configure(EntityTypeBuilder<ClientSecret> builder) | ||
{ | ||
builder.Property(x => x.Value).HasMaxLength(4000).IsRequired(); | ||
builder.Property(x => x.Type).HasMaxLength(250).IsRequired(); | ||
builder.Property(x => x.Description).HasMaxLength(2000); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...dConnect.EFCore.PostgreSql/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class DeviceFlowCodesEntityTypeConfiguration : IEntityTypeConfiguration<DeviceFlowCodes> | ||
{ | ||
public void Configure(EntityTypeBuilder<DeviceFlowCodes> builder) | ||
{ | ||
builder.Property(x => x.DeviceCode).HasMaxLength(200).IsRequired(); | ||
builder.Property(x => x.UserCode).HasMaxLength(200).IsRequired(); | ||
builder.Property(x => x.SubjectId).HasMaxLength(200); | ||
builder.Property(x => x.SessionId).HasMaxLength(100); | ||
builder.Property(x => x.ClientId).HasMaxLength(200).IsRequired(); | ||
builder.Property(x => x.Description).HasMaxLength(200); | ||
builder.Property(x => x.CreationTime).IsRequired(); | ||
builder.Property(x => x.Expiration).IsRequired(); | ||
// 50000 chosen to be explicit to allow enough size to avoid truncation, yet stay beneath the MySql row size limit of ~65K | ||
// apparently anything over 4K converts to nvarchar(max) on SqlServer | ||
builder.Property(x => x.Data).HasMaxLength(50000).IsRequired(); | ||
|
||
builder.HasKey(x => new { x.UserCode }); | ||
|
||
builder.HasIndex(x => x.DeviceCode).IsUnique().HasFilter("NOT \"IsDeleted\""); | ||
builder.HasIndex(x => x.Expiration); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ct.EFCore.PostgreSql/EntityConfigurations/IdentityResourceClaimEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class IdentityResourceClaimEntityTypeConfiguration : IEntityTypeConfiguration<IdentityResourceClaim> | ||
{ | ||
public void Configure(EntityTypeBuilder<IdentityResourceClaim> builder) | ||
{ | ||
builder.HasKey(identityResourceClaim => identityResourceClaim.Id); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...Connect.EFCore.PostgreSql/EntityConfigurations/IdentityResourceEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class IdentityResourceEntityTypeConfiguration : IEntityTypeConfiguration<IdentityResource> | ||
{ | ||
public void Configure(EntityTypeBuilder<IdentityResource> builder) | ||
{ | ||
builder.Property(x => x.Name).HasMaxLength(200).IsRequired(); | ||
builder.Property(x => x.DisplayName).HasMaxLength(200); | ||
builder.Property(x => x.Description).HasMaxLength(1000); | ||
builder.HasIndex(x => x.Name).IsUnique().HasFilter("NOT \"IsDeleted\""); | ||
|
||
builder.HasMany(x => x.UserClaims).WithOne(x => x.IdentityResource).HasForeignKey(x => x.IdentityResourceId).IsRequired().OnDelete(DeleteBehavior.Cascade); | ||
builder.HasMany(x => x.Properties).WithOne(x => x.IdentityResource).HasForeignKey(x => x.IdentityResourceId).IsRequired().OnDelete(DeleteBehavior.Cascade); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...EFCore.PostgreSql/EntityConfigurations/IdentityResourcePropertyEntityTypeConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) MASA Stack All rights reserved. | ||
// Licensed under the MIT License. See LICENSE.txt in the project root for license information. | ||
|
||
namespace Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.EntityConfigurations; | ||
|
||
public class IdentityResourcePropertyEntityTypeConfiguration : IEntityTypeConfiguration<IdentityResourceProperty> | ||
{ | ||
public void Configure(EntityTypeBuilder<IdentityResourceProperty> builder) | ||
{ | ||
builder.Property(x => x.Key).HasMaxLength(250).IsRequired(); | ||
builder.Property(x => x.Value).HasMaxLength(2000).IsRequired(); | ||
} | ||
} |
Oops, something went wrong.