Saml2SecurityTokenHandler 类

定义

表示安全标记处理程序,其可从 SAML 2.0 Assertions 创建安全标记。

public ref class Saml2SecurityTokenHandler : System::IdentityModel::Tokens::SecurityTokenHandler
public class Saml2SecurityTokenHandler : System.IdentityModel.Tokens.SecurityTokenHandler
type Saml2SecurityTokenHandler = class
    inherit SecurityTokenHandler
Public Class Saml2SecurityTokenHandler
Inherits SecurityTokenHandler
继承
Saml2SecurityTokenHandler

注解

Saml2SecurityTokenHandler 将 SAML 2.0 断言支持的安全令牌序列化和反序列化为 Saml2SecurityToken 对象。 安全令牌处理程序负责创建、读取、写入和验证令牌。

可以将安全令牌服务 (STS) 或信赖方 (RP) 应用程序配置为处理 SAML 2.0 断言支持的安全令牌,方法是将 类的 Saml2SecurityTokenHandler 实例添加到 SecurityTokenHandlerCollection 为服务 (或应用程序) 配置的对象。 这可以通过编程方式或在配置文件中完成。 处理程序本身是在将集合添加到集合时,通过集合的 Configuration 属性从为集合指定的配置进行配置的。 虽然可以通过设置处理程序 Configuration 的 属性来单独配置处理程序,但通常没有必要这样做;但是,如果必须单独配置处理程序,则应在将处理程序添加到集合后设置 该属性。

对于许多方案, Saml2SecurityTokenHandler 类可以按原样使用;但是, 类通过它公开的方法提供许多扩展点。 通过从 Saml2SecurityTokenHandler 派生并重写特定方法,可以修改默认实现中提供的令牌处理功能,也可以向某些自定义方案中可能需要的 SAML 断言规范添加对扩展的处理。

构造函数

Saml2SecurityTokenHandler()

使用默认安全标记需求初始化 Saml2SecurityTokenHandler 类的新实例。

Saml2SecurityTokenHandler(SamlSecurityTokenRequirement)

使用指定的安全标记需求初始化 Saml2SecurityTokenHandler 类的新实例。

字段

TokenProfile11ValueType

由 OASIS Web Services Security SAML Token Profile 1.1所定义的 SAML 2.0 断言 ID 的密钥标识符值类型。 这是一个 URI。

属性

CanValidateToken

获取指示此处理程序是否能验证类型 Saml2SecurityToken 的标记的值。

CanWriteToken

获取指示此处理程序能否序列化 Saml2SecurityToken 类型的标记的值。

CertificateValidator

获取或设置当前实例用于验证 X.509 证书的 X.509 证书验证程序。

Configuration

获取或设置提供配置当前实例的 SecurityTokenHandlerConfiguration 对象。

(继承自 SecurityTokenHandler)
ContainingCollection

获取包含当前实例的标记处理程序集合。

(继承自 SecurityTokenHandler)
KeyInfoSerializer

获取或设置用于序列化和反序列化键标识程序的安全令牌序列化程序。

SamlSecurityTokenRequirement

获取或设置此实例的安全令牌要求。

TokenType

获取处理程序支持的标记的类型。

方法

AddDelegateToAttributes(ClaimsIdentity, ICollection<Saml2Attribute>, SecurityTokenDescriptor)

将所有与该主题相关的委托添加到特性集合中。

CanReadKeyIdentifierClause(XmlReader)

指示当前 XML 元素是否指向一个可由该事例序列化的密匙标识符子句。

CanReadToken(String)

返回指示指定字符串是否可以作为由此实例处理类型标记的反序列化的值。

(继承自 SecurityTokenHandler)
CanReadToken(XmlReader)

指示当前 XML 元素是否可以读取为实例掌控的类型标志。

CanWriteKeyIdentifierClause(SecurityKeyIdentifierClause)

指示指定的密匙标识符子句是否可由该事例序列化。

CollectAttributeValues(ICollection<Saml2Attribute>)

使用通常声明类型、声明值类型集合特性,并使用多个值集合颁发者到单个特性。

CreateAdvice(SecurityTokenDescriptor)

创建断言的 Saml2Advice 对象。

CreateAttribute(Claim, SecurityTokenDescriptor)

从声明中创建一个 Saml2Attribute 对象。

CreateAttributeStatement(ClaimsIdentity, SecurityTokenDescriptor)

从标记说明符创建 Saml2AttributeStatement 对象。

CreateAuthenticationStatement(AuthenticationInformation, SecurityTokenDescriptor)

创建从指定的身份验证信息中创建 SAML 2.0 身份验证语句。

CreateClaims(Saml2SecurityToken)

从 SAML 2.0 标记创建声明。

CreateConditions(Lifetime, String, SecurityTokenDescriptor)

创建断言的条件。

CreateIssuerNameIdentifier(SecurityTokenDescriptor)

创建识别声明颁布者的名称标示符。

CreateSamlSubject(SecurityTokenDescriptor)

为此断言创建 SAML 2.0 主题。

CreateSecurityTokenReference(SecurityToken, Boolean)

标记没附在消息上时创建安全标记引用。

CreateStatements(SecurityTokenDescriptor)

创建包含于断言中的 SAML 2.0 语句。

CreateToken(SecurityTokenDescriptor)

创建基于标记说明符的安全标记。

CreateWindowsIdentity(String)

使用指定用户主名称 (UPN)创建 WindowsIdentity 对象。

CreateXmlStringFromAttributes(IEnumerable<Saml2Attribute>)

从表示参与者的 SAML 2.0 特性的集合中生成一个 XML 格式的字符串。

DenormalizeAuthenticationType(String)

返回匹配规范化的值的 Saml2 AuthenticationContext。

DetectReplayedToken(SecurityToken)

如果指定标记已存在于标记重播缓存中则引发异常;否则该标记将添加到缓存中。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
FindUpn(ClaimsIdentity)

在指定的 ClaimsIdentity 对象中查找 UPN 声明值,目的是为了把其标志映射到 WindowsIdentity 对象。

GetEncryptingCredentials(SecurityTokenDescriptor)

获取标记的加密凭据。 重写此方法以更改标记的加密凭据。

GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetSigningCredentials(SecurityTokenDescriptor)

获取用于对断言进行签名的凭据。

GetTokenReplayCacheEntryExpirationTime(Saml2SecurityToken)

返回直到应在标记重播缓存中保留的标记的时间。

GetTokenTypeIdentifiers()

获取处理程序支持的标记的类型标识符。

GetType()

获取当前实例的 Type

(继承自 Object)
LoadCustomConfiguration(XmlNodeList)

从 XML 加载自定义的配置。

MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
NormalizeAuthenticationContextClassReference(String)

返回与 SAML 身份验证上下文类引用匹配的规范化的值。

ProcessAttributeStatement(Saml2AttributeStatement, ClaimsIdentity, String)

从 SAML 2.0 特性语句中创建声明并将它们添加到指定主题。

ProcessAuthenticationStatement(Saml2AuthenticationStatement, ClaimsIdentity, String)

从 SAML 2.0 身份验证语句中创建声明并将它们添加到指定主题。

ProcessAuthorizationDecisionStatement(Saml2AuthorizationDecisionStatement, ClaimsIdentity, String)

从 SAML 2.0 授权决定语句中创建声明并将它们添加到指定主题。

ProcessSamlSubject(Saml2Subject, ClaimsIdentity, String)

从 SAML 2.0 主题中创建声明并将它们添加到指定主题。

ProcessStatement(Collection<Saml2Statement>, ClaimsIdentity, String)

从 SAML 2.0 语句的集合中创建声明并将它们添加到指定主题。

ReadAction(XmlReader)

读取 <saml:Action> 元素。

ReadAdvice(XmlReader)

读取 <saml:Advice> 元素。

ReadAssertion(XmlReader)

读取 <saml:Assertion> 元素。

ReadAttribute(XmlReader)

读取 <saml:Attribute> 元素。

ReadAttributeStatement(XmlReader)

读取 <saml:AttributeStatement> 元素或 <saml:Statement> 元素,后者指定 saml:AttributeStatementType 的 xsi:type。

ReadAttributeValue(XmlReader, Saml2Attribute)

读取特性值。

ReadAudienceRestriction(XmlReader)

读取 <saml:AudienceRestriction> 元素或 <saml:Condition> 元素,后者指定 saml:AudienceRestrictionType 的 xsi: type。

ReadAuthenticationContext(XmlReader)

读取 <saml:AuthnContext> 元素。

ReadAuthenticationStatement(XmlReader)

读取 <saml:AuthnStatement> 元素或 <saml:Statement> 元素,后者指定 saml:AuthnStatementType 的 xsi:type。

ReadAuthorizationDecisionStatement(XmlReader)

读取 <saml:AuthzDecisionStatement> 元素或 <saml:Statement> 元素,后者指定 saml:AuthzDecisionStatementType 的 xsi:type。

ReadConditions(XmlReader)

读取 <saml:Conditions> 元素。

ReadEncryptedId(XmlReader)

读取 <saml:EncryptedId> 元素。

ReadEvidence(XmlReader)

读取 <saml:Evidence> 元素。

ReadIssuer(XmlReader)

读取 <saml:Issuer> 元素。

ReadKeyIdentifierClause(XmlReader)

读取 SecurityKeyIdentifierClause。

ReadNameId(XmlReader)

读取 <saml:NameID> 元素。

ReadNameIdType(XmlReader)

<Issuer> 和 <NameID> 都是 NameIDType。 此方法读取这些元素之一的内容。

ReadProxyRestriction(XmlReader)

读取 <saml:ProxyRestriction> 元素或 <saml:Condition> 元素,后者指定 saml:ProxyRestrictionType 的 xsi: type。

ReadSigningKeyInfo(XmlReader, Saml2Assertion)

反序列化 SAML Signing KeyInfo。

ReadStatement(XmlReader)

读取 <saml:Statement> 元素。

ReadSubject(XmlReader)

读取 <saml:Subject> 元素。

ReadSubjectConfirmation(XmlReader)

读取 <SubjectConfirmation> 元素。

ReadSubjectConfirmationData(XmlReader)

读取 <saml:SubjectConfirmationData> 元素。

ReadSubjectId(XmlReader, String)

此方法处理针对 ID 的 <Subject> 和 <SubjectConfirmation> 元素使用的构造。

ReadSubjectKeyInfo(XmlReader)

反序列化 SAML 主题 <ds:KeyInfo> 元素。

ReadSubjectLocality(XmlReader)

读取 <saml:SubjectLocality> 元素。

ReadToken(String)

当在派生类中重写时,由派生类反序列化类型处理的指定字符串。

(继承自 SecurityTokenHandler)
ReadToken(XmlReader)

从指定流中读取 SAML 2.0 标记。

ReadToken(XmlReader, SecurityTokenResolver)

当在派生类中重写时,由指定的 XML 读取器使用指定的标记解析器处理派生类类型的标记引用的 XML 进行反序列化。

(继承自 SecurityTokenHandler)
ResolveIssuerToken(Saml2Assertion, SecurityTokenResolver)

将 Signing Key Identifier解析为 SecurityToken

ResolveSecurityKeys(Saml2Assertion, SecurityTokenResolver)

解析在 SecurityKey中引用的 Saml2Assertion 集合。

SetDelegateFromAttribute(Saml2Attribute, ClaimsIdentity, String)

当检测 Saml2Attribute 的特殊类型时调用此方法。 已传入的 Saml2Attribute 包装一个包含特性值的集合的 Saml2Attribute (特性值在 Values 属性中),每一个特性值将被映射到一个声明。 所有的声明都将返回到 ClaimsIdentity

ToString()

返回表示当前对象的字符串。

(继承自 Object)
TraceTokenValidationFailure(SecurityToken, String)

当启用跟踪时,在安全标记的验证过程跟踪失败事件。

(继承自 SecurityTokenHandler)
TraceTokenValidationSuccess(SecurityToken)

当启用跟踪时,跟踪安全标记事件的成功验证。

(继承自 SecurityTokenHandler)
TryResolveIssuerToken(Saml2Assertion, SecurityTokenResolver, SecurityToken)

将 Signing Key Identifier解析为 SecurityToken。

ValidateConditions(Saml2Conditions, Boolean)

验证指定的 Saml2Conditions 对象。

ValidateConfirmationData(Saml2SubjectConfirmationData)

验证指定的 Saml2SubjectConfirmationData 对象。

ValidateToken(SecurityToken)

验证标记数据并返回其声明。

WriteAction(XmlWriter, Saml2Action)

写入 <saml:Action> 元素。

WriteAdvice(XmlWriter, Saml2Advice)

写入 <saml:Advice> 元素。

WriteAssertion(XmlWriter, Saml2Assertion)

序列化指定的 SAML 断言到指定的 XML 编写器。

WriteAttribute(XmlWriter, Saml2Attribute)

写入 <saml:Attribute> 元素。

WriteAttributeStatement(XmlWriter, Saml2AttributeStatement)

写入 <saml:AttributeStatement> 元素。

WriteAttributeValue(XmlWriter, String, Saml2Attribute)

写入 saml:特性值。

WriteAudienceRestriction(XmlWriter, Saml2AudienceRestriction)

写入 <saml:AudienceRestriction> 元素。

WriteAuthenticationContext(XmlWriter, Saml2AuthenticationContext)

写入 <saml:AuthnContext> 元素。

WriteAuthenticationStatement(XmlWriter, Saml2AuthenticationStatement)

写入 <saml:AuthnStatement> 元素。

WriteAuthorizationDecisionStatement(XmlWriter, Saml2AuthorizationDecisionStatement)

写入 <saml:AuthzDecisionStatement> 元素。

WriteConditions(XmlWriter, Saml2Conditions)

写入 <saml:Conditions> 元素。

WriteEvidence(XmlWriter, Saml2Evidence)

写入 <saml:Evidence> 元素。

WriteIssuer(XmlWriter, Saml2NameIdentifier)

写入 <saml:Issuer> 元素。

WriteKeyIdentifierClause(XmlWriter, SecurityKeyIdentifierClause)

Saml2AssertionKeyIdentifierClause 序列化为指定的 XML 编写器。

WriteNameId(XmlWriter, Saml2NameIdentifier)

写入 <saml:NameID> 元素。

WriteNameIdType(XmlWriter, Saml2NameIdentifier)

<Issuer> 和 <NameID> 都是 NameIDType。 此方法写入这些元素之一的内容。

WriteProxyRestriction(XmlWriter, Saml2ProxyRestriction)

写入 <saml:ProxyRestriction> 元素。

WriteSigningKeyInfo(XmlWriter, SecurityKeyIdentifier)

使用指定 XML 编写器写入签名 <ds:KeyInfo> 元素。

WriteStatement(XmlWriter, Saml2Statement)

写入 Saml2Statement。

WriteSubject(XmlWriter, Saml2Subject)

写入 <saml:Subject> 元素。

WriteSubjectConfirmation(XmlWriter, Saml2SubjectConfirmation)

写入 <saml:SubjectConfirmation> 元素。

WriteSubjectConfirmationData(XmlWriter, Saml2SubjectConfirmationData)

写入 <saml:SubjectConfirmationData> 元素。

WriteSubjectKeyInfo(XmlWriter, SecurityKeyIdentifier)

使用指定的 XML 编写器序列化主题 <ds:KeyInfo> 元素。

WriteSubjectLocality(XmlWriter, Saml2SubjectLocality)

写入 <saml:SubjectLocality> 元素。

WriteToken(SecurityToken)

在派生类中重写时,将指定安全标记列化到字符串。 该标记必须是派生类处理的类型。

(继承自 SecurityTokenHandler)
WriteToken(XmlWriter, SecurityToken)

将 SAML2 令牌写入指定的 XML 写入器。

适用于

另请参阅