本文整理汇总了C#中SecurityKeyIdentifier.CreateKey方法的典型用法代码示例。如果您正苦于以下问题:C# SecurityKeyIdentifier.CreateKey方法的具体用法?C# SecurityKeyIdentifier.CreateKey怎么用?C# SecurityKeyIdentifier.CreateKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecurityKeyIdentifier
的用法示例。
在下文中一共展示了SecurityKeyIdentifier.CreateKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveSubjectKeyIdentifier
/// <summary>
/// Resolves the SecurityKeyIdentifier specified in a saml:Subject element.
/// </summary>
/// <param name="subjectKeyIdentifier">SecurityKeyIdentifier to resolve into a key.</param>
/// <returns>SecurityKey</returns>
/// <exception cref="ArgumentNullException">The input parameter 'subjectKeyIdentifier' is null.</exception>
protected virtual SecurityKey ResolveSubjectKeyIdentifier(SecurityKeyIdentifier subjectKeyIdentifier)
{
if (subjectKeyIdentifier == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("subjectKeyIdentifier");
}
if (this.Configuration == null)
{
throw DiagnosticUtility.ThrowHelperInvalidOperation(SR.GetString(SR.ID4274));
}
if (this.Configuration.ServiceTokenResolver == null)
{
throw DiagnosticUtility.ThrowHelperInvalidOperation(SR.GetString(SR.ID4276));
}
SecurityKey key = null;
foreach (SecurityKeyIdentifierClause clause in subjectKeyIdentifier)
{
if (this.Configuration.ServiceTokenResolver.TryResolveSecurityKey(clause, out key))
{
return key;
}
}
if (subjectKeyIdentifier.CanCreateKey)
{
return subjectKeyIdentifier.CreateKey();
}
return null;
}
示例2: ResolveSecurityKey
internal static SecurityKey ResolveSecurityKey(SecurityKeyIdentifier ski, SecurityTokenResolver tokenResolver)
{
if (ski == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("ski");
if (tokenResolver != null)
{
for (int i = 0; i < ski.Count; ++i)
{
SecurityKey key = null;
if (tokenResolver.TryResolveSecurityKey(ski[i], out key))
return key;
}
}
if (ski.CanCreateKey)
return ski.CreateKey();
return null;
}