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

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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

Parameters

info
SerializationInfo

The serialized object data.

context
StreamingContext

Contextual information about the source.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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, string context);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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, string context, DateTime? validFrom, DateTime? validTo);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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, string context, string endpointId, DateTime? validFrom, DateTime? validTo);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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, string context, string endpointId, TimeSpan lifetime, System.IdentityModel.Tokens.SymmetricSecurityKey key);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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, string context, string endpointId, DateTime validFrom, TimeSpan lifetime, System.IdentityModel.Tokens.SymmetricSecurityKey key);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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, string context, string endpointId, DateTime? validFrom, DateTime? validTo, System.IdentityModel.Tokens.SymmetricSecurityKey key);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1