From 57fa5ce0123ab8477b95267123586aa5679e9997 Mon Sep 17 00:00:00 2001 From: MayueCif Date: Wed, 4 Mar 2026 09:04:22 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B0=83=E6=95=B4SessionId=E5=92=8CDescrip?= =?UTF-8?q?tion=E4=B8=BA=E5=8F=AF=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将DeviceFlowCodes和PersistedGrant中的SessionId与Description属性由非空字符串改为可空字符串(string?),并移除默认空字符串赋值,以更准确表达属性可为null的业务场景。 --- .../Entities/DeviceFlowCodes.cs | 4 ++-- .../Entities/PersistedGrant.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs index 4c97be3f0..05d54f9ab 100644 --- a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs +++ b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs @@ -35,7 +35,7 @@ public class DeviceFlowCodes : FullAggregateRoot /// /// The session identifier. /// - public string SessionId { get; private set; } = string.Empty; + public string? SessionId { get; private set; } /// /// Gets or sets the client identifier. @@ -51,7 +51,7 @@ public class DeviceFlowCodes : FullAggregateRoot /// /// The description. /// - public string Description { get; private set; } = string.Empty; + public string? Description { get; private set; } /// /// Gets or sets the expiration. diff --git a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs index 3fb9903d6..01f2d90f2 100644 --- a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs +++ b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs @@ -11,11 +11,11 @@ public class PersistedGrant : FullAggregateRoot public string SubjectId { get; private set; } = string.Empty; - public string SessionId { get; private set; } = string.Empty; + public string? SessionId { get; private set; } public string ClientId { get; private set; } = string.Empty; - public string Description { get; private set; } = string.Empty; + public string? Description { get; private set; } public DateTime? Expiration { get; private set; } From fb31b9e49b2d0b3e25f3a353e8d9898004ada5a7 Mon Sep 17 00:00:00 2001 From: MayueCif Date: Wed, 4 Mar 2026 14:24:23 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=A7=BB=E9=99=A4DeviceFlowCodes=E4=B8=8EP?= =?UTF-8?q?ersistedGrant=E7=9A=84=E8=81=9A=E5=90=88=E6=A0=B9=E7=BB=A7?= =?UTF-8?q?=E6=89=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将DeviceFlowCodes和PersistedGrant类从继承FullAggregateRoot改为普通类,去除了聚合根相关功能,简化了实体结构或为领域模型调整做准备。 --- .../Entities/DeviceFlowCodes.cs | 2 +- .../Entities/PersistedGrant.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs index 05d54f9ab..7f1fc5716 100644 --- a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs +++ b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs @@ -3,7 +3,7 @@ namespace Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain.Entities; -public class DeviceFlowCodes : FullAggregateRoot +public class DeviceFlowCodes { /// /// Gets or sets the device code. diff --git a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs index 01f2d90f2..cfdad8c82 100644 --- a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs +++ b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs @@ -3,7 +3,7 @@ namespace Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain.Entities; -public class PersistedGrant : FullAggregateRoot +public class PersistedGrant { public string Key { get; private set; } = null!; From 9a6176188b9704704cf0676b080238681fe38df8 Mon Sep 17 00:00:00 2001 From: MayueCif Date: Wed, 4 Mar 2026 14:42:50 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=A7=BB=E9=99=A4DeviceFlowCodes=E5=92=8CP?= =?UTF-8?q?ersistedGrant=E7=9A=84=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除了 DeviceFlowCodes.cs 和 PersistedGrant.cs 文件中的命名空间声明,使这两个类不再属于原有的命名空间。此更改可能用于调整类的作用域或为后续的命名空间重构做准备。 --- .../Entities/DeviceFlowCodes.cs | 2 -- .../Entities/PersistedGrant.cs | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs index 7f1fc5716..72c112383 100644 --- a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs +++ b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/DeviceFlowCodes.cs @@ -1,8 +1,6 @@ // Copyright (c) MASA Stack All rights reserved. // Licensed under the MIT License. See LICENSE.txt in the project root for license information. -namespace Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain.Entities; - public class DeviceFlowCodes { /// diff --git a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs index cfdad8c82..f92867608 100644 --- a/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs +++ b/src/BuildingBlocks/Authentication/OpenIdConnect/Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain/Entities/PersistedGrant.cs @@ -1,8 +1,6 @@ // Copyright (c) MASA Stack All rights reserved. // Licensed under the MIT License. See LICENSE.txt in the project root for license information. -namespace Masa.BuildingBlocks.Authentication.OpenIdConnect.Domain.Entities; - public class PersistedGrant { public string Key { get; private set; } = null!; From cfd79bc21c1388fbf00c8af7f3d10fca6de9d6c9 Mon Sep 17 00:00:00 2001 From: MayueCif Date: Wed, 4 Mar 2026 15:07:54 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=AE=80=E5=8C=96PersistedGrant=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E9=85=8D=E7=BD=AE=E5=8F=8A=E8=B0=83=E6=95=B4=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正版权声明并增加MIT License说明。将命名空间从Oracle专用调整为通用版本。简化SubjectId、SessionId、Description字段配置,移除IsRequired(false),仅保留最大长度设置,默认可空。移除了CreationTime的IsRequired()配置,使配置更简洁且符合EF Core默认行为。 --- .../PersistedGrantEntityTypeConfiguration.cs | 3 +-- .../PersistedGrantEntityTypeConfiguration.cs | 1 - .../PersistedGrantEntityTypeConfiguration.cs | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.Oracle/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.Oracle/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs index 538d3b3e9..0a6f79975 100644 --- a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.Oracle/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs +++ b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.Oracle/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs @@ -1,4 +1,4 @@ -// Copyright (c) MASA Stack All rights reserved. +// 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.Oracle.EntityConfigurations; @@ -13,7 +13,6 @@ public void Configure(EntityTypeBuilder builder) builder.Property(x => x.SessionId).HasMaxLength(100).IsRequired(false); builder.Property(x => x.ClientId).HasMaxLength(200).IsRequired(); builder.Property(x => x.Description).HasMaxLength(200).IsRequired(false); - 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(); diff --git a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs index cb923d693..8c9e41d56 100644 --- a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs +++ b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs @@ -13,7 +13,6 @@ public void Configure(EntityTypeBuilder builder) 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(); diff --git a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs index 3bf7724c7..003eda772 100644 --- a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs +++ b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore/EntityConfigurations/PersistedGrantEntityTypeConfiguration.cs @@ -1,4 +1,4 @@ -// Copyright (c) MASA Stack All rights reserved. +// 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.EntityConfigurations; @@ -13,7 +13,6 @@ public void Configure(EntityTypeBuilder builder) 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(); From 7db3fc9fd2cc61757a6a88ca6b67dbd11cbc0322 Mon Sep 17 00:00:00 2001 From: MayueCif Date: Wed, 4 Mar 2026 15:18:04 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=B0=83=E6=95=B4DeviceFlowCodes=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E9=85=8D=E7=BD=AE=E5=8F=8A=E7=89=88=E6=9D=83=E5=A3=B0?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 完善MIT License声明,统一命名空间为通用EntityConfigurations。优化字段配置,移除部分IsRequired(false)和CreationTime配置,简化字段声明,提升代码规范性与可维护性。 --- .../DeviceFlowCodesEntityTypeConfiguration.cs | 3 +-- .../DeviceFlowCodesEntityTypeConfiguration.cs | 1 - .../DeviceFlowCodesEntityTypeConfiguration.cs | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.Oracle/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.Oracle/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs index d036bd954..e535281d2 100644 --- a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.Oracle/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs +++ b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.Oracle/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs @@ -1,4 +1,4 @@ -// Copyright (c) MASA Stack All rights reserved. +// 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.Oracle.EntityConfigurations; @@ -13,7 +13,6 @@ public void Configure(EntityTypeBuilder builder) builder.Property(x => x.SessionId).HasMaxLength(100).IsRequired(false); builder.Property(x => x.ClientId).HasMaxLength(200).IsRequired(); builder.Property(x => x.Description).HasMaxLength(200).IsRequired(false); - 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 diff --git a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs index 14ec6612e..9842e0ecd 100644 --- a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs +++ b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore.PostgreSql/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs @@ -13,7 +13,6 @@ public void Configure(EntityTypeBuilder builder) 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 diff --git a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs index 719ca42ed..b31c9c59c 100644 --- a/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs +++ b/src/Contrib/Authentication/OpenIdConnect/Masa.Contrib.Authentication.OpenIdConnect.EFCore/EntityConfigurations/DeviceFlowCodesEntityTypeConfiguration.cs @@ -1,4 +1,4 @@ -// Copyright (c) MASA Stack All rights reserved. +// 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.EntityConfigurations; @@ -13,7 +13,6 @@ public void Configure(EntityTypeBuilder builder) 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