Skip to content

Commit cf044c3

Browse files
Adjusted the maximum token size dynamically based on the token length to prevent 403 Forbidden errors when handling large tokens.
(cherry picked from commit 0e437d5)
1 parent ca82946 commit cf044c3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dotnet/src/dotnetframework/GxClasses/Security/WebSecurity.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ internal static WebSecureToken getWebSecureToken(string signedToken, string secr
128128
using (var hmac = new System.Security.Cryptography.HMACSHA256(bSecretKey))
129129
{
130130
var handler = new JwtSecurityTokenHandler();
131+
if (signedToken.Length >= handler.MaximumTokenSizeInBytes)
132+
{
133+
handler.MaximumTokenSizeInBytes = signedToken.Length + 1;
134+
}
131135
var validationParameters = new TokenValidationParameters
132136
{
133137
ClockSkew = TimeSpan.FromMinutes(1),

0 commit comments

Comments
 (0)