ClaimTypeRequirement 类

定义

指定希望出现在联合凭据中的必选和可选的声明类型。Specifies the types of required and optional claims expected to appear in the federated credential.

public ref class ClaimTypeRequirement
public class ClaimTypeRequirement
type ClaimTypeRequirement = class
Public Class ClaimTypeRequirement
继承
ClaimTypeRequirement

示例

下面的代码将两个声明类型要求添加到安全绑定。The following code adds two claim type requirements to a security binding.

WSFederationHttpBinding binding = new WSFederationHttpBinding();
binding.Security.Message.ClaimTypeRequirements.Add
   (new ClaimTypeRequirement
   ("http://schemas.microsoft.com/ws/2005/05/identity/claims/EmailAddress"));
binding.Security.Message.ClaimTypeRequirements.Add
   (new ClaimTypeRequirement
   ("http://schemas.microsoft.com/ws/2005/05/identity/claims/UserName", true));

下面的配置文件与前面的代码一起使用。The following config file is used with the preceding code.

<bindings>
  <wsFederationHttpBinding>
    <binding name="myFederatedBinding">
      <security mode="Message">
        <message issuedTokenType="urn:oasis:names:tc:SAML:1.0:assertion">
          <claimTypeRequirements>
            <add claimType="http://schemas.microsoft.com/ws/2005/05/identity/claims/EmailAddress"
              isOptional="false" />
            <add claimType="http://schemas.microsoft.com/ws/2005/05/identity/claims/UserName"
              isOptional="true" />
          </claimTypeRequirements>
        </message>
      </security>
    </binding>
  </wsFederationHttpBinding>
</bindings>

注解

在联合方案中,服务规定有关传入凭据的要求。In a federated scenario, services state the requirements on incoming credentials. 例如,传入凭据必须具有某组声明类型。For example, the incoming credentials must possess a certain set of claim types. 此要求出现在安全策略中。This requirement is manifested in a security policy. 当客户端向安全令牌服务(例如 CardSpaceCardSpace)请求安全令牌时,它会将需求放置在令牌请求中,以便安全令牌服务能够相应地颁发符合需求的安全令牌。When a client requests a security token from a security token service (for example, CardSpaceCardSpace), it puts the requirements into a token request so that the security token service can issue the security token that satisfies the requirements accordingly.

构造函数

ClaimTypeRequirement(String)

为所需的指定类型声明初始化 ClaimTypeRequirement 类的新实例。Initializes a new instance of the ClaimTypeRequirement class for a required claim of the specified type.

ClaimTypeRequirement(String, Boolean)

为指定类型的声明初始化 ClaimTypeRequirement 类的新实例。Initializes a new instance of the ClaimTypeRequirement class for a claim of the specified type.

属性

ClaimType

获取构造函数中指定的声明类型。Gets the claim type that was specified in the constructor.

IsOptional

获取一个值,该值指示声明是否可选。Gets a value that indicates whether the claim is optional.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于