KestrunHostAuthExtensions.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 scheme = "Cookies", 
    Action<CookieAuthenticationOptions>? configure = null, ClaimPolicyConfig? claimPolicy = null)
parameter description
host The Kestrun host instance.
scheme The authentication scheme name (default is CookieAuthenticationDefaults.AuthenticationScheme).
configure Optional configuration for CookieAuthenticationOptions.
claimPolicy Optional authorization policy configuration.

Return Value

The configured KestrunHost instance.

See Also


KestrunHostAuthExtensions.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 scheme = "Cookies", 
    CookieAuthenticationOptions? configure = null, ClaimPolicyConfig? claimPolicy = null)
parameter description
host The Kestrun host instance.
scheme The authentication scheme name (default is CookieAuthenticationDefaults.AuthenticationScheme).
configure The CookieAuthenticationOptions object to configure the authentication.
claimPolicy Optional authorization policy configuration.

Return Value

The configured KestrunHost instance.

See Also