public static async Task <IList <Claim> > GetClaimsAsync(this IUsersClaimsRepository usersClaims,
                                                          Guid userId, CancellationToken cancellationToken = default)
 {
     cancellationToken.ThrowIfCancellationRequested();
     return((await usersClaims.ProcessQueryAsync(
                 usersClaims.AsQueryable()
                 .Where(x => x.UserId == userId),
                 cancellationToken)).Select(x => x.ToClaim()).ToList());
 }
 public static async Task <IReadOnlyCollection <UserClaim> > FindMatchedClaimsAsync(
     this IUsersClaimsRepository usersClaims,
     Guid userId, string value, string type, CancellationToken cancellationToken = default)
 {
     cancellationToken.ThrowIfCancellationRequested();
     return(await usersClaims.ProcessQueryAsync(
                usersClaims.AsQueryable()
                .Where(x => x.UserId == userId && x.ClaimValue == value && x.ClaimType == type),
                cancellationToken));
 }
 public static async Task <IReadOnlyCollection <User> > GetUsersForClaimAsync(
     this IUsersClaimsRepository usersClaims,
     Claim claim, IUsersRepository users, CancellationToken cancellationToken = default)
 {
     cancellationToken.ThrowIfCancellationRequested();
     return(await users.ProcessQueryAsync(
                usersClaims.AsQueryable()
                .Where(userClaim => userClaim.ClaimValue == claim.Value && userClaim.ClaimType == claim.Type)
                .Join(users.AsQueryable(), userClaim => userClaim.UserId, user => user.Id,
                      (userClaim, user) => user),
                cancellationToken));
 }
Beispiel #4
0
 public UserStore(IUsersRepository usersRepository,
                  IUsersRolesRepository usersRolesRepository,
                  IRolesRepository rolesRepository,
                  IUsersClaimsRepository usersClaimsRepository,
                  IUsersLoginsRepository usersLoginsRepository)
 {
     _usersRepository       = usersRepository;
     _usersRolesRepository  = usersRolesRepository;
     _rolesRepository       = rolesRepository;
     _usersClaimsRepository = usersClaimsRepository;
     _usersLoginsRepository = usersLoginsRepository;
 }
Beispiel #5
0
 public UserStore(IUsersRepository usersRepository,
                  IUsersRolesRepository usersRolesRepository,
                  IRolesRepository rolesRepository,
                  IUsersClaimsRepository usersClaimsRepository,
                  IUsersLoginsRepository usersLoginsRepository,
                  IMapper mapper)
 {
     _usersRepository       = usersRepository;
     _usersRolesRepository  = usersRolesRepository;
     _rolesRepository       = rolesRepository;
     _usersClaimsRepository = usersClaimsRepository;
     _usersLoginsRepository = usersLoginsRepository;
     _mapper = mapper;
 }
 public UserStore(
     IdentityErrorDescriber describer,
     IUsersRepository users,
     IRolesRepository roles,
     IUsersClaimsRepository usersClaims,
     IUsersLoginsRepository usersLogins,
     IUsersTokensRepository usersTokens,
     IUsersRolesRepository usersRoles
     ) : base(describer)
 {
     _users       = users;
     _roles       = roles;
     _usersClaims = usersClaims;
     _usersLogins = usersLogins;
     _usersTokens = usersTokens;
     _usersRoles  = usersRoles;
 }