From 548d8ccf092d36b2a04adff51ec919036b396417 Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Sun, 29 Oct 2023 14:57:00 -0400 Subject: [PATCH] Minor code cleanups in `TokenFactory` --- src/Tgstation.Server.Host/Security/TokenFactory.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tgstation.Server.Host/Security/TokenFactory.cs b/src/Tgstation.Server.Host/Security/TokenFactory.cs index 81a96876f6..9ceac820ca 100644 --- a/src/Tgstation.Server.Host/Security/TokenFactory.cs +++ b/src/Tgstation.Server.Host/Security/TokenFactory.cs @@ -112,7 +112,7 @@ namespace Tgstation.Server.Host.Security var nowUnix = now.ToUnixTimeSeconds(); // this prevents validation conflicts down the line - // tldr we can (theoretically) send a token the same second we receive it + // tldr we can (theoretically) receive a token the same second after we generate it // since unix time rounds down, it looks like it came from before the user changed their password // this happens occasionally in unit tests // just delay a second so we can force a round up @@ -125,9 +125,9 @@ namespace Tgstation.Server.Host.Security : securityConfiguration.TokenExpiryMinutes); var claims = new Claim[] { - new Claim(JwtRegisteredClaimNames.Sub, user.Id.Value.ToString(CultureInfo.InvariantCulture)), - new Claim(JwtRegisteredClaimNames.Exp, expiry.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture)), - new Claim(JwtRegisteredClaimNames.Nbf, nowUnix.ToString(CultureInfo.InvariantCulture)), + new (JwtRegisteredClaimNames.Sub, user.Id.Value.ToString(CultureInfo.InvariantCulture)), + new (JwtRegisteredClaimNames.Exp, expiry.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture)), + new (JwtRegisteredClaimNames.Nbf, nowUnix.ToString(CultureInfo.InvariantCulture)), issuerClaim, audienceClaim, };