Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Union extension method on IList<Claim> type #94

Open
N1K0232 opened this issue Sep 12, 2023 · 4 comments
Open

Union extension method on IList<Claim> type #94

N1K0232 opened this issue Sep 12, 2023 · 4 comments

Comments

@N1K0232
Copy link

N1K0232 commented Sep 12, 2023

I had an idea for a new extension method that I started using in my projects
After sign-in task, I create a collection of claims. Usually this collection ends with the list of the roles, the user has.

Since a Jwt bearer token allows the user to have more values for the same type, my idea is to create an extension method that can add a list of string values for a given claim type

Here my example:
public static void Union(this IList claims, string claimType, IEnumerable values)

Could this approach be possible to avoid code duplication each time?

@marcominerva
Copy link
Owner

Perhaps the correct signature for your proposal should be:

public static void Union(this IList<Claim> claims, string claimType, IEnumerable values);

Is it correct?

@N1K0232
Copy link
Author

N1K0232 commented Sep 12, 2023

Yes correct. I meant that one

@marcominerva
Copy link
Owner

So, what about making a pull request? ;)

@N1K0232
Copy link
Author

N1K0232 commented Sep 19, 2023

Ok. I can try. Thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants