Skip to content

Commit 86e4ba1

Browse files
committed
Move registration of AuthAdapters to net/ldap
1 parent b56450d commit 86e4ba1

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

lib/net/ldap.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class LDAP
2727
require 'net/ldap/connection'
2828
require 'net/ldap/version'
2929
require 'net/ldap/error'
30+
require 'net/ldap/auth_adapter'
31+
require 'net/ldap/auth_adapter/simple'
32+
require 'net/ldap/auth_adapter/sasl'
33+
34+
Net::LDAP::AuthAdapter.register([:simple, :anon, :anonymous], Net::LDAP::AuthAdapter::Simple)
35+
Net::LDAP::AuthAdapter.register(:sasl, Net::LDAP::AuthAdapter::Sasl)
3036

3137
# == Quick-start for the Impatient
3238
# === Quick Example of a user-authentication against an LDAP directory:

lib/net/ldap/auth_adapter/gss_spnego.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,3 @@ def bind(auth)
3838
end
3939
end
4040
end
41-
42-
Net::LDAP::Adapter.register(:gss_spnego, Net::LDAP::AuthAdapters::GSS_SPNEGO)

lib/net/ldap/auth_adapter/sasl.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module Net
44
class LDAP
5-
module AuthAdapter
5+
class AuthAdapter
66
class Sasl < Net::LDAP::AuthAdapter
77
#--
88
# Required parameters: :mechanism, :initial_credential and
@@ -58,5 +58,3 @@ def bind(auth)
5858
end
5959
end
6060
end
61-
62-
Net::LDAP::AuthAdapter.register(:sasl, Net::LDAP::AuthAdapters::Sasl)

lib/net/ldap/auth_adapter/simple.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,3 @@ def bind(auth)
3232
end
3333
end
3434
end
35-
36-
Net::LDAP::AuthAdapter.register(:simple, Net::LDAP::AuthAdapters::Simple)

lib/net/ldap/connection.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ def next_msgid
250250
def bind(auth)
251251
instrument "bind.net_ldap_connection" do |payload|
252252
payload[:method] = meth = auth[:method]
253-
require "net/ldap/auth_adapters/#{meth}"
254253
adapter = Net::LDAP::AuthAdapter[meth]
255254
adapter.new(self).bind(auth)
256255
end

0 commit comments

Comments
 (0)