diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentitySessionConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentitySessionConsts.cs index 96cb8df5c99..ca047730eeb 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentitySessionConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentitySessionConsts.cs @@ -10,5 +10,5 @@ public class IdentitySessionConsts public static int MaxClientIdLength { get; set; } = 64; - public static int MaxIpAddressesLength { get; set; } = 256; + public static int MaxIpAddressesLength { get; set; } = 2048; } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentitySession.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentitySession.cs index c25a6b2e823..60ece055028 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentitySession.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentitySession.cs @@ -80,7 +80,22 @@ public IEnumerable GetIpAddresses() private static string JoinAsString(IEnumerable list) { var serialized = string.Join(",", list); - return serialized.IsNullOrWhiteSpace() ? null : serialized; + if (serialized.IsNullOrWhiteSpace()) + { + return null; + } + + while (serialized.Length > IdentitySessionConsts.MaxIpAddressesLength) + { + var lastCommaIndex = serialized.IndexOf(','); + if (lastCommaIndex < 0) + { + return serialized; + } + serialized = serialized.Substring(lastCommaIndex + 1); + } + + return serialized; } private string[] GetArrayFromString(string str)