dotnet / dotnet/aspnetcore

Add the ability for getting users having a type of claim

Open
#5,732 2 comments 1 reaction 0 assignees View on GitHub
affected-very-few area-identity enhancement severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

The UserManager exposes the method GetUsersForClaimAsync(Claim claim).
This method takes a claim and returns a list of users with that claim.
Sometimes it is needed to find all users by a specific claim type, ignoring the value.

A method like GetUsersForClaimTypeAsync(string claimType) would be great.
It would need to be added to the IUserClaimStore interface, and thus the UserStore(s) too.

Doing this by inheritance is a pain since the UserClaims property is private.
Otherwise a slightly modified query as from the GetUsersForClaimAsync is all that is needed, where claimType is a string.

` var query = from userclaims in UserClaims
join user in Users on userclaims.UserId equals user.Id
where userclaims.ClaimType == claimType
select user;`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.