SecurityTokenResolver.TryResolveToken Method (SecurityKeyIdentifier, SecurityToken)

 

Attempts to retrieve the security token that matches one of the key identifier clauses contained within the specified key identifier.

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

public bool TryResolveToken(
	SecurityKeyIdentifier keyIdentifier,
	out SecurityToken token
)

Parameters

keyIdentifier
Type: System.IdentityModel.Tokens.SecurityKeyIdentifier

The SecurityKeyIdentifier to create a security token for.

token
Type: System.IdentityModel.Tokens.SecurityToken

When this method returns, contains a SecurityToken that represents the specified key identifier. This parameter is passed uninitialized.

Return Value

Type: System.Boolean

true when a security token can be retrieved for the specified key identifier; otherwise, false.

Exception Condition
ArgumentNullException

keyIdentifier is null.

The TryResolveToken and ResolveToken methods differ in what happens when the key identifier cannot be resolved to a security token. The TryResolveToken method returns false, whereas the ResolveToken method throws an exception.

.NET Framework
Available since 3.0
Return to top
Show: