Export (0) Print
Expand All

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

.NET Framework 4.5

Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, start time, expiration time, and key.

Namespace:  System.IdentityModel.Tokens
Assembly:  System.IdentityModel (in System.IdentityModel.dll)

public SessionSecurityToken(
	ClaimsPrincipal claimsPrincipal,
	UniqueId contextId,
	string context,
	string endpointId,
	Nullable<DateTime> validFrom,
	Nullable<DateTime> validTo,
	SymmetricSecurityKey key
)

Parameters

claimsPrincipal
Type: System.Security.Claims.ClaimsPrincipal

The claims principal that is associated with this session.

contextId
Type: System.Xml.UniqueId

The context identifier associated with this token.

context
Type: System.String

An optional, application-specific context string.

endpointId
Type: System.String

The endpoint to which this token is bound. An empty string creates an unscoped token.

validFrom
Type: System.Nullable<DateTime>

The time instant at which the token becomes valid. null to specify UtcNow

validTo
Type: System.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 SessionSecurityTokenHandler.DefaultTokenLifetime property to the time specified by the validFrom parameter.

key
Type: System.IdentityModel.Tokens.SymmetricSecurityKey

An optional symmetric session key.

ExceptionCondition
ArgumentNullException

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

-or-

contextId is null.

ArgumentOutOfRangeException

validFrom is greater than or equal to validTo.

-or-

validTo is less than the current time.

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.

NoteNote

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.

.NET Framework

Supported in: 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft