-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support multiple valid header and query keys (#14)
* Added support for multiple header and query keys in options and handler * Bumped major version
- Loading branch information
Showing
12 changed files
with
188 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
Source/AuthenticationHandler/Internal/ApiKeyAuthenticationOptionsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Dnmh.Security.ApiKeyAuthentication.AuthenticationHandler.Internal; | ||
|
||
/// <summary> | ||
/// Extensions methods for <see cref="ApiKeyAuthenticationOptions"/> | ||
/// </summary> | ||
internal static class ApiKeyAuthenticationOptionsExtensions | ||
{ | ||
/// <summary> | ||
/// Initializes default values for <see cref="ApiKeyAuthenticationOptions.HeaderKeys"/> and <see cref="ApiKeyAuthenticationOptions.QueryKeys"/>. | ||
/// </summary> | ||
public static void InitializeDefaultValues(this ApiKeyAuthenticationOptions options) | ||
{ | ||
if (options.AllowApiKeyInRequestHeader && options.HeaderKeys != null && !options.HeaderKeys.Any()) | ||
{ | ||
options.HeaderKeys.Add(ApiKeyAuthenticationOptions.DefaultHeaderKey); | ||
} | ||
if (options.AllowApiKeyInQuery && options.QueryKeys != null && !options.QueryKeys.Any()) | ||
{ | ||
options.QueryKeys.Add(ApiKeyAuthenticationOptions.DefaultQueryKey); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.