PrincipalPolicy PrincipalPolicy PrincipalPolicy PrincipalPolicy Enum


指定应该如何为应用程序域创建用户和标识对象。Specifies how principal and identity objects should be created for an application domain. 默认值为 UnauthenticatedPrincipalThe default is UnauthenticatedPrincipal.

public enum class PrincipalPolicy
public enum PrincipalPolicy
type PrincipalPolicy = 
Public Enum PrincipalPolicy


NoPrincipal NoPrincipal NoPrincipal NoPrincipal 1

不应该创建任何用户或标识对象。No principal or identity objects should be created.

UnauthenticatedPrincipal UnauthenticatedPrincipal UnauthenticatedPrincipal UnauthenticatedPrincipal 0

应该为未经身份验证的实体创建用户和标识对象。Principal and identity objects for the unauthenticated entity should be created. 未经身份验证的实体的 Name 设置为空字符串 (""),IsAuthenticated 设置为 falseAn unauthenticated entity has Name set to the empty string ("") and IsAuthenticated set to false.

WindowsPrincipal WindowsPrincipal WindowsPrincipal WindowsPrincipal 2

应该创建反映与当前执行线程相关的操作系统标记的用户和标识对象,并且应该将关联的操作系统组映射到角色。Principal and identity objects that reflect the operating system token associated with the current execution thread should be created, and the associated operating system groups should be mapped into roles.


出于性能原因, 在需要默认主体和标识对象之前, 不会创建它们。For performance reasons, the default principal and identity objects are not created until they are needed. 如果将主体显式添加到当前线程, 则不会创建默认主体, 并且会忽略主体策略设置。If a principal is explicitly added to the current thread, a default principal is not created and the principal policy setting is ignored.

受信任的主机可以通过使用SetPrincipalPolicy的方法AppDomain指定这些值中的其他值来覆盖默认主体策略。A trusted host can override the default principal policy by specifying another of these values using the SetPrincipalPolicy method of an AppDomain.