public async Task <string> GetSecurityStampAsync(TUser user, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (user == null)
            {
                throw new ArgumentNullException("The user parameter is null or incorrect.");
            }

            if (!string.IsNullOrEmpty(user.SecurityStamp))
            {
                return(user.SecurityStamp);
            }

            var actor = await _userRepository.GetUserFromEmail(user.Email);

            return(actor.SecurityStamp);
        }
Beispiel #2
0
        public async Task <ApplicationUser> GetUserFromEmail(string email)
        {
            var result = await _instance.GetUserFromEmail(email);

            if (result == null)
            {
                return(null);
            }

            result.Email    = _personalDataProtector.Unprotect(result.Email);
            result.UserName = _personalDataProtector.Unprotect(result.UserName);

            return(result);
        }