public Task GetProfileDataAsync(ProfileDataRequestContext context) { var userAccountId = Guid.Parse(context.Subject.FindFirst(JwtClaimTypes.Subject).Value); var userAccount = _userAccountStore.LoadByIdAsync(userAccountId).Result; // TODO: get claims from db user var claims = new List <Claim> { new Claim(JwtClaimTypes.Subject, userAccount.Id.ToString()), new Claim(JwtClaimTypes.Email, userAccount.Email), new Claim(JwtClaimTypes.EmailVerified, userAccount.IsEmailVerified.ToString().ToLower(), ClaimValueTypes.Boolean) /* new Claim(JwtClaimTypes.Name, $"{user.FirstName} {user.LastName}"), * new Claim(JwtClaimTypes.GivenName, user.FirstName), * new Claim(JwtClaimTypes.FamilyName, user.LastName),*/ }; context.IssuedClaims = claims; return(Task.FromResult(0)); }
public async Task <UserAccount> AddLocalCredentialsAsync(Guid userAccountId, string password) { var userAccount = await _userAccountStore.LoadByIdAsync(userAccountId); return(await AddLocalCredentialsAsync(userAccount, password)); }
/// <summary> /// Loads user by its primary key /// </summary> /// <param name="id">UserId</param> /// <returns></returns> public async Task <UserAccount> LoadByIdAsync( Guid id) { return(await userAccountStore.LoadByIdAsync(id)); }