KestrunHostAuthnExtensions.AddCookieAuthentication method (1 of 2)

Adds Cookie Authentication to the Kestrun host.

Use this for browser-based authentication using cookies.

public static KestrunHost AddCookieAuthentication(this KestrunHost host, 
    string authenticationScheme = "Cookies", string? displayName = "Cookies Authentication", 
    Action<CookieAuthOptions>? configureOptions = null, ClaimPolicyConfig? claimPolicy = null)
parameter description
host The Kestrun host instance.
authenticationScheme The authentication scheme name (default is CookieAuthenticationDefaults.AuthenticationScheme).
displayName The display name for the authentication scheme.
configureOptions Optional configuration for CookieAuthenticationOptions.
claimPolicy Optional authorization policy configuration.

Return Value

The configured KestrunHost instance.

See Also


KestrunHostAuthnExtensions.AddCookieAuthentication method (2 of 2)

Adds Cookie Authentication to the Kestrun host using the provided options object.

public static KestrunHost AddCookieAuthentication(this KestrunHost host, 
    string authenticationScheme = "Cookies", string? displayName = "Cookies Authentication", 
    CookieAuthOptions? configureOptions = null, ClaimPolicyConfig? claimPolicy = null)
parameter description
host The Kestrun host instance.
authenticationScheme The authentication scheme name (default is CookieAuthenticationDefaults.AuthenticationScheme).
displayName The display name for the authentication scheme.
configureOptions The CookieAuthenticationOptions object to configure the authentication.
claimPolicy Optional authorization policy configuration.

Return Value

The configured KestrunHost instance.

See Also