C# Class Geta.Security.DirectoryDataFactory

ファイルを表示 Open project: Geta/ActiveDirectoryRoleProvider Class Usage Examples

Public Methods

Method Description
AddPropertyToLoad ( string propertyName ) : void

Adds a property to load on access to Active Directory.

This class keeps a list of property names to query for whenever an Active Directory entry is retrieved. By calling this method you can expand this list with custom properties.

ClearCache ( ) : void

Clears the Active Directory cache.

DirectoryDataFactory ( NameValueCollection config ) : System

Initializes a new instance of the DirectoryDataFactory class.

This constructor is intended to be called from within a providers Initialize method. It will read its settings from the config parameter and initialize this instance. Required settings in config are: connectionStringName = name of the connection string to use for connecting to the Active Directory server. connectionUsername = username for the connection. connectionPassword = password for the connection. Optional settings in config are: connectionProtection = level of protection and security for the Active Directory connection. None or Secure (default). cacheTimeout = how long cached Active Directory entries stys in the cache. Default is 10 minutes.

DirectoryDataFactory ( string connectionString, string username, string password, AuthenticationTypes connectionProtection, System.TimeSpan absoluteCacheTimeout ) : System

Initializes a new instance of the DirectoryDataFactory class.

Create and initialize an instance of this class for accessing Active Directory data.

FindAll ( string filter, SearchScope scope ) : ICollection
FindAll ( string filter, SearchScope scope, string sortByProperty, string rootDistinguishedName = null ) : ICollection
FindOne ( string filter, SearchScope scope ) : DirectoryData

Find on Active Directory entry based on search filter.

GetEntry ( string distinguishedName ) : DirectoryData

Gets a specific Active Directory entry as a DirectoryData object.

This method uses caching to speed up the operation, if the DirectoryData object is found in the cache, no communication with the Active Directory domain will take place.

IsWithinSubtree ( string distinguishedName ) : bool

Determines whether the specified distinguished name is part of the Active Directory tree used for searches.

Protected Methods

Method Description
CreateDirectoryDataFromDirectoryEntry ( System.DirectoryServices.DirectoryEntry entry ) : DirectoryData
CreateDirectoryDataFromSearchResult ( System.DirectoryServices.SearchResult result ) : DirectoryData
CreateDirectoryEntry ( ) : System.DirectoryServices.DirectoryEntry
CreateDirectoryEntry ( string rootDistinguishedName ) : System.DirectoryServices.DirectoryEntry
DistinguishedName ( string[]>.Dictionary properties ) : string
EscapeCharacters ( string s ) : string
SchemaClassName ( string[]>.Dictionary properties ) : string
StoreInCache ( string cacheKey, object data ) : void
TryGetDestructive ( NameValueCollection config, string name, string &value ) : bool

Private Methods

Method Description
Initialize ( ) : void

Final initialization steps for a newly created instance.

Method Details

AddPropertyToLoad() public method

Adds a property to load on access to Active Directory.
This class keeps a list of property names to query for whenever an Active Directory entry is retrieved. By calling this method you can expand this list with custom properties.
public AddPropertyToLoad ( string propertyName ) : void
propertyName string Name of the property.
return void

ClearCache() public method

Clears the Active Directory cache.
public ClearCache ( ) : void
return void

CreateDirectoryDataFromDirectoryEntry() protected method

protected CreateDirectoryDataFromDirectoryEntry ( System.DirectoryServices.DirectoryEntry entry ) : DirectoryData
entry System.DirectoryServices.DirectoryEntry
return DirectoryData

CreateDirectoryDataFromSearchResult() protected method

protected CreateDirectoryDataFromSearchResult ( System.DirectoryServices.SearchResult result ) : DirectoryData
result System.DirectoryServices.SearchResult
return DirectoryData

CreateDirectoryEntry() protected method

protected CreateDirectoryEntry ( ) : System.DirectoryServices.DirectoryEntry
return System.DirectoryServices.DirectoryEntry

CreateDirectoryEntry() protected method

protected CreateDirectoryEntry ( string rootDistinguishedName ) : System.DirectoryServices.DirectoryEntry
rootDistinguishedName string
return System.DirectoryServices.DirectoryEntry

DirectoryDataFactory() public method

Initializes a new instance of the DirectoryDataFactory class.
This constructor is intended to be called from within a providers Initialize method. It will read its settings from the config parameter and initialize this instance. Required settings in config are: connectionStringName = name of the connection string to use for connecting to the Active Directory server. connectionUsername = username for the connection. connectionPassword = password for the connection. Optional settings in config are: connectionProtection = level of protection and security for the Active Directory connection. None or Secure (default). cacheTimeout = how long cached Active Directory entries stys in the cache. Default is 10 minutes.
public DirectoryDataFactory ( NameValueCollection config ) : System
config System.Collections.Specialized.NameValueCollection The configuration data to use.
return System

DirectoryDataFactory() public method

Initializes a new instance of the DirectoryDataFactory class.
Create and initialize an instance of this class for accessing Active Directory data.
public DirectoryDataFactory ( string connectionString, string username, string password, AuthenticationTypes connectionProtection, System.TimeSpan absoluteCacheTimeout ) : System
connectionString string The connection string.
username string The username.
password string The password.
connectionProtection AuthenticationTypes The connection protection.
absoluteCacheTimeout System.TimeSpan The absolute cache timeout.
return System

DistinguishedName() protected method

protected DistinguishedName ( string[]>.Dictionary properties ) : string
properties string[]>.Dictionary
return string

EscapeCharacters() protected method

protected EscapeCharacters ( string s ) : string
s string
return string

FindAll() public method

public FindAll ( string filter, SearchScope scope ) : ICollection
filter string
scope SearchScope
return ICollection

FindAll() public method

public FindAll ( string filter, SearchScope scope, string sortByProperty, string rootDistinguishedName = null ) : ICollection
filter string
scope SearchScope
sortByProperty string
rootDistinguishedName string
return ICollection

FindOne() public method

Find on Active Directory entry based on search filter.
public FindOne ( string filter, SearchScope scope ) : DirectoryData
filter string The filter, which is a LDAP query.
scope SearchScope The scope at which to search.
return DirectoryData

GetEntry() public method

Gets a specific Active Directory entry as a DirectoryData object.
This method uses caching to speed up the operation, if the DirectoryData object is found in the cache, no communication with the Active Directory domain will take place.
public GetEntry ( string distinguishedName ) : DirectoryData
distinguishedName string Distinguished name of the entry.
return DirectoryData

IsWithinSubtree() public method

Determines whether the specified distinguished name is part of the Active Directory tree used for searches.
public IsWithinSubtree ( string distinguishedName ) : bool
distinguishedName string Distinguished name of an Active Directory entry.
return bool

SchemaClassName() protected method

protected SchemaClassName ( string[]>.Dictionary properties ) : string
properties string[]>.Dictionary
return string

StoreInCache() protected method

protected StoreInCache ( string cacheKey, object data ) : void
cacheKey string
data object
return void

TryGetDestructive() protected method

protected TryGetDestructive ( NameValueCollection config, string name, string &value ) : bool
config NameValueCollection
name string
value string
return bool