SessionSecurityToken Constructor (ClaimsPrincipal, UniqueId, String, String, Nullable<DateTime>, Nullable<DateTime>, SymmetricSecurityKey)
![]() |
---|
The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience. |
Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, start time, expiration time, and key.
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.
Exception | Condition |
---|---|
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 | |||
context | |||
contextId | |||
endpointId | |||
Set to a generated unique ID. | |||
false | |||
false | |||
Set to the value of the ValidFrom property as determined by the ValidFrom parameter. | |||
The value of the ValidTo property as determined by the ValidTo parameter. | |||
null | |||
Contains single element that is either key or, if key is null, a generated 128 bit symmetric key.
| |||
The value of the validFrom parameter, or, if validFrom is null, UtcNow. | |||
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. |
Available since 4.5