Class: UcbGroups::LdapConn
- Inherits:
-
Object
- Object
- UcbGroups::LdapConn
- Defined in:
- lib/ucb_groups/ldap_conn.rb
Class Method Summary collapse
- .authenticate(username, password, host = nil) ⇒ Object
- .authenticate_from_config(config_file) ⇒ Object
- .conn ⇒ Object
Class Method Details
.authenticate(username, password, host = nil) ⇒ Object
11 12 13 14 15 |
# File 'lib/ucb_groups/ldap_conn.rb', line 11 def self.authenticate(username, password, host=nil) @username = username @password = password @host = host || 'nds.berkeley.edu' end |
.authenticate_from_config(config_file) ⇒ Object
17 18 19 20 |
# File 'lib/ucb_groups/ldap_conn.rb', line 17 def self.authenticate_from_config(config_file) conf = YAML.load_file(config_file) self.authenticate(conf['username'], conf['password'], conf['host']) end |
.conn ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/ucb_groups/ldap_conn.rb', line 3 def self.conn net_ldap = ::Net::LDAP.new(auth_info) net_ldap.bind || raise(BindFailedException) net_ldap rescue ::Net::LDAP::LdapError raise(LdapBindFailedException) end |