From 72847a32774665c91a4a69c2bee30603eb301f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 20 Sep 2019 17:42:42 +0300 Subject: [PATCH] PersistedGrantStore should not set protected Entity.Id --- .../Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs | 3 ++- .../Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs index ab8bb6ffbd..400b5c0e26 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Threading.Tasks; using IdentityServer4.Stores; +using Volo.Abp.Domain.Entities; using Volo.Abp.Guids; using Volo.Abp.ObjectMapping; @@ -26,7 +27,7 @@ namespace Volo.Abp.IdentityServer.Grants if (entity == null) { entity = _objectMapper.Map(grant); - entity.Id = _guidGenerator.Create(); + EntityHelper.TrySetId(entity, () => _guidGenerator.Create()); await _persistentGrantRepository.InsertAsync(entity); } else diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs index 342d1978a2..8e83f57c51 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs @@ -140,7 +140,8 @@ namespace Volo.Abp.IdentityServer.Clients { Key = "#1P3R", Type = "Type", - ClientId = "ClientId" + ClientId = "ClientId", + Data = "" }); //Act