Example #1
0
 public override async Task AddClaimsAsync(User user, IEnumerable <Claim> claims,
                                           CancellationToken cancellationToken = default)
 {
     cancellationToken.ThrowIfCancellationRequested();
     var claimsToCreate = claims.Select(claim => CreateUserClaim(user, claim));
     await _usersClaims.AddClaimsAsync(claimsToCreate, cancellationToken);
 }
Example #2
0
        public Task AddClaimsAsync(BL.Models.User user, IEnumerable <Claim> claims, CancellationToken cancellationToken)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user), "Parameter user is not set to an instance of an object.");
            }

            if (claims == null)
            {
                throw new ArgumentNullException(nameof(claims), "Parameter claims is not set to an instance of an object.");
            }

            cancellationToken.ThrowIfCancellationRequested();
            return(_usersClaimsRepository.AddClaimsAsync(_mapper.Map <DL.Models.User>(user), claims));
        }