Sha256: 639faa3844b4c54524e182ba66149616b79873f0a265a99cb7a1197e924e0f28
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
module Adauth # Active Directory Connection wrapper # # Handles errors and configures the connection. class Connection def initialize(config) @config = config end # Attempts to bind to Active Directory # # If it works it returns the connection # # If it fails it raises and exception def bind conn = Net::LDAP.new :host => @config[:server], :port => @config[:port], :base => @config[:base] if @config[:encryption] conn.encryption = @config[:encryption] end conn.auth "#{@config[:username]}@#{@config[:domain]}", @config[:password] begin Timeout::timeout(10){ if conn.bind return conn else raise "Query User Rejected" end } rescue Timeout::Error raise "Unable to connect to LDAP Server" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
adauth-2.0.0pre2 | lib/adauth/connection.rb |
adauth-2.0.0pre1 | lib/adauth/connection.rb |