SessionSecurityToken 构造函数

定义

初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class.

重载

SessionSecurityToken(ClaimsPrincipal)

从指定的主体初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal.

SessionSecurityToken(SerializationInfo, StreamingContext)

用序列化数据初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class with serialized data.

SessionSecurityToken(ClaimsPrincipal, String)

用指定的主体和启动令牌初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal and bootstrap token.

SessionSecurityToken(ClaimsPrincipal, TimeSpan)

从指定的主体初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal. 在指定生命期间从 UtcNow 开始是合法的新的标识。The new token is valid from UtcNow through the specified lifetime.

SessionSecurityToken(ClaimsPrincipal, String, Nullable<DateTime>, Nullable<DateTime>)

用指定的主体和启动令牌,并结合指定的开始时间和过期时间来初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal and bootstrap token; and with the specified start time and expiration time.

SessionSecurityToken(ClaimsPrincipal, String, String, Nullable<DateTime>, Nullable<DateTime>)

用指定的主体和启动令牌,并结合指定的开始时间和过期时间来初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal and bootstrap token; and with the specified start time and expiration time. 限定范围为指定的终点的新的标识。The new token is scoped to the specified endpoint.

SessionSecurityToken(ClaimsPrincipal, UniqueId, String, String, TimeSpan, SymmetricSecurityKey)

使用指定的主体、上下文 ID、上下文、终结点、生存期和密钥初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, lifetime, and key.

SessionSecurityToken(ClaimsPrincipal, UniqueId, String, String, DateTime, TimeSpan, SymmetricSecurityKey)

使用指定的主体、上下文 ID、上下文、终结点、有效时间戳、生存期和密钥初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, valid timestamp, lifetime, and key.

SessionSecurityToken(ClaimsPrincipal, UniqueId, String, String, Nullable<DateTime>, Nullable<DateTime>, SymmetricSecurityKey)

使用指定的主体、上下文 ID、上下文、终结点、开始时间、过期时间和密钥初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, start time, expiration time, and key.

SessionSecurityToken(ClaimsPrincipal)

从指定的主体初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal.

public:
 SessionSecurityToken(System::Security::Claims::ClaimsPrincipal ^ claimsPrincipal);
public SessionSecurityToken (System.Security.Claims.ClaimsPrincipal claimsPrincipal);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Security.Claims.ClaimsPrincipal -> System.IdentityModel.Tokens.SessionSecurityToken
Public Sub New (claimsPrincipal As ClaimsPrincipal)

参数

claimsPrincipal
ClaimsPrincipal

初始化标记的声明主体。The claims principal from which to initialize the token.

例外

claimsPrincipalnullclaimsPrincipal is null.

- 或 --or- claimsPrincipalIdentities 属性为 nullThe Identities property of claimsPrincipal is null.

注解

下表显示了 SessionSecurityToken 类的某个实例的初始属性值。The following table shows initial property values for an instance of the SessionSecurityToken class.

属性Property 初始值Initial Value
ClaimsPrincipal claimsPrincipal
Context null
ContextId 设置为生成的唯一 ID。Set to a generated unique ID.
EndpointId String.Empty
Id 设置为生成的唯一 ID。Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime UtcNow
KeyExpirationTime UtcNow 加上 SessionSecurityTokenHandler.DefaultTokenLifetime 属性。UtcNow plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.
KeyGeneration null
SecurityKeys 包含生成的128位对称密钥。Contains a generated 128 bit symmetric key. 注意: 默认实现不使用此属性。Note: The default implementation does not use this property. 签名和加密密钥由处理令牌的所应用的 cookie 转换决定 SessionSecurityTokenHandlerSigning and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom UtcNow
ValidTo UtcNow 加上 SessionSecurityTokenHandler.DefaultTokenLifetime 属性。UtcNow plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

适用于

SessionSecurityToken(SerializationInfo, StreamingContext)

用序列化数据初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class with serialized data.

protected:
 SessionSecurityToken(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected SessionSecurityToken (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.IdentityModel.Tokens.SessionSecurityToken
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

序列化的对象数据。The serialized object data.

context
StreamingContext

有关源的上下文信息。Contextual information about the source.

适用于

SessionSecurityToken(ClaimsPrincipal, String)

用指定的主体和启动令牌初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal and bootstrap token.

public:
 SessionSecurityToken(System::Security::Claims::ClaimsPrincipal ^ claimsPrincipal, System::String ^ context);
public SessionSecurityToken (System.Security.Claims.ClaimsPrincipal claimsPrincipal, string context);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Security.Claims.ClaimsPrincipal * string -> System.IdentityModel.Tokens.SessionSecurityToken
Public Sub New (claimsPrincipal As ClaimsPrincipal, context As String)

参数

claimsPrincipal
ClaimsPrincipal

从引导标记生成的声明主体。The claims principal that was generated from the bootstrap token.

context
String

一个应用程序特定的可选上下文字符串。An optional, application-specific context string.

例外

claimsPrincipalnullclaimsPrincipal is null.

- 或 --or- claimsPrincipalIdentities 属性为 nullThe Identities property of claimsPrincipal is null.

注解

下表显示了 SessionSecurityToken 类的某个实例的初始属性值。The following table shows initial property values for an instance of the SessionSecurityToken class.

属性Property 初始值Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId 设置为生成的唯一 ID。Set to a generated unique ID.
EndpointId String.Empty
Id 设置为生成的唯一 ID。Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime UtcNow
KeyExpirationTime UtcNow 加上 SessionSecurityTokenHandler.DefaultTokenLifetime 属性。UtcNow plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.
KeyGeneration null
SecurityKeys 包含生成的128位对称密钥。Contains a generated 128 bit symmetric key. 注意: 默认实现不使用此属性。Note: The default implementation does not use this property. 签名和加密密钥由处理令牌的所应用的 cookie 转换决定 SessionSecurityTokenHandlerSigning and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom UtcNow
ValidTo UtcNow 加上 SessionSecurityTokenHandler.DefaultTokenLifetime 属性。UtcNow plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

适用于

SessionSecurityToken(ClaimsPrincipal, TimeSpan)

从指定的主体初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal. 在指定生命期间从 UtcNow 开始是合法的新的标识。The new token is valid from UtcNow through the specified lifetime.

public:
 SessionSecurityToken(System::Security::Claims::ClaimsPrincipal ^ claimsPrincipal, TimeSpan lifetime);
public SessionSecurityToken (System.Security.Claims.ClaimsPrincipal claimsPrincipal, TimeSpan lifetime);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Security.Claims.ClaimsPrincipal * TimeSpan -> System.IdentityModel.Tokens.SessionSecurityToken
Public Sub New (claimsPrincipal As ClaimsPrincipal, lifetime As TimeSpan)

参数

claimsPrincipal
ClaimsPrincipal

初始化标记的声明主体。The claims principal from which to initialize the token.

lifetime
TimeSpan

当令牌有效期间从当前时间开始的期间。The period from the current time during which the token is valid. ValidFrom 属性将设置为 UtcNow ,并且 ValidTo 属性将设置为 ValidFrom 加上该参数指定的时期。The ValidFrom property will be set to UtcNow and the ValidTo property will be set to ValidFrom plus the period specified by this parameter.

例外

claimsPrincipalnullclaimsPrincipal is null.

- 或 --or- claimsPrincipalIdentities 属性为 nullThe Identities property of claimsPrincipal is null.

lifetime 小于或等于 Zerolifetime is less than or equal to Zero.

注解

下表显示了 SessionSecurityToken 类的某个实例的初始属性值。The following table shows initial property values for an instance of the SessionSecurityToken class.

属性Property 初始值Initial Value
ClaimsPrincipal claimsPrincipal
Context null
ContextId 设置为生成的唯一 ID。Set to a generated unique ID.
EndpointId String.Empty
Id 设置为生成的唯一 ID。Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime UtcNow
KeyExpirationTime UtcNow 加上 lifetimeUtcNow plus lifetime.
KeyGeneration null
SecurityKeys 包含生成的128位对称密钥。Contains a generated 128 bit symmetric key. 注意: 默认实现不使用此属性。Note: The default implementation does not use this property. 签名和加密密钥由处理令牌的所应用的 cookie 转换决定 SessionSecurityTokenHandlerSigning and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom UtcNow
ValidTo UtcNow 加上 lifetimeUtcNow plus lifetime.

适用于

SessionSecurityToken(ClaimsPrincipal, String, Nullable<DateTime>, Nullable<DateTime>)

用指定的主体和启动令牌,并结合指定的开始时间和过期时间来初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal and bootstrap token; and with the specified start time and expiration time.

public:
 SessionSecurityToken(System::Security::Claims::ClaimsPrincipal ^ claimsPrincipal, System::String ^ context, Nullable<DateTime> validFrom, Nullable<DateTime> validTo);
public SessionSecurityToken (System.Security.Claims.ClaimsPrincipal claimsPrincipal, string context, DateTime? validFrom, DateTime? validTo);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Security.Claims.ClaimsPrincipal * string * Nullable<DateTime> * Nullable<DateTime> -> System.IdentityModel.Tokens.SessionSecurityToken
Public Sub New (claimsPrincipal As ClaimsPrincipal, context As String, validFrom As Nullable(Of DateTime), validTo As Nullable(Of DateTime))

参数

claimsPrincipal
ClaimsPrincipal

从引导标记生成的声明主体。The claims principal that was generated from the bootstrap token.

context
String

一个应用程序特定的可选上下文字符串。An optional, application-specific context string.

validFrom
Nullable<DateTime>

标记变为有效的时间时刻。The time instant at which the token becomes valid. 如果为 null,则指定 UtcNownull to specify UtcNow

validTo
Nullable<DateTime>

其后时间不再有效的时间时刻。The time instant after which the token is no longer valid. 如果为 null,则指定应通过将 DefaultTokenLifetime 属性的值添加到 validFrom 参数指定的时间来确定值。null to specify that the value should be determined by adding the value of the DefaultTokenLifetime property to the time specified by the validFrom parameter.

例外

claimsPrincipalnullclaimsPrincipal is null.

- 或 --or- claimsPrincipalIdentities 属性为 nullThe Identities property of claimsPrincipal is null.

无法验证 validFromvalidTo 参数;例如,validTo 指定早于 validFrom 发生的时间。The validFrom and validTo parameters cannot be validated; for example, validTo specifies a time that occurs earlier than validFrom.

注解

下表显示了 SessionSecurityToken 类的某个实例的初始属性值。The following table shows initial property values for an instance of the SessionSecurityToken class.

属性Property 初始值Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId 设置为生成的唯一 ID。Set to a generated unique ID.
EndpointId String.Empty
Id 设置为生成的唯一 ID。Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime 设置为由 ValidFrom 参数确定的属性的值 ValidFromSet to the value of the ValidFrom property as determined by the ValidFrom parameter.
KeyExpirationTime ValidTo由参数确定的属性的值 ValidToThe value of the ValidTo property as determined by the ValidTo parameter.
KeyGeneration null
SecurityKeys 包含生成的128位对称密钥。Contains a generated 128 bit symmetric key. 注意: 默认实现不使用此属性。Note: The default implementation does not use this property. 签名和加密密钥由处理令牌的所应用的 cookie 转换决定 SessionSecurityTokenHandlerSigning and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom 参数的值 validFrom ,如果 validFrom 为,则为 null UtcNowThe value of the validFrom parameter, or, if validFrom is null, UtcNow.
ValidTo validFrom 参数的值。The value of the validFrom parameter. 如果 validFromnull ,则属性的值 ValidFrom (由 validFrom 参数) 加上 SessionSecurityTokenHandler.DefaultTokenLifetime 属性确定。If validFrom is null, the value of the ValidFrom property (as determined by the validFrom parameter) plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

适用于

SessionSecurityToken(ClaimsPrincipal, String, String, Nullable<DateTime>, Nullable<DateTime>)

用指定的主体和启动令牌,并结合指定的开始时间和过期时间来初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class from the specified principal and bootstrap token; and with the specified start time and expiration time. 限定范围为指定的终点的新的标识。The new token is scoped to the specified endpoint.

public:
 SessionSecurityToken(System::Security::Claims::ClaimsPrincipal ^ claimsPrincipal, System::String ^ context, System::String ^ endpointId, Nullable<DateTime> validFrom, Nullable<DateTime> validTo);
public SessionSecurityToken (System.Security.Claims.ClaimsPrincipal claimsPrincipal, string context, string endpointId, DateTime? validFrom, DateTime? validTo);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Security.Claims.ClaimsPrincipal * string * string * Nullable<DateTime> * Nullable<DateTime> -> System.IdentityModel.Tokens.SessionSecurityToken
Public Sub New (claimsPrincipal As ClaimsPrincipal, context As String, endpointId As String, validFrom As Nullable(Of DateTime), validTo As Nullable(Of DateTime))

参数

claimsPrincipal
ClaimsPrincipal

从引导标记生成的声明主体。The claims principal that was generated from the bootstrap token.

context
String

一个应用程序特定的可选上下文字符串。An optional, application-specific context string.

endpointId
String

此标记所绑定的终点结。The endpoint to which this token is bound. 空字符串将创建未区分范围的标记。An empty string creates an unscoped token.

validFrom
Nullable<DateTime>

标记变为有效的时间时刻。The time instant at which the token becomes valid. 如果为 null,则指定 UtcNownull to specify UtcNow.

validTo
Nullable<DateTime>

其后时间不再有效的时间时刻。The time instant after which the token is no longer valid. 如果为 null,则指定应通过将 DefaultTokenLifetime 属性的值添加到 validFrom 参数指定的时间来确定值。null to specify that the value should be determined by adding the value of the DefaultTokenLifetime property to the time specified by the validFrom parameter.

例外

claimsPrincipalnullclaimsPrincipal is null.

- 或 --or- claimsPrincipalIdentities 属性为 nullThe Identities property of claimsPrincipal is null.

- 或 --or- endpointIdnullendpointId is null.

无法验证 validFromvalidTo 参数;例如,validTo 指定早于 validFrom 发生的时间。The validFrom and validTo parameters cannot be validated; for example, validTo specifies a time that occurs earlier than validFrom.

注解

下表显示了 SessionSecurityToken 类的某个实例的初始属性值。The following table shows initial property values for an instance of the SessionSecurityToken class.

属性Property 初始值Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId 设置为生成的唯一 ID。Set to a generated unique ID.
EndpointId endpointId
Id 设置为生成的唯一 ID。Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime 设置为由 ValidFrom 参数确定的属性的值 ValidFromSet to the value of the ValidFrom property as determined by the ValidFrom parameter.
KeyExpirationTime ValidTo由参数确定的属性的值 ValidToThe value of the ValidTo property as determined by the ValidTo parameter.
KeyGeneration null
SecurityKeys 包含生成的128位对称密钥。Contains a generated 128 bit symmetric key. 注意: 默认实现不使用此属性。Note: The default implementation does not use this property. 签名和加密密钥由处理令牌的所应用的 cookie 转换决定 SessionSecurityTokenHandlerSigning and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom 参数的值 validFrom ,如果 validFrom 为,则为 null UtcNowThe value of the validFrom parameter, or, if validFrom is null, UtcNow.
ValidTo validFrom 参数的值。The value of the validFrom parameter. 如果 validFromnull ,则属性的值 ValidFrom (由 validFrom 参数) 加上 SessionSecurityTokenHandler.DefaultTokenLifetime 属性确定。If validFrom is null, the value of the ValidFrom property (as determined by the validFrom parameter) plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

适用于

SessionSecurityToken(ClaimsPrincipal, UniqueId, String, String, TimeSpan, SymmetricSecurityKey)

使用指定的主体、上下文 ID、上下文、终结点、生存期和密钥初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, lifetime, and key.

public:
 SessionSecurityToken(System::Security::Claims::ClaimsPrincipal ^ claimsPrincipal, System::Xml::UniqueId ^ contextId, System::String ^ context, System::String ^ endpointId, TimeSpan lifetime, System::IdentityModel::Tokens::SymmetricSecurityKey ^ key);
public SessionSecurityToken (System.Security.Claims.ClaimsPrincipal claimsPrincipal, System.Xml.UniqueId contextId, string context, string endpointId, TimeSpan lifetime, System.IdentityModel.Tokens.SymmetricSecurityKey key);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Security.Claims.ClaimsPrincipal * System.Xml.UniqueId * string * string * TimeSpan * System.IdentityModel.Tokens.SymmetricSecurityKey -> System.IdentityModel.Tokens.SessionSecurityToken
Public Sub New (claimsPrincipal As ClaimsPrincipal, contextId As UniqueId, context As String, endpointId As String, lifetime As TimeSpan, key As SymmetricSecurityKey)

参数

claimsPrincipal
ClaimsPrincipal

与此会话关联的声明主体。The claims principal that is associated with this session.

contextId
UniqueId

与此标志关联的一个上下文标识符。The context identifier associated with this token.

context
String

一个应用程序特定的可选上下文字符串。An optional, application-specific context string.

endpointId
String

此标记所绑定的终点结。The endpoint to which this token is bound. 空字符串将创建未区分范围的标记。An empty string creates an unscoped token.

lifetime
TimeSpan

会话令牌的生存期。The lifetime of the session token. ValidFrom 属性将设置为 UtcNow ,并且 ValidTo 属性将设置为 ValidFrom 加上该参数指定的时期。The ValidFrom property will be set to UtcNow and the ValidTo property will be set to ValidFrom plus the period specified by this parameter.

key
SymmetricSecurityKey

一个可选的对称会话密钥。An optional symmetric session key.

例外

claimsPrincipalnullclaimsPrincipal is null.

- 或 --or- claimsPrincipalIdentities 属性为 nullThe Identities property of claimsPrincipal is null.

- 或 --or- contextIdnullcontextId is null.

- 或 --or- endpointIdnullendpointId is null.

lifetime 小于或等于 Zerolifetime is less than or equal to Zero.

注解

下表显示了 SessionSecurityToken 类的某个实例的初始属性值。The following table shows initial property values for an instance of the SessionSecurityToken class.

属性Property 初始值Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId contextId
EndpointId endpointId
Id 设置为生成的唯一 ID。Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime UtcNow
KeyExpirationTime UtcNow 加大 lifetimeUtcNow plus lifetime
KeyGeneration null
SecurityKeys 包含单个元素,该元素为 key 或,如果 key 为,则 null 生成128位对称密钥。Contains single element that is either key or, if key is null, a generated 128 bit symmetric key. 注意: 默认实现不使用此属性。Note: The default implementation does not use this property. 签名和加密密钥由处理令牌的所应用的 cookie 转换决定 SessionSecurityTokenHandlerSigning and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom UtcNow
ValidTo UtcNow 加大 lifetimeUtcNow plus lifetime

适用于

SessionSecurityToken(ClaimsPrincipal, UniqueId, String, String, DateTime, TimeSpan, SymmetricSecurityKey)

使用指定的主体、上下文 ID、上下文、终结点、有效时间戳、生存期和密钥初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, valid timestamp, lifetime, and key.

public:
 SessionSecurityToken(System::Security::Claims::ClaimsPrincipal ^ claimsPrincipal, System::Xml::UniqueId ^ contextId, System::String ^ context, System::String ^ endpointId, DateTime validFrom, TimeSpan lifetime, System::IdentityModel::Tokens::SymmetricSecurityKey ^ key);
public SessionSecurityToken (System.Security.Claims.ClaimsPrincipal claimsPrincipal, System.Xml.UniqueId contextId, string context, string endpointId, DateTime validFrom, TimeSpan lifetime, System.IdentityModel.Tokens.SymmetricSecurityKey key);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Security.Claims.ClaimsPrincipal * System.Xml.UniqueId * string * string * DateTime * TimeSpan * System.IdentityModel.Tokens.SymmetricSecurityKey -> System.IdentityModel.Tokens.SessionSecurityToken
Public Sub New (claimsPrincipal As ClaimsPrincipal, contextId As UniqueId, context As String, endpointId As String, validFrom As DateTime, lifetime As TimeSpan, key As SymmetricSecurityKey)

参数

claimsPrincipal
ClaimsPrincipal

与此会话关联的声明主体。The claims principal that is associated with this session.

contextId
UniqueId

与此标志关联的一个上下文标识符。The context identifier associated with this token.

context
String

一个应用程序特定的可选上下文字符串。An optional, application-specific context string.

endpointId
String

此标记所绑定的终点结。The endpoint to which this token is bound. 空字符串将创建未区分范围的标记。An empty string creates an unscoped token.

validFrom
DateTime

标记变为有效的时间。The time at which the token becomes valid.

lifetime
TimeSpan

会话令牌的生存期。The lifetime of the session token. ValidTo 属性将设置为 ValidFrom 加上该参数指定的时期。The ValidTo property will be set to ValidFrom plus the period specified by this parameter.

key
SymmetricSecurityKey

一个可选的对称会话密钥。An optional symmetric session key.

例外

claimsPrincipalnullclaimsPrincipal is null.

- 或 --or- claimsPrincipalIdentities 属性为 nullThe Identities property of claimsPrincipal is null.

- 或 --or- contextIdnullcontextId is null.

- 或 --or- endpointIdnullendpointId is null.

lifetime 小于或等于 Zerolifetime is less than or equal to Zero.

注解

下表显示了 SessionSecurityToken 类的某个实例的初始属性值。The following table shows initial property values for an instance of the SessionSecurityToken class.

属性Property 初始值Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId contextId 如果 contextId 为,则为; 如果为 null ,则生成唯一 ID。contextId or, if contextId is null, a generated unique ID.
EndpointId endpointId
Id 设置为生成的唯一 ID。Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime validFrom
KeyExpirationTime validFrom 加上 lifetimevalidFrom plus lifetime.
KeyGeneration null
SecurityKeys 包含单个元素,该元素为 key 或,如果 key 为,则 null 生成128位对称密钥。Contains single element that is either key or, if key is null, a generated 128 bit symmetric key. 注意: 默认实现不使用此属性。Note: The default implementation does not use this property. 签名和加密密钥由处理令牌的所应用的 cookie 转换决定 SessionSecurityTokenHandlerSigning and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom validFrom
ValidTo validFrom 加上 lifetimevalidFrom plus lifetime.

适用于

SessionSecurityToken(ClaimsPrincipal, UniqueId, String, String, Nullable<DateTime>, Nullable<DateTime>, SymmetricSecurityKey)

使用指定的主体、上下文 ID、上下文、终结点、开始时间、过期时间和密钥初始化 SessionSecurityToken 类的新实例。Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, start time, expiration time, and key.

public:
 SessionSecurityToken(System::Security::Claims::ClaimsPrincipal ^ claimsPrincipal, System::Xml::UniqueId ^ contextId, System::String ^ context, System::String ^ endpointId, Nullable<DateTime> validFrom, Nullable<DateTime> validTo, System::IdentityModel::Tokens::SymmetricSecurityKey ^ key);
public SessionSecurityToken (System.Security.Claims.ClaimsPrincipal claimsPrincipal, System.Xml.UniqueId contextId, string context, string endpointId, DateTime? validFrom, DateTime? validTo, System.IdentityModel.Tokens.SymmetricSecurityKey key);
new System.IdentityModel.Tokens.SessionSecurityToken : System.Security.Claims.ClaimsPrincipal * System.Xml.UniqueId * string * string * Nullable<DateTime> * Nullable<DateTime> * System.IdentityModel.Tokens.SymmetricSecurityKey -> System.IdentityModel.Tokens.SessionSecurityToken
Public Sub New (claimsPrincipal As ClaimsPrincipal, contextId As UniqueId, context As String, endpointId As String, validFrom As Nullable(Of DateTime), validTo As Nullable(Of DateTime), key As SymmetricSecurityKey)

参数

claimsPrincipal
ClaimsPrincipal

与此会话关联的声明主体。The claims principal that is associated with this session.

contextId
UniqueId

与此标志关联的一个上下文标识符。The context identifier associated with this token.

context
String

一个应用程序特定的可选上下文字符串。An optional, application-specific context string.

endpointId
String

此标记所绑定的终点结。The endpoint to which this token is bound. 空字符串将创建未区分范围的标记。An empty string creates an unscoped token.

validFrom
Nullable<DateTime>

标记变为有效的时间时刻。The time instant at which the token becomes valid. 如果为 null,则指定 UtcNownull to specify UtcNow

validTo
Nullable<DateTime>

其后时间不再有效的时间时刻。The time instant after which the token is no longer valid. 如果为 null,则指定应通过将 DefaultTokenLifetime 属性的值添加到 validFrom 参数指定的时间来确定值。null to specify that the value should be determined by adding the value of the DefaultTokenLifetime property to the time specified by the validFrom parameter.

key
SymmetricSecurityKey

一个可选的对称会话密钥。An optional symmetric session key.

例外

claimsPrincipalnullclaimsPrincipal is null.

- 或 --or- claimsPrincipalIdentities 属性为 nullThe Identities property of claimsPrincipal is null.

- 或 --or- contextIdnullcontextId is null.

validFrom 大于或等于 validTovalidFrom is greater than or equal to validTo.

-或--or- 当前时间小于 validTovalidTo is less than the current time.

注解

下表显示了 SessionSecurityToken 类的某个实例的初始属性值。The following table shows initial property values for an instance of the SessionSecurityToken class.

属性Property 初始值Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId contextId
EndpointId endpointId
Id 设置为生成的唯一 ID。Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime 设置为由 ValidFrom 参数确定的属性的值 ValidFromSet to the value of the ValidFrom property as determined by the ValidFrom parameter.
KeyExpirationTime ValidTo由参数确定的属性的值 ValidToThe value of the ValidTo property as determined by the ValidTo parameter.
KeyGeneration null
SecurityKeys 包含单个元素,该元素为 key 或,如果 key 为,则 null 生成128位对称密钥。Contains single element that is either key or, if key is null, a generated 128 bit symmetric key. 注意: 默认实现不使用此属性。Note: The default implementation does not use this property. 签名和加密密钥由处理令牌的所应用的 cookie 转换决定 SessionSecurityTokenHandlerSigning and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom 参数的值 validFrom ,如果 validFrom 为,则为 null UtcNowThe value of the validFrom parameter, or, if validFrom is null, UtcNow.
ValidTo validFrom 参数的值。The value of the validFrom parameter. 如果 validFromnull ,则属性的值 ValidFrom (由 validFrom 参数) 加上 SessionSecurityTokenHandler.DefaultTokenLifetime 属性确定。If validFrom is null, the value of the ValidFrom property (as determined by the validFrom parameter) plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

适用于