KestrunHostAuthnExtensions.AddApiKeyAuthentication method (1 of 2)
Adds API Key Authentication to the Kestrun host.
Use this for endpoints that require an API key for access.
public static KestrunHost AddApiKeyAuthentication(this KestrunHost host,
string authenticationScheme = "ApiKey", string? displayName = "API Key Authentication",
Action<ApiKeyAuthenticationOptions>? configureOptions = null)
| parameter | description |
|---|---|
| host | The Kestrun host instance. |
| authenticationScheme | The authentication scheme name (default is “ApiKey”). |
| displayName | The display name for the authentication scheme (default is “API Key”). |
| configureOptions | Optional configuration for ApiKeyAuthenticationOptions. |
Return Value
The configured KestrunHost instance.
See Also
- class KestrunHost
- class ApiKeyAuthenticationOptions
- class KestrunHostAuthnExtensions
- namespace Kestrun.Hosting
KestrunHostAuthnExtensions.AddApiKeyAuthentication method (2 of 2)
Adds API Key Authentication to the Kestrun host using the provided options object.
public static KestrunHost AddApiKeyAuthentication(this KestrunHost host,
string authenticationScheme = "ApiKey", string? displayName = "API Key Authentication",
ApiKeyAuthenticationOptions? configureOptions = null)
| parameter | description |
|---|---|
| host | The Kestrun host instance. |
| authenticationScheme | The authentication scheme name. |
| displayName | The display name for the authentication scheme. |
| configureOptions | The ApiKeyAuthenticationOptions object to configure the authentication. |
Return Value
The configured KestrunHost instance.
See Also
- class KestrunHost
- class ApiKeyAuthenticationOptions
- class KestrunHostAuthnExtensions
- namespace Kestrun.Hosting