Export (0) Print
Expand All

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

.NET Framework 4.5

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.

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

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

Parameters

claimsPrincipal
Type: System.Security.Claims.ClaimsPrincipal

The claims principal that was generated from the bootstrap 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.

ExceptionCondition
ArgumentNullException

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

-or-

endpointId is null.

ArgumentOutOfRangeException

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

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.

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