Skip to content

Commit

Permalink
Update claims in TokenService and add mobile phone claim (#1058)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jacekmichalski authored Nov 22, 2024
1 parent cd770dc commit e7b5514
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,10 @@ private List<Claim> GetClaims(FshUser user, string ipAddress) =>
new List<Claim>
{
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),
Expand Down

0 comments on commit e7b5514

Please sign in to comment.