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

Support multiple valid header and query keys #14

Merged
merged 2 commits into from
Jul 12, 2023

Conversation

dnmh-psc
Copy link
Contributor

Changed ApiKeyAuthenticationOptions to accept multiple allowed HeaderKeys and QueryKeys, so that multiple header and query keys can be valid.

If multiple valid query/header keys are added to a request, then each value for each valid key are validated as api key.

For example:

https://localhost:44362/TestApiKey?my-first-key=ABC&my-second-key=DEF

If both my-first-key and my-second-key are configured as valid keys (through ApiKeyAuthenticationOptions.QueryKeys), then both ABC and DEF are validated. The first valid API key is used to create a valid ClaimsPrinciple. If the first checked api key is not valid, then the next is checked before failing authentication.

@dnmh-psc dnmh-psc self-assigned this Jul 12, 2023
@dnmh-psc dnmh-psc merged commit 140b83a into main Jul 12, 2023
1 check passed
@dnmh-psc dnmh-psc deleted the support-multiple-valid-header-and-query-keys branch July 12, 2023 11:12
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

Successfully merging this pull request may close these issues.

None yet

2 participants