ערוך

שתף באמצעות


SessionSecurityToken Constructors

Definition

Initializes a new instance of the SessionSecurityToken class.

Overloads

SessionSecurityToken(ClaimsPrincipal)

Initializes a new instance of the SessionSecurityToken class from the specified principal.

SessionSecurityToken(SerializationInfo, StreamingContext)

Initializes a new instance of the SessionSecurityToken class with serialized data.

SessionSecurityToken(ClaimsPrincipal, String)

Initializes a new instance of the SessionSecurityToken class from the specified principal and bootstrap token.

SessionSecurityToken(ClaimsPrincipal, TimeSpan)

Initializes a new instance of the SessionSecurityToken class from the specified principal. The new token is valid from UtcNow through the specified lifetime.

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

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>)

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)

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)

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)

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)

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)

Parameters

claimsPrincipal
ClaimsPrincipal

The claims principal from which to initialize the token.

Exceptions

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

Remarks

The following table shows initial property values for an instance of the SessionSecurityToken class.

Property Initial Value
ClaimsPrincipal claimsPrincipal
Context null
ContextId Set to a generated unique ID.
EndpointId String.Empty
Id Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime UtcNow
KeyExpirationTime UtcNow plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.
KeyGeneration null
SecurityKeys Contains a generated 128 bit symmetric key. Note: The default implementation does not use this property. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom UtcNow
ValidTo UtcNow plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

Applies to

SessionSecurityToken(SerializationInfo, StreamingContext)

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)

Parameters

info
SerializationInfo

The serialized object data.

context
StreamingContext

Contextual information about the source.

Applies to

SessionSecurityToken(ClaimsPrincipal, String)

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)

Parameters

claimsPrincipal
ClaimsPrincipal

The claims principal that was generated from the bootstrap token.

context
String

An optional, application-specific context string.

Exceptions

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

Remarks

The following table shows initial property values for an instance of the SessionSecurityToken class.

Property Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId Set to a generated unique ID.
EndpointId String.Empty
Id Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime UtcNow
KeyExpirationTime UtcNow plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.
KeyGeneration null
SecurityKeys Contains a generated 128 bit symmetric key. Note: The default implementation does not use this property. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom UtcNow
ValidTo UtcNow plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

Applies to

SessionSecurityToken(ClaimsPrincipal, TimeSpan)

Initializes a new instance of the SessionSecurityToken class from the specified principal. 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)

Parameters

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. The ValidFrom property will be set to UtcNow and the ValidTo property will be set to ValidFrom plus the period specified by this parameter.

Exceptions

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

lifetime is less than or equal to Zero.

Remarks

The following table shows initial property values for an instance of the SessionSecurityToken class.

Property Initial Value
ClaimsPrincipal claimsPrincipal
Context null
ContextId Set to a generated unique ID.
EndpointId String.Empty
Id Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime UtcNow
KeyExpirationTime UtcNow plus lifetime.
KeyGeneration null
SecurityKeys Contains a generated 128 bit symmetric key. Note: The default implementation does not use this property. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom UtcNow
ValidTo UtcNow plus lifetime.

Applies to

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

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))

Parameters

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 to specify UtcNow.

validTo
Nullable<DateTime>

The time instant after which the token is no longer valid. 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.

Exceptions

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

The validFrom and validTo parameters cannot be validated; for example, validTo specifies a time that occurs earlier than validFrom.

Remarks

The following table shows initial property values for an instance of the SessionSecurityToken class.

Property Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId Set to a generated unique ID.
EndpointId String.Empty
Id Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime Set to the value of the ValidFrom property as determined by the ValidFrom parameter.
KeyExpirationTime The value of the ValidTo property as determined by the ValidTo parameter.
KeyGeneration null
SecurityKeys Contains a generated 128 bit symmetric key. Note: The default implementation does not use this property. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom The value of the validFrom parameter, or, if validFrom is null, UtcNow.
ValidTo The value of the validFrom parameter. If validFrom is null, the value of the ValidFrom property (as determined by the validFrom parameter) plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

Applies to

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

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))

Parameters

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 to specify UtcNow.

validTo
Nullable<DateTime>

The time instant after which the token is no longer valid. 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.

Exceptions

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

-or-

endpointId is null.

The validFrom and validTo parameters cannot be validated; for example, validTo specifies a time that occurs earlier than validFrom.

Remarks

The following table shows initial property values for an instance of the SessionSecurityToken class.

Property Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId Set to a generated unique ID.
EndpointId endpointId
Id Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime Set to the value of the ValidFrom property as determined by the ValidFrom parameter.
KeyExpirationTime The value of the ValidTo property as determined by the ValidTo parameter.
KeyGeneration null
SecurityKeys Contains a generated 128 bit symmetric key. Note: The default implementation does not use this property. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom The value of the validFrom parameter, or, if validFrom is null, UtcNow.
ValidTo The value of the validFrom parameter. If validFrom is null, the value of the ValidFrom property (as determined by the validFrom parameter) plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

Applies to

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

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)

Parameters

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. 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.

Exceptions

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

-or-

contextId is null.

-or-

endpointId is null.

lifetime is less than or equal to Zero.

Remarks

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 Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime UtcNow
KeyExpirationTime UtcNow plus lifetime
KeyGeneration null
SecurityKeys 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. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom UtcNow
ValidTo UtcNow plus lifetime

Applies to

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

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)

Parameters

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. The ValidTo property will be set to ValidFrom plus the period specified by this parameter.

key
SymmetricSecurityKey

An optional symmetric session key.

Exceptions

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

-or-

contextId is null.

-or-

endpointId is null.

lifetime is less than or equal to Zero.

Remarks

The following table shows initial property values for an instance of the SessionSecurityToken class.

Property Initial Value
ClaimsPrincipal claimsPrincipal
Context context
ContextId contextId or, if contextId is null, a generated unique ID.
EndpointId endpointId
Id Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime validFrom
KeyExpirationTime validFrom plus lifetime.
KeyGeneration null
SecurityKeys 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. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom validFrom
ValidTo validFrom plus lifetime.

Applies to

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

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)

Parameters

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 to specify UtcNow.

validTo
Nullable<DateTime>

The time instant after which the token is no longer valid. 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.

Exceptions

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

-or-

contextId is null.

validFrom is greater than or equal to validTo.

-or-

validTo is less than the current time.

Remarks

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 Set to a generated unique ID.
IsPersistent false
IsReferenceMode false
KeyEffectiveTime Set to the value of the ValidFrom property as determined by the ValidFrom parameter.
KeyExpirationTime The value of the ValidTo property as determined by the ValidTo parameter.
KeyGeneration null
SecurityKeys 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. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.
ValidFrom The value of the validFrom parameter, or, if validFrom is null, UtcNow.
ValidTo The value of the validFrom parameter. If validFrom is null, the value of the ValidFrom property (as determined by the validFrom parameter) plus the SessionSecurityTokenHandler.DefaultTokenLifetime property.

Applies to