class GitHub::Ldap::UserSearch::GlobalCatalog

Constants

LDAPS_GC_PORT
STANDARD_GC_PORT

Public Class Methods

connection(ldap) click to toggle source

Returns a connection to the Active Directory Global Catalog

See: technet.microsoft.com/en-us/library/cc728188(v=ws.10).aspx

# File lib/github/ldap/user_search/active_directory.rb, line 32
def self.connection(ldap)
  @global_catalog_instance ||= begin
    netldap = ldap.connection
    # This is ugly, but Net::LDAP doesn't expose encryption or auth
    encryption = netldap.instance_variable_get(:@encryption)
    auth = netldap.instance_variable_get(:@auth)

    new({
      host: ldap.host,
      instrumentation_service: ldap.instrumentation_service,
      port: encryption ? LDAPS_GC_PORT : STANDARD_GC_PORT,
      auth: auth,
      encryption: encryption
    })
  end
end