Sha256: 7b2fbbe6160936b1a9b69ba0d531c781c9a540f1bac06600b81bc14ad891b22c

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

require 'net/ldap'

module Devise

  # simple adapter for ldap credential checking
  # ::Devise.ldap_host
  module LdapAdapter

    def self.valid_credentials?(login, password)
      @encryption = ::Devise.ldap_ssl ? :simple_tls : nil
      ldap = Net::LDAP.new(:encryption => @encryption)
      ldap.host = ::Devise.ldap_host
      ldap.port = ::Devise.ldap_port
      ldap.auth login, password
      if ldap.bind
        true
      else
        # errors.add_to_base(ldap.get_operation_result.message)
        false
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise_ldap_authenticatable-0.1.2 lib/devise_ldap_authenticatable/ldap_adapter.rb