From 07ad1558feef8d8fe2cffbf777579e87730717f8 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 9 Oct 2019 13:04:25 +0800 Subject: [PATCH] IdentityServer minor revison notes. Resolve #195 --- .../Abp/IdentityServer/ApiResources/ApiScopeConsts.cs | 6 +++--- .../Volo/Abp/IdentityServer/Clients/ClientConsts.cs | 8 ++++---- .../Abp/IdentityServer/Clients/ClientGrantTypeConsts.cs | 2 +- .../IdentityServer/Clients/ClientIdPRestrictionConsts.cs | 2 +- .../Clients/ClientPostLogoutRedirectUriConsts.cs | 2 +- .../Abp/IdentityServer/Clients/ClientPropertyConsts.cs | 4 ++-- .../Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs | 2 +- .../Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs | 2 +- .../Abp/IdentityServer/Grants/PersistedGrantConsts.cs | 4 ++++ .../Volo/Abp/IdentityServer/SecretConsts.cs | 6 +++--- .../Volo/Abp/IdentityServer/UserClaimConsts.cs | 2 +- .../IdentityServerDbContextModelCreatingExtensions.cs | 3 ++- 12 files changed, 24 insertions(+), 19 deletions(-) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs index 79629fee83..d52b953921 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/ApiResources/ApiScopeConsts.cs @@ -2,8 +2,8 @@ { public class ApiScopeConsts { - public const int NameMaxLength = 196; - public const int DisplayNameMaxLength = 128; - public const int DescriptionMaxLength = 256; + public const int NameMaxLength = 200; + public const int DisplayNameMaxLength = 200; + public const int DescriptionMaxLength = 1000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientConsts.cs index 40cc90259b..ca69c51eef 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientConsts.cs @@ -8,15 +8,15 @@ public const int ClientNameMaxLength = 200; - public const int ClientUriMaxLength = 300; + public const int ClientUriMaxLength = 2000; - public const int LogoUriMaxLength = 300; + public const int LogoUriMaxLength = 2000; public const int DescriptionMaxLength = 1000; - public const int FrontChannelLogoutUriMaxLength = 300; + public const int FrontChannelLogoutUriMaxLength = 2000; - public const int BackChannelLogoutUriMaxLength = 300; + public const int BackChannelLogoutUriMaxLength = 2000; public const int ClientClaimsPrefixMaxLength = 200; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientGrantTypeConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientGrantTypeConsts.cs index f13f6cda1e..5f94c51f97 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientGrantTypeConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientGrantTypeConsts.cs @@ -2,6 +2,6 @@ { public class ClientGrantTypeConsts { - public const int GrantTypeMaxLength = 196; + public const int GrantTypeMaxLength = 250; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs index d89d76bdc5..c71301871a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientIdPRestrictionConsts.cs @@ -2,6 +2,6 @@ { public class ClientIdPRestrictionConsts { - public const int ProviderMaxLength = 64; + public const int ProviderMaxLength = 200; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs index 1200e47cfa..8fe55ba018 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPostLogoutRedirectUriConsts.cs @@ -2,6 +2,6 @@ { public class ClientPostLogoutRedirectUriConsts { - public const int PostLogoutRedirectUriMaxLength = 200; + public const int PostLogoutRedirectUriMaxLength = 2000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs index 44ab04e517..6535304596 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientPropertyConsts.cs @@ -2,7 +2,7 @@ { public class ClientPropertyConsts { - public const int KeyMaxLength = 64; - public const int ValueMaxLength = 128; + public const int KeyMaxLength = 250; + public const int ValueMaxLength = 2000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs index b04588fb27..d67bbea509 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientRedirectUriConsts.cs @@ -2,6 +2,6 @@ { public class ClientRedirectUriConsts { - public const int RedirectUriMaxLength = 200; + public const int RedirectUriMaxLength = 2000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs index 9b9d4f8077..6a5b62e692 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Clients/ClientScopeConsts.cs @@ -2,6 +2,6 @@ { public class ClientScopeConsts { - public const int ScopeMaxLength = 196; + public const int ScopeMaxLength = 200; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs index 75f67dcc3a..96a268a0e7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Grants/PersistedGrantConsts.cs @@ -6,5 +6,9 @@ public const int TypeMaxLength = 50; public const int SubjectIdMaxLength = 200; public const int ClientIdMaxLength = 200; + + // 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 + public const int DataMaxLength = 5000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs index 1194a7c82d..b21f901f25 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/SecretConsts.cs @@ -2,8 +2,8 @@ { public class SecretConsts { - public const int TypeMaxLength = 32; - public const int ValueMaxLength = 196; - public const int DescriptionMaxLength = 256; + public const int TypeMaxLength = 250; + public const int ValueMaxLength = 4000; + public const int DescriptionMaxLength = 2000; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/UserClaimConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/UserClaimConsts.cs index bb10344a63..9133482f1f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/UserClaimConsts.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/UserClaimConsts.cs @@ -2,6 +2,6 @@ { public class UserClaimConsts { - public const int TypeMaxLength = 196; + public const int TypeMaxLength = 200; } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 2c722f58ab..58fb39f8a5 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -151,11 +151,12 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore grant.Property(x => x.SubjectId).HasMaxLength(PersistedGrantConsts.SubjectIdMaxLength); grant.Property(x => x.ClientId).HasMaxLength(PersistedGrantConsts.ClientIdMaxLength).IsRequired(); grant.Property(x => x.CreationTime).IsRequired(); - grant.Property(x => x.Data).IsRequired(); + grant.Property(x => x.Data).HasMaxLength(PersistedGrantConsts.DataMaxLength).IsRequired(); grant.HasKey(x => x.Key); //TODO: What about Id!!! grant.HasIndex(x => new { x.SubjectId, x.ClientId, x.Type }); + grant.HasIndex(x => x.Expiration); }); builder.Entity(identityResource =>