CookieAuthenticationOptions 類別

定義

CookieAuthenticationMiddleware 的組態選項。

public ref class CookieAuthenticationOptions : Microsoft::AspNetCore::Builder::AuthenticationOptions, Microsoft::Extensions::Options::IOptions<Microsoft::AspNetCore::Builder::CookieAuthenticationOptions ^>
public class CookieAuthenticationOptions : Microsoft.AspNetCore.Builder.AuthenticationOptions, Microsoft.Extensions.Options.IOptions<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>
type CookieAuthenticationOptions = class
    inherit AuthenticationOptions
    interface IOptions<CookieAuthenticationOptions>
Public Class CookieAuthenticationOptions
Inherits AuthenticationOptions
Implements IOptions(Of CookieAuthenticationOptions)
繼承
CookieAuthenticationOptions
實作

建構函式

CookieAuthenticationOptions()

建立以預設值初始化的選項執行個體

屬性

AccessDeniedPath

AccessDeniedPath 屬性會通知中介軟體,其應該將傳出 403 禁止狀態碼變更為 302 重新導向至指定的路徑。

AuthenticationScheme

選項中的 AuthenticationScheme 會對應至特定驗證配置的邏輯名稱。 可能會指派不同的值以便在管線中多次使用相同的驗證中介軟體類型。

(繼承來源 AuthenticationOptions)
AutomaticAuthenticate

如果為 true,驗證中介軟體會改變傳入的要求使用者。 如果為 false,驗證中介軟體只會在 AuthenticationScheme 明確指出時提供身分識別。

(繼承來源 AuthenticationOptions)
AutomaticChallenge

如果為 true,驗證中介軟體應該處理自動挑戰。 如果為 false,驗證中介軟體只會在 AuthenticationScheme 明確指出時改變回應。

(繼承來源 AuthenticationOptions)
ClaimsIssuer

取得或設定應該用於任何已建立宣告的簽發者

(繼承來源 AuthenticationOptions)
CookieDomain

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

CookieHttpOnly

判斷瀏器是否應該允許 Cookie 由用戶端 Javascript 存取。 預設為 true,表示 cookie 僅會傳送至 HTTP 要求,且頁面上的指令碼無法加以使用。

CookieManager

用以從要求取得 Cookie 或在回應上設定 Cookie 的元件。

預設使用 ChunkingCookieManager。

CookieName

判斷用來持續識別的 cookie 名稱。 預設值為 「。AspNetCore.Cookies」。 如果您變更 AuthenticationScheme 的名稱,則應該變更此值,特別是當您的系統多次使用 Cookie 驗證中介軟體時。

CookiePath

決定用來建立 Cookie 的路徑。 預設值為 「/」 表示最高瀏覽器相容性。

CookieSecure

判斷是否 cookie 僅應該在 HTTPS 要求中傳輸。 若進行登入的頁面也為 HTTP,則預設為限制 HTTPS 要求的 cookie。 若您有 HTTP 登入頁面,且您的部份網站為 HTTP,您可能需要變更此值。

DataProtectionProvider

如果設定此設定,CookieAuthenticationMiddleware 將會用於資料保護。

Description

驗證類型的其他相關資訊可在應用程式中找到。

(繼承來源 AuthenticationOptions)
Events

提供者可能會指派至物件的執行個體,其由應用程式在啟動時建立。 中介軟體會在提供者上呼叫方法,以在發生處理的特定時間點提供應用程式控制。 若未提供,則會提供呼叫方法時沒有作用的預設執行個體。

ExpireTimeSpan

控制 cookie 要多少時間才能從其建立點起保持有效。 過期資訊位於受保護的 cookie 票券中。 因此,即使在瀏覽器應該加以清除之後會傳送至伺服器,會忽略過期的 cookie。

LoginPath

LoginPath 屬性會通知中介軟體其應該變更傳出 401 未授權狀態碼為 302 重新導向至給定的登入路徑。 產生 401 的目前 URL 會新增至 LoginPath 做為由 ReturnUrlParameter 命名的查詢字串參數。 一旦對 LoginPath 的要求授與新的 SignIn 身分識別,ReturnUrlParameter 值就會用來將瀏覽器重新導向回
導致原始未經授權狀態碼的 URL。

LogoutPath

若 LogoutPath 已提供中介軟體,則路徑的要求會依 ReturnUrlParameter 重新導向。

ReturnUrlParameter

ReturnUrlParameter 會判斷當 401 未授權狀態碼變更為 302 重新導向至給定的登入路徑時,由中介軟體附加的查詢字串參數名稱。 這也是查詢字串參數在要求抵達登入路徑或登出路徑時尋找的,以在執行動作之後傳回至原始 URL。

SessionStore

跨要求儲存識別的選擇性容器。 使用時,只會將工作階段識別碼傳送至用戶端。 這可用來減輕有大量識別時的潛在問題。

SlidingExpiration

SlidingExpiration 設為 true,以指示中介軟體重新簽發處理時具有新過期時間的 cookie,其比透過過期視窗能省下一半的時間。

SystemClock

僅供測試用途使用。

SystemClock

僅供測試用途使用。

(繼承來源 AuthenticationOptions)
TicketDataFormat

TicketDataFormat 用來保護且取消保護識別,以及其他儲存在 cookie 值中的屬性。 如果未提供,則會使用 IApplicationBuilder.Properties 中包含的資料保護服務來建立預設資料處理程式。 預設的資料保護服務是根據在 ASP.NET 上執行的機器索引鍵,以及根據不同處理中執行時的 DPAPI。

明確介面實作

IOptions<CookieAuthenticationOptions>.Value

CookieAuthenticationMiddleware 的組態選項。

適用於