Class: Ldaptic::Adapters::ActiveDirectoryAdapter
- Inherits:
-
LDAPConnAdapter
- Object
- AbstractAdapter
- LDAPConnAdapter
- Ldaptic::Adapters::ActiveDirectoryAdapter
- Defined in:
- lib/ldaptic/adapters/active_directory_adapter.rb
Overview
Before using this adapter, try the :ldap_conn adapter. The notes below were originally thought to apply to all Active Directory servers, but now I suspect they are peculiarities of a former employer’s setup. This adapter is a candidate for removal.
ActiveDirectoryAdapter is a LDAPConnAdapter with some Active Directory specific behaviors. To help mitigate server timeout issues, this adapter binds on each request and unbinds afterwards. For search requests, the adapter connects to the global catalog on port 3268 instead of the usual port 389. The global catalog is read-only but is a bit more flexible when it comes to searching.
Active Directory servers can also be connected to with the Net::LDAP adapter.
Instance Method Summary collapse
-
#initialize(options) ⇒ ActiveDirectoryAdapter
constructor
A new instance of ActiveDirectoryAdapter.
-
#server_default_base_dn ⇒ Object
Returns either the
defaultNamingContext
(Active Directory specific) or the first of thenamingContexts
found in the RootDSE.
Methods inherited from LDAPConnAdapter
#add, #authenticate, #compare, #default_base_dn, #delete, #modify, #rename, #search
Methods inherited from AbstractAdapter
#attribute_type, #attribute_types, #compare, #dit_content_rules, #logger, #object_classes, register_as, #root_dse, #schema
Constructor Details
#initialize(options) ⇒ ActiveDirectoryAdapter
Returns a new instance of ActiveDirectoryAdapter.
23 24 25 26 27 28 |
# File 'lib/ldaptic/adapters/active_directory_adapter.rb', line 23 def initialize() super if @connection @options[:connection] = @connection = nil end end |
Instance Method Details
#server_default_base_dn ⇒ Object
Returns either the defaultNamingContext
(Active Directory specific) or the first of the namingContexts
found in the RootDSE.
32 33 34 35 36 37 38 39 40 |
# File 'lib/ldaptic/adapters/active_directory_adapter.rb', line 32 def server_default_base_dn unless defined?(@naming_contexts) @naming_contexts = root_dse(%w(defaultNamingContext namingContexts)) end if @naming_contexts @naming_contexts["defaultNamingContext"].to_a.first || @naming_contexts["namingContexts"].to_a.first end end |