Class: CASinoCore::Authenticator::LDAP

Inherits:
Object
  • Object
show all
Defined in:
lib/casino_core/authenticator/ldap/version.rb,
lib/casino_core/authenticator/ldap.rb

Constant Summary collapse

VERSION =
'0.0.4'
DEFAULT_USERNAME_ATTRIBUTE =
'uid'

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ LDAP

Returns a new instance of LDAP.

Parameters:

  • options (Hash)


8
9
10
# File 'lib/casino_core/authenticator/ldap.rb', line 8

def initialize(options)
  @options = options
end

Instance Method Details

#validate(username, password) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/casino_core/authenticator/ldap.rb', line 12

def validate(username, password)
  @username = username
  @password = password
  begin
    connect
    authenticate
    if !@user_plain
      false
    else
      generate_user
      @user
    end
  rescue Net::LDAP::LdapError => e
    raise CASinoCore::Authenticator::AuthenticatorError,
      "LDAP authentication failed with '#{e}'. Check your authenticator configuration."
  end
end