ClaimTypeRequirement 類別

定義

指定必須在聯合認證中出現的必要及選擇性宣告型別。

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

範例

下列程式碼會將兩項宣告類型需求新增至安全性繫結程序。

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));

下列組態檔可與上述程式碼搭配使用。

<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>

備註

在聯合案例中,服務會聲明對傳入認證的需求。 例如,傳入認證必須處理特定的一組宣告型別。 這項需求會顯示在安全性原則中。 當用戶端向安全性權杖服務要求安全性權杖時, (例如 CardSpace) ,它會將需求放入權杖要求中,讓安全性權杖服務可以發出符合需求的安全性權杖。

建構函式

ClaimTypeRequirement(String)

針對指定之型別的必要宣告初始化 ClaimTypeRequirement 類別的新執行個體。

ClaimTypeRequirement(String, Boolean)

針對指定之型別的宣告初始化 ClaimTypeRequirement 類別的新執行個體。

屬性

ClaimType

取得在建構函式中指定的宣告型別。

IsOptional

取得值,這個值表示宣告是否為選擇性的。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於