KestrunHostAuthExtensions.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 scheme = "ApiKey", 
    Action<ApiKeyAuthenticationOptions>? configure = null)
parameter description
host The Kestrun host instance.
scheme The authentication scheme name (default is “ApiKey”).
configure Optional configuration for ApiKeyAuthenticationOptions.

Return Value

The configured KestrunHost instance.

See Also


KestrunHostAuthExtensions.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 scheme, 
    ApiKeyAuthenticationOptions configure)
parameter description
host The Kestrun host instance.
scheme The authentication scheme name.
configure The ApiKeyAuthenticationOptions object to configure the authentication.

Return Value

The configured KestrunHost instance.

See Also