Share via


SecureConversationServiceCredential.SecurityContextClaimTypes 屬性

定義

取得用於 Cookie 序列化之 Type 宣告的集合。

public:
 property System::Collections::ObjectModel::Collection<Type ^> ^ SecurityContextClaimTypes { System::Collections::ObjectModel::Collection<Type ^> ^ get(); };
public System.Collections.ObjectModel.Collection<Type> SecurityContextClaimTypes { get; }
member this.SecurityContextClaimTypes : System.Collections.ObjectModel.Collection<Type>
Public ReadOnly Property SecurityContextClaimTypes As Collection(Of Type)

屬性值

Collection<Type>

用於 Cookie 序列化之 Type 宣告的集合。

範例

下列程式碼會示範如何取得這個屬性。

static void Configure(ServiceHost serviceHost)
{
    /*
     * There are certain settings that cannot be configured via app.config.
     * The security state encoder is one of them.
     * Plug in a SecurityStateEncoder that uses the configured certificate
     * to protect the security context token state.
     *
     * Note: You don't need a security state encoder for cookie mode.  This was added to the
     * sample to illustrate how you would plug in a custom security state encoder should
     * your scenario require one.
     * */
    serviceHost.Credentials.SecureConversationAuthentication.SecurityStateEncoder =
            new CertificateSecurityStateEncoder(serviceHost.Credentials.ServiceCertificate.Certificate);
   Collection<Type> myClaimTypes = new Collection<Type>();
    myClaimTypes = serviceHost.Credentials.SecureConversationAuthentication.SecurityContextClaimTypes;
}

備註

若要將宣告序列化為 SCT Cookie,Windows Communication Foundation (WCF) 會做 DataContractSerializer 為預設值。 由於宣告資源是可延伸的,因此 WCF 可讓您提供已知資源類型的清單。 這點可在 Cookie 內宣告還原序列化期間協助 DataContractSerializer,使其可以傳回原始的強型別物件。

適用於