语言

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)

属性值

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 允许提供已知资源类型的列表。 这有助于 DataContractSerializer 在对 Cookie 中的声明进行反序列化期间,以便它可以返回原始强类型对象。

适用于