예제 #1
0
        public async Task SetPhoneNumberConfirmedAsync(User user, bool confirmed, CancellationToken cancellationToken)
        {
            user.PhoneNumberConfirmed = confirmed;

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #2
0
        public async Task SetNormalizedEmailAsync(User user, string normalizedEmail, CancellationToken cancellationToken)
        {
            user.NormalizedEmail = normalizedEmail;

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #3
0
        public async Task SetPhoneNumberAsync(User user, string phoneNumber, CancellationToken cancellationToken)
        {
            user.PhoneNumber = phoneNumber;

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #4
0
        public async Task AddLoginAsync(User user, UserLoginInfo login, CancellationToken cancellationToken)
        {
            user.Logins.Add(login);

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #5
0
        public async Task SetPasswordHashAsync(User user, string passwordHash, CancellationToken cancellationToken)
        {
            user.PasswordHash = passwordHash;

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #6
0
        public async Task RemoveLoginAsync(User user, string loginProvider, string providerKey, CancellationToken cancellationToken)
        {
            user.Logins.Remove(user.Logins.Single(l => l.ProviderKey == providerKey));

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #7
0
        public async Task <IdentityResult> UpdateAsync(User user, CancellationToken cancellationToken)
        {
            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }

            return(IdentityResult.Success);
        }
예제 #8
0
        public async Task SetUserNameAsync(User user, string userName, CancellationToken cancellationToken)
        {
            user.Username = userName;

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #9
0
        public async Task SetEmailConfirmedAsync(CloudyUser user, bool confirmed, CancellationToken cancellationToken)
        {
            user.EmailConfirmed = confirmed;

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #10
0
        public async Task SetEmailAsync(CloudyUser user, string email, CancellationToken cancellationToken)
        {
            user.Email = email;

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #11
0
        public async Task SetNormalizedUserNameAsync(CloudyUser user, string normalizedName, CancellationToken cancellationToken)
        {
            user.NormalizedUsername = normalizedName;

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #12
0
        public async Task AddClaimsAsync(User user, IEnumerable <Claim> claims, CancellationToken cancellationToken)
        {
            if (user.Claims == null)
            {
                user.Claims = new List <Claim>();
            }

            user.Claims.AddRange(claims);

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #13
0
        public async Task RemoveClaimsAsync(User user, IEnumerable <Claim> claims, CancellationToken cancellationToken)
        {
            if (user.Claims == null)
            {
                user.Claims = new List <Claim>();
            }

            var types = claims.Select(c => c.Type);

            user.Claims.RemoveAll(c => types.Contains(c.Type));

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }
예제 #14
0
        public async Task ReplaceClaimAsync(User user, Claim claim, Claim newClaim, CancellationToken cancellationToken)
        {
            if (user.Claims == null)
            {
                user.Claims = new List <Claim>();
            }

            var existing = user.Claims.SingleOrDefault(c => c.Type == claim.Type);

            if (existing != null)
            {
                user.Claims.Remove(existing);
            }

            user.Claims.Add(newClaim);

            if (user.Id != null)
            {
                await ContainerSpecificContentUpdater.UpdateAsync(user, Container);
            }
        }