SecureConversationServiceCredential.SecurityContextClaimTypes 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取用于 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 中的声明过程中返回原始强类型对象有所帮助。