SessionSecurityTokenHandler.ValidateToken Method (SessionSecurityToken, String)

.NET Framework (current version)

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


Type: System.IdentityModel.Tokens.SessionSecurityToken

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

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.

Exception Condition

token is null.


endpointId is null.


token is not assignable from SessionSecurityToken.


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.

System_CAPS_security Security 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
Available since 4.5
Return to top