Principal 类

定义

封装对所有安全主体通用的帐户数据和操作。Encapsulates the account data and operations common to all security principals. 这是从中派生所有安全主体的抽象基类。This is the abstract base class from which all security principals are derived.

public ref class Principal abstract : IDisposable
public abstract class Principal : IDisposable
type Principal = class
    interface IDisposable
Public MustInherit Class Principal
Implements IDisposable
继承
Principal
派生
实现

注解

从此类派生的自定义扩展类可以从派生类构造函数中调用此构造函数以初始化基类。Custom extension classes that derive from this class can call this constructor from the derived class constructor to initialize the base class. 有关详细信息, 请参阅主体扩展概述主题。For more information, see the Principal Extensions overview topic.

构造函数

Principal()

初始化 Principal 类的新实例。Initializes a new instance of the Principal class. 此构造函数由派生类构造函数调用以初始化基类,不适合直接从代码中调用。This constructor is called by derived-class constructors to initialize the base class and is not intended to be called directly from your code.

属性

Context

获取与主体关联的主体上下文。Gets a principal context that is associated with the principal.

ContextRaw

获取与此主体关联的主体上下文。Gets a principal context that is associated with this principal.

ContextType

获取上下文类型枚举值,该值指定与此主体关联的主体上下文的类型。Gets the context type enumeration value that specifies the type of principal context associated with this principal.

Description

获取或设置主体的说明。Gets or sets the description of the principal.

DisplayName

获取或设置此主体的显示名称。Gets or sets the display name for this principal.

DistinguishedName

获取此主体的可分辨名称 (DN)。Gets the distinguished name (DN) for this principal.

Guid

获取与此主体关联的 GUID。Gets the GUID associated with this principal.

Name

获取或设置此主体的名称。Gets or sets the name of this principal.

SamAccountName

获取或设置此主体的 SAM 帐户名。Gets or sets the SAM account name for this principal.

Sid

获取主体的安全 ID (SID)。Gets the Security ID (SID) of the principal.

StructuralObjectClass

获取结构对象类目录特性。Gets the structural object class directory attribute.

UserPrincipalName

获取或设置与此主体关联的用户主体名称 (UPN)。Gets or sets the user principal name (UPN) associated with this principal.

方法

CheckDisposedOrDeleted()

确定是否已对此类调用 Dispose()Delete() 方法。Determines whether the Dispose() or Delete() methods have been called on this class. 此方法由从此主体类派生的类调用。This method is called by classes that derive from this principal class.

Delete()

从存储区中删除主体对象。Deletes the principal object from the store.

Dispose()

处置 Principal 对象的当前实例。Disposes the current instance of the Principal object.

Equals(Object)

返回一个布尔值,该值指定提供的对象是否等于当前对象。Returns a Boolean value that specifies whether the supplied object is equal to the current object.

ExtensionGet(String)

检索扩展类对象的属性。Retrieves an attribute of an extended class object.

ExtensionSet(String, Object)

设置扩展类中特性的值。Sets the value of an attribute in an extended class.

FindByIdentity(PrincipalContext, IdentityType, String)

返回与指定标识类型相匹配的主体对象和值。Returns a principal object that matches the specified identity type, and value. 此版本的 FindByIdentity(PrincipalContext, IdentityType, String) 方法确定标识值的格式。This version of the FindByIdentity(PrincipalContext, IdentityType, String) method determines the format of the identity value.

FindByIdentity(PrincipalContext, String)

返回一个与指定的标识值匹配的主体对象。Returns a principal object that matches the specified identity value.

FindByIdentityWithType(PrincipalContext, Type, IdentityType, String)

返回与指定标识类型相匹配的主体对象和值。Returns a principal object that matches the specified identity type, and value. 此方法由派生类 FindByIdentity 方法的实现调用,将搜索限制为派生类类型,不适合直接从代码中调用。This method is called by the implementation of the derived-class FindByIdentity method to restrict the search to the derived class type and is not intended to be called directly from your code.

FindByIdentityWithType(PrincipalContext, Type, String)

返回与指定标识类型相匹配的主体对象和值。Returns a principal object that matches the specified identity type, and value. 此方法由派生类 FindByIdentity 方法的实现调用,将搜索限制为派生类类型,不适合直接从代码中调用。This method is called by the implementation of the derived-class FindByIdentity method to restrict the search to the derived class type and is not intended to be called directly from your code.

GetGroups()

返回组对象的集合,这些对象指定当前主体是其成员的组。Returns a collection of group objects that specify the groups of which the current principal is a member.

GetGroups(PrincipalContext)

返回组对象的集合,主体是这些对象的成员,并且这些对象存在于由指定的上下文参数提供的存储区中。Returns a collection of group objects that the principal is a member of and that exist in the store provided by the specified context parameter.

GetHashCode()

检索从主体对象的内容创建的哈希,适合在哈希算法和哈希表这样的数据结构中使用。Retrieves the hash created from the contents of the principal object, suited for use in hashing algorithms and data structures like a hash table.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
GetUnderlyingObject()

返回基础 DirectoryEntry 对象,其将提供主体对象的联系人数据。Returns the underlying DirectoryEntry object that provides the contact data for the principal object.

GetUnderlyingObjectType()

返回基础对象类型。Returns the underlying object type.

IsMemberOf(GroupPrincipal)

返回一个布尔值,该值指定该主体是否是指定组的成员。Returns a Boolean value that specifies whether the principal is a member of the specified group.

IsMemberOf(PrincipalContext, IdentityType, String)

返回一个布尔值,该值指定该主体是否是由标识类型和值指定的组的成员。Returns a Boolean value that specifies whether the principal is a member of the group specified by identity type and value.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Save()

将对主体对象所做的更改保存到存储区中。Saves the changes that were made on the principal object to the store. 如果它是一个新主体对象,则此方法会将其插入到存储区中。If this is a new principal object, this method inserts it into the store.

Save(PrincipalContext)

将对主体对象所做的更改保存到存储区中。Saves the changes that were made on the principal object to the store. 如果它是一个新主体对象,则此方法会将其插入到指定上下文中。If this is a new principal object, this method inserts it into the specified context. 如果已保持主体,则会将该主体从原来的上下文移动到指定的上下文中。If the principal has already been persisted, it is moved from the original context to the specified context.

ToString()

返回当前主体对象的用户友好字符串表示形式。Returns a user friendly string representation of the current principal object.

适用于