SecurityTokenResolver.ResolveSecurityKey(SecurityKeyIdentifierClause) 方法

定义

获取在指定的密钥标识符子句中引用的密钥。Obtains the key that is referenced in the specified key identifier clause.

public:
 System::IdentityModel::Tokens::SecurityKey ^ ResolveSecurityKey(System::IdentityModel::Tokens::SecurityKeyIdentifierClause ^ keyIdentifierClause);
public System.IdentityModel.Tokens.SecurityKey ResolveSecurityKey (System.IdentityModel.Tokens.SecurityKeyIdentifierClause keyIdentifierClause);
member this.ResolveSecurityKey : System.IdentityModel.Tokens.SecurityKeyIdentifierClause -> System.IdentityModel.Tokens.SecurityKey
Public Function ResolveSecurityKey (keyIdentifierClause As SecurityKeyIdentifierClause) As SecurityKey

参数

keyIdentifierClause
SecurityKeyIdentifierClause

要为其检索密钥的 SecurityKeyIdentifierClauseA SecurityKeyIdentifierClause to retrieve the key for.

返回

SecurityKey

一个 SecurityKey,它是指定的密钥标识符子句中引用的密钥。A SecurityKey that is the key referenced in the specified key identifier clause.

例外

keyIdentifierClausenullkeyIdentifierClause is null.

无法为 keyIdentifierClause 参数中指定的密钥标识符子句检索密钥。A key could not be retrieved for the key identifier clause specified in the keyIdentifierClause parameter.

注解

当无法将密钥标识符子句解析为密钥时,TryResolveSecurityKeyResolveSecurityKey 方法的行为有所不同。The TryResolveSecurityKey and ResolveSecurityKey methods differ in what happens when the key identifier clause cannot be resolved to a key. TryResolveSecurityKey 方法返回 false,而 ResolveSecurityKey 方法引发异常。The TryResolveSecurityKey method returns false, whereas the ResolveSecurityKey method throws an exception.

适用于