From e7b55147268598c87c390ac40eb9e49b87f32d57 Mon Sep 17 00:00:00 2001 From: Jacek Michalski Date: Fri, 22 Nov 2024 21:47:33 +0100 Subject: [PATCH] Update claims in TokenService and add mobile phone claim (#1058) Replaced JwtRegisteredClaimNames with ClaimTypes for NameIdentifier, Email, and Name in the GetClaims method. Added a new claim for ClaimTypes.MobilePhone to include the user's phone number. --- .../Infrastructure/Identity/Tokens/TokenService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api/framework/Infrastructure/Identity/Tokens/TokenService.cs b/src/api/framework/Infrastructure/Identity/Tokens/TokenService.cs index 1eb27e300..ca633e70c 100644 --- a/src/api/framework/Infrastructure/Identity/Tokens/TokenService.cs +++ b/src/api/framework/Infrastructure/Identity/Tokens/TokenService.cs @@ -134,9 +134,10 @@ private List GetClaims(FshUser user, string ipAddress) => new List { new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()), - new(JwtRegisteredClaimNames.Sub, user.Id), - new(JwtRegisteredClaimNames.Email, user.Email!), - new(JwtRegisteredClaimNames.Name, user.FirstName ?? string.Empty), + new(ClaimTypes.NameIdentifier, user.Id), + new(ClaimTypes.Email, user.Email!), + new(ClaimTypes.Name, user.FirstName ?? string.Empty), + new(ClaimTypes.MobilePhone, user.PhoneNumber ?? string.Empty), new(FshClaims.Fullname, $"{user.FirstName} {user.LastName}"), new(ClaimTypes.Surname, user.LastName ?? string.Empty), new(FshClaims.IpAddress, ipAddress),