Skip to content

feat: OpenIdConnect supports PostgreSQL #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Masa.Framework.sln
Original file line number Diff line number Diff line change
@@ -625,6 +625,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.DynamicsCrm.Core
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.DynamicsCrm.EntityFrameworkCore", "src\Utils\DynamicsCrm\Masa.Utils.DynamicsCrm.EntityFrameworkCore\Masa.Utils.DynamicsCrm.EntityFrameworkCore.csproj", "{8A51A2A9-FBF4-40DC-AD89-AD3B9D3A50DC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql", "src\Contrib\Authentication\OpenIdConnect\Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql\Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql.csproj", "{F100414F-CD8D-49D4-BFE0-88D94E53E628}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -2185,6 +2187,14 @@ Global
{8A51A2A9-FBF4-40DC-AD89-AD3B9D3A50DC}.Release|Any CPU.Build.0 = Release|Any CPU
{8A51A2A9-FBF4-40DC-AD89-AD3B9D3A50DC}.Release|x64.ActiveCfg = Release|Any CPU
{8A51A2A9-FBF4-40DC-AD89-AD3B9D3A50DC}.Release|x64.Build.0 = Release|Any CPU
{F100414F-CD8D-49D4-BFE0-88D94E53E628}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F100414F-CD8D-49D4-BFE0-88D94E53E628}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F100414F-CD8D-49D4-BFE0-88D94E53E628}.Debug|x64.ActiveCfg = Debug|Any CPU
{F100414F-CD8D-49D4-BFE0-88D94E53E628}.Debug|x64.Build.0 = Debug|Any CPU
{F100414F-CD8D-49D4-BFE0-88D94E53E628}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F100414F-CD8D-49D4-BFE0-88D94E53E628}.Release|Any CPU.Build.0 = Release|Any CPU
{F100414F-CD8D-49D4-BFE0-88D94E53E628}.Release|x64.ActiveCfg = Release|Any CPU
{F100414F-CD8D-49D4-BFE0-88D94E53E628}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2493,6 +2503,7 @@ Global
{64B54122-44F1-4379-9422-953EF706A3A6} = {5944A182-13B8-4DA6-AEE2-0A01E64A9648}
{83310F46-E1C7-4438-B32A-9F6F7EA13FCF} = {64B54122-44F1-4379-9422-953EF706A3A6}
{8A51A2A9-FBF4-40DC-AD89-AD3B9D3A50DC} = {64B54122-44F1-4379-9422-953EF706A3A6}
{F100414F-CD8D-49D4-BFE0-88D94E53E628} = {41769FBF-91A8-48D1-B3BB-CAE4C814E7CD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {40383055-CC50-4600-AD9A-53C14F620D03}
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);
}
}
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);
}
}
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();
}
}
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);
}
}
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();
}
}
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);
}
}
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);
}
}
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();
}
}
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();
}
}
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();
}
}
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);
}
}
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();
}
}
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();
}
}
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);
}
}
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();
}
}
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();
}
}
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();
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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();
}
}
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 PersistedGrantEntityTypeConfiguration : IEntityTypeConfiguration<PersistedGrant>
{
public void Configure(EntityTypeBuilder<PersistedGrant> builder)
{
builder.Property(x => x.Key).HasMaxLength(200).ValueGeneratedNever();
builder.Property(x => x.Type).HasMaxLength(50).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();
// 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 => x.Key);

builder.HasIndex(x => new { x.SubjectId, x.ClientId, x.Type });
builder.HasIndex(x => new { x.SubjectId, x.SessionId, x.Type });
builder.HasIndex(x => x.Expiration);
}
}
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 UserClaimEntityTypeConfiguration : IEntityTypeConfiguration<UserClaim>
{
public void Configure(EntityTypeBuilder<UserClaim> builder)
{
builder.HasKey(x => x.Id);
builder.Property(x => x.Name).HasMaxLength(200).IsRequired();
builder.Property(x => x.Description).HasMaxLength(1000);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Masa.Contrib.Authentication.OpenIdConnect.EFCore\Masa.Contrib.Authentication.OpenIdConnect.EFCore.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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;

public static class OpenIdConnectEFPostgreSql
{
public static Assembly Assembly => typeof(OpenIdConnectEFPostgreSql).Assembly;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

global using Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain.Entities;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.EntityFrameworkCore.Metadata.Builders;
global using System.Reflection;

Unchanged files with check annotations Beta

namespace Masa.Utils.Models;
[Obsolete("BasePaginatedList has expired, please use PaginatedListBase")]

Check warning on line 8 in src/Utils/Models/Masa.Utils.Models.Config/Paginated/PaginatedListBase.cs

GitHub Actions / redis on base image

Do not forget to remove this deprecated code someday. (https://rules.sonarsource.com/csharp/RSPEC-1133)
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public class BasePaginatedList<TEntity> : PaginatedListBase<TEntity>
where TEntity : class
/// <summary>
/// Reference from https://docs.microsoft.com/zh-cn/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/enumeration-classes-over-enum-types
/// </summary>
public abstract class Enumeration : IComparable

Check warning on line 9 in src/BuildingBlocks/Data/Masa.BuildingBlocks.Data.Contracts/Enumeration.cs

GitHub Actions / redis on base image

When implementing IComparable, you should also override <= and >=. (https://rules.sonarsource.com/csharp/RSPEC-1210)
{
public string Name { get; private set; }
return false;
}
if (this is null ^ obj is null) return false;

Check warning on line 36 in src/BuildingBlocks/Data/Masa.BuildingBlocks.Data.Contracts/Enumeration.cs

GitHub Actions / redis on base image

Change this condition so that it does not always evaluate to 'False'. Some code paths are unreachable. (https://rules.sonarsource.com/csharp/RSPEC-2583)
var typeMatches = GetType().Equals(obj!.GetType());
var valueMatches = Id.Equals(otherValue.Id);
{
var matchingItem = GetAll<T>().FirstOrDefault(predicate);
if (matchingItem == null)

Check warning on line 65 in src/BuildingBlocks/Data/Masa.BuildingBlocks.Data.Contracts/Enumeration.cs

GitHub Actions / redis on base image

Possible null reference argument for parameter 'left' in 'bool Enumeration.operator ==(Enumeration left, Enumeration right)'.

Check warning on line 65 in src/BuildingBlocks/Data/Masa.BuildingBlocks.Data.Contracts/Enumeration.cs

GitHub Actions / redis on base image

Cannot convert null literal to non-nullable reference type.
throw new InvalidOperationException($"'{value}' is not a valid {description} in {typeof(T)}");
return matchingItem;
}
}
//

Check warning on line 367 in src/Utils/Extensions/Masa.Utils.Extensions.DotNet/EnglishPluralizationService.cs

GitHub Actions / redis on base image

Remove this empty comment (https://rules.sonarsource.com/csharp/RSPEC-4663)
public override string Pluralize(string word)
{
CheckUtil.CheckArgumentNull(word, "word");
return prefixWord + newSuffixWord;
}
//

Check warning on line 519 in src/Utils/Extensions/Masa.Utils.Extensions.DotNet/EnglishPluralizationService.cs

GitHub Actions / redis on base image

Remove this empty comment (https://rules.sonarsource.com/csharp/RSPEC-4663)
if (suffixWord.EndsWith("y", true, Culture))
{