Skip to content

Commit

Permalink
add JwtRegisteredClaimNames
Browse files Browse the repository at this point in the history
  • Loading branch information
iammukeshm committed Oct 22, 2024
1 parent 1500c59 commit d080e99
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using IdentityConstants = FSH.Starter.Shared.Authorization.IdentityConstants;

namespace FSH.Framework.Infrastructure.Identity.Tokens;
public sealed class TokenService : ITokenService
Expand Down Expand Up @@ -134,14 +133,14 @@ private string GenerateEncryptedToken(SigningCredentials signingCredentials, IEn
private List<Claim> GetClaims(FshUser user, string ipAddress) =>
new List<Claim>
{
new(ClaimTypes.NameIdentifier, user.Id),
new(ClaimTypes.Email, user.Email!),
new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new(JwtRegisteredClaimNames.Sub, user.Id),
new(JwtRegisteredClaimNames.Email, user.Email!),
new(JwtRegisteredClaimNames.Name, user.FirstName ?? string.Empty),
new(FshClaims.Fullname, $"{user.FirstName} {user.LastName}"),
new(ClaimTypes.Name, user.FirstName ?? string.Empty),
new(ClaimTypes.Surname, user.LastName ?? string.Empty),
new(FshClaims.IpAddress, ipAddress),
new(FshClaims.Tenant, _multiTenantContextAccessor!.MultiTenantContext.TenantInfo!.Id),
new(ClaimTypes.MobilePhone, user.PhoneNumber ?? string.Empty),
new(FshClaims.ImageUrl, user.ImageUrl == null ? string.Empty : user.ImageUrl.ToString())
};
private static string GenerateRefreshToken()
Expand Down

0 comments on commit d080e99

Please sign in to comment.