ApiKeyAuthenticationOptions class
Options for API key authentication, including header names, validation, and claims issuance.
public class ApiKeyAuthenticationOptions : AuthenticationSchemeOptions, IAuthenticationCommonOptions
Public Members
name | description |
---|---|
ApiKeyAuthenticationOptions() | The default constructor. |
AdditionalHeaderNames { get; set; } | Other headers to try if the primary one is missing. |
AllowQueryStringFallback { get; set; } | If true, also look for the key in the query string. |
ChallengeHeaderFormat { get; set; } | Format for the WWW-Authenticate header in 401 responses. |
ClaimPolicyConfig { get; set; } | Gets or sets the claim policy configuration. |
EmitChallengeHeader { get; set; } | If true, includes the WWW-Authenticate header in 401 responses. |
ExpectedKey { get; set; } | Single expected API key (used if ValidateKey is not set). |
ExpectedKeyBytes { get; } | Gets the expected API key as a UTF-8 byte array, or null if ExpectedKey is not set. |
HeaderName { get; set; } | Name of the header to look for the API key. |
IssueClaims { get; set; } | After credentials are valid, this is called to add extra Claims. Parameters: HttpContext, username → IEnumerable of extra claims. |
IssueClaimsCodeSettings { get; set; } | Settings for the claims issuing code, if using a script. |
Logger { get; set; } | Logger for this authentication scheme. |
RequireHttps { get; set; } | If true, requires HTTPS for API key requests. |
ValidateCodeSettings { get; set; } | Settings for the authentication code, if using a script. |
ValidateKeyAsync { get; set; } | Called to validate the raw key string. Return true if valid. |
See Also
- interface IAuthenticationCommonOptions
- namespace Kestrun.Authentication