Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public async Task <UserAccount> AddLocalCredentialsAsync(Guid userAccountId, string password)
        {
            var userAccount = await _userAccountStore.LoadByIdAsync(userAccountId);

            return(await AddLocalCredentialsAsync(userAccount, password));
        }
Exemplo n.º 3
0
 /// <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));
 }