-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fixing so that we can have multiple of same claim type #66
Conversation
/// </summary> | ||
public class ClientPrincipal | ||
{ | ||
#pragma warning disable CA1707, CS8618 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the warnings that are being disabled as a comment?
I have no idea what CA1707 and CS8618 are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
} | ||
|
||
response.ContentType = "application/json; charset=utf-8"; | ||
var options = new JsonSerializerOptions(_serializerOptions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make the JsonSerializerOptions a class variable instead of creating it each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Makes sense.
/// <param name="request"><see cref="HttpRequest"/> that holds all the request information.</param> | ||
/// <param name="response"><see cref="HttpResponse"/> that will be written to.</param> | ||
/// <returns>Awaitable task.</returns> | ||
public async Task Handler(HttpRequest request, HttpResponse response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a style preference but I like to turn more complex conditionals into predicate functions.
So instead of checking all the request headers individually, a function called something like HasValidIdentityHeaders(). Also something further down like "IsValidJsonToken".
For a more simple method with a more technical role, it's perfectly ok to keep everything inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree to this, and also revert the test to reduce nesting
Fixed
IdentityProviderEndpoint
to handle multiple claims with same type.IdentityProviderEndpoint
and setup to be more testable.IdentityProviderEndpoint
and setup code.