Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ValidateToken Method (SessionSecurityToken, String)
Collapse the table of content
Expand the table of content

SessionSecurityTokenHandler.ValidateToken Method (SessionSecurityToken, String)

.NET Framework 4.6 and 4.5

Validates the specified session token and returns its claims.

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

public virtual ReadOnlyCollection<ClaimsIdentity> ValidateToken(
	SessionSecurityToken token,
	string endpointId
)

Parameters

token
Type: System.IdentityModel.Tokens.SessionSecurityToken

The token to be validated. Must be assignable from SessionSecurityToken.

endpointId
Type: System.String

The identifier of the endpoint to which the token is scoped.

Return Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<ClaimsIdentity>
The identities that are contained in the token.

ExceptionCondition
ArgumentNullException

token is null.

-or-

endpointId is null.

InvalidOperationException

token is not assignable from SessionSecurityToken.

SecurityTokenException

The EndpointId property of the specified token is not null or empty and its value is different than that specified by the endpointId parameter.

Performs a check to make sure that the specified token is scoped for the specified endpoint ID and, if so, invokes the SessionSecurityTokenHandler.ValidateToken(SecurityToken) method; otherwise, throws a SecurityTokenException.

Security noteSecurity Note

Session tokens that have an EndpointId property that is null or empty are considered to be globally scoped. This presents a potential security risk. For this reason you should make sure that the EndpointId property is set in your session tokens.

.NET Framework

Supported in: 4.6, 4.5
Show:
© 2015 Microsoft