共用方式為


CookieAuthenticationOptions 類別

定義

CookieAuthenticationOptions的組態選項。

public ref class CookieAuthenticationOptions : Microsoft::AspNetCore::Authentication::AuthenticationSchemeOptions
public class CookieAuthenticationOptions : Microsoft.AspNetCore.Authentication.AuthenticationSchemeOptions
type CookieAuthenticationOptions = class
    inherit AuthenticationSchemeOptions
Public Class CookieAuthenticationOptions
Inherits AuthenticationSchemeOptions
繼承
CookieAuthenticationOptions

建構函式

名稱 Description
CookieAuthenticationOptions()

建立一個以預設值初始化的選項實例

屬性

名稱 Description
AccessDeniedPath

處理程序在處理 ForbidAsync 時會使用 AccessDeniedPath 屬性作為重定向目標。

ClaimsIssuer

取得或設定應用於任何理賠的發卡機構

(繼承來源 AuthenticationSchemeOptions)
Cookie

決定建立 Cookie 時所用的設定。

CookieDomain
已淘汰.

此屬性已過時,未來版本將被移除。 推薦的替代方案是 <seealso cref=“P:Microsoft。AspNetCore.Http.CookieBuilder.Domain“></seealso> on Cookie.

決定建立 Cookie 所使用的網域。 並非預設提供。

CookieHttpOnly
已淘汰.
已淘汰.

此屬性已過時,未來版本將被移除。 推薦的替代方案是 <seealso cref=“P:Microsoft。AspNetCore.Http.CookieBuilder.HttpOnly“></seealso>Cookie

判斷瀏覽器是否應該允許客戶端 JavaScript 存取 Cookie。 預設為 true,這表示 cookie 只會傳遞給 http 請求,且不會讓頁面上的腳本存取。

CookieManager

這個元件原本用來從請求中取得 Cookie,或在回應中設定 Cookie。

預設會使用 ChunkingCookieManager。

CookieName
已淘汰.
已淘汰.

此屬性已過時,未來版本將被移除。 推薦的替代方案是 <seealso cref=“P:Microsoft。AspNetCore.Http.CookieBuilder.Name“></seealso>Cookie

決定用來持久化身份的 cookie 名稱。 預設值為「。AspNetCore.Cookies」。 如果你更改 AuthenticationScheme 名稱,尤其是系統多次使用 Cookie 認證處理程序時,這個值應該會被更改。

CookiePath
已淘汰.

此屬性已過時,未來版本將被移除。 推薦的替代方案是 <seealso cref=“P:Microsoft。AspNetCore.Http.CookieBuilder.Path“></seealso> on Cookie

決定建立 Cookie 的路徑。 預設值為「/」以達到最高瀏覽器相容性。

CookieSecure
已淘汰.

此屬性已過時,未來版本將被移除。 推薦的替代方案是 <seealso cref=“P:Microsoft。AspNetCore.Http.CookieBuilder.SecurePolicy“></seealso> on Cookie.

判斷 cookie 是否僅應在 HTTPS 請求時傳送。 預設是如果執行 SignIn 的頁面也是 HTTPS 的,則 Cookie 會限制只能使用 HTTPS 請求。 如果你有 HTTPS 登入頁面,且網站部分區域是 HTTP,可能需要更改這個值。

DataProtectionProvider

若設定為此,CookieAuthenticationHandler 將用於資料保護。

Events

提供者可指派給應用程式啟動時建立的物件實例。 處理器會呼叫提供者的方法,讓應用程式在處理過程中的特定時刻擁有控制權。 若未提供,則會提供一個預設實例,呼叫方法時不會有任何反應。

EventsType

如果設定為 ,將作為取得 Events 實例而非屬性的服務類型。

(繼承來源 AuthenticationSchemeOptions)
ExpireTimeSpan

控制從 Cookie 建立起,驗證工單在 Cookie 中能維持有效的時間。 到期資訊會儲存在受保護的餅乾票中。 因此,即使過期的 Cookie 在瀏覽器應該清除後傳給伺服器,也會被忽略。

此性質應用來取代 Expiration,後者會被忽略。

ForwardAuthenticate

若設定為此,則指定該方案應轉發 AuthenticateAsync 呼叫的目標方案。 例如 Context.AuthenticateAsync(“ThisScheme”)=> Context.AuthenticateAsync(“ForwardAuthenticateValue”);將目標設定為目前的方案,以停用轉發並允許正常處理。

(繼承來源 AuthenticationSchemeOptions)
ForwardChallenge

若設定為此,則指定該方案應轉發 ChallengeAsync 呼叫的目標方案。 例如 Context.ChallengeAsync(“ThisScheme”) => Context.ChallengeAsync(“ForwardChallengeValue”);將目標設定為目前的方案,以停用轉發並允許正常處理。

(繼承來源 AuthenticationSchemeOptions)
ForwardDefault

若設定為此,則指定一個預設方案,驗證處理者應預設將所有認證操作轉發至此。 預設轉發邏輯會先檢查最特定的 ForwardAuthenticate/Challenge/Forbid/SignIn/SignOut,接著檢查 ForwardDefaultSelector,最後檢查 ForwardDefault。 第一個非零結果將作為轉發的目標方案。

(繼承來源 AuthenticationSchemeOptions)
ForwardDefaultSelector

用於選擇當前請求的預設方案,驗證處理者應預設將所有驗證操作轉發至該方案。 預設轉發邏輯會先檢查最特定的 ForwardAuthenticate/Challenge/Forbid/SignIn/SignOut,接著檢查 ForwardDefaultSelector,最後檢查 ForwardDefault。 第一個非零結果將作為轉發的目標方案。

(繼承來源 AuthenticationSchemeOptions)
ForwardForbid

若設定為 ,則指定該方案應轉發 ForbidAsync 呼叫的目標方案。 例如 Context.ForbidAsync(“ThisScheme”) => Context.ForbidAsync(“ForwardForbidValue”);將目標設定為目前的方案,以停用轉發並允許正常處理。

(繼承來源 AuthenticationSchemeOptions)
ForwardSignIn

若設定為此,則指定該方案應轉發 SignInAsync 呼叫的目標方案。 例如 Context.SignInAsync(“ThisScheme”)=> Context.SignInAsync(“ForwardSignInValue”);將目標設定為目前的方案,以停用轉發並允許正常處理。

(繼承來源 AuthenticationSchemeOptions)
ForwardSignOut

若設定為此,則指定該方案應轉發 SignOutAsync 呼叫的目標方案。 例如 Context.SignOutAsync(“ThisScheme”)=> Context.SignOutAsync(“ForwardSignOutValue”);將目標設定為目前的方案,以停用轉發並允許正常處理。

(繼承來源 AuthenticationSchemeOptions)
LoginPath

LoginPath 屬性是處理程序處理 ChallengeAsync 時用於重定向目標的屬性。 目前的網址會被加入 LoginPath 的查詢字串參數,由 ReturnUrlParameter 命名。 一旦向 LoginPath 請求獲得新的 SignIn 身份,ReturnUrlParameter 值會被用來將瀏覽器重新導向回原始網址。

LogoutPath

如果 LogoutPath 是處理器,則對該路徑的請求會根據 ReturnUrlParameter 進行重新導向。

ReturnUrlParameter

ReturnUrlParameter 決定了查詢字串參數的名稱,該參數由處理器在挑戰期間附加。 這也是當請求抵達登入路徑或登出路徑時,為了在執行動作後返回原始網址而尋找的查詢字串參數。

SessionStore

一個可選的容器,用於跨請求儲存身份。 使用時,用戶端只會傳送一個會話識別碼。 這可以用來減輕在非常大恆等式下可能出現的問題。

SlidingExpiration

SlidingExpiration 設定為 true,指示處理器在處理超過過期視窗一半的請求時重新發出新的 cookie,並設定新的到期時間。

TicketDataFormat

TicketDataFormat 用於保護與解除 Cookie 值中儲存的身份及其他屬性。 若未提供,則會用 建立一個。DataProtectionProvider

TimeProvider

用於測試。

(繼承來源 AuthenticationSchemeOptions)

方法

名稱 Description
Validate()

確認選項是否有效。 如果狀況不好,應該會拋出例外。

(繼承來源 AuthenticationSchemeOptions)
Validate(String)

檢查選項是否適用於特定方案

(繼承來源 AuthenticationSchemeOptions)

適用於