Sha256: 078569ddb817ce0ba0cd3f3d35c9e2c64a1efb90f1cf291153c9aa399370e850

Contents?: true

Size: 795 Bytes

Versions: 5

Compression:

Stored size: 795 Bytes

Contents

require 'devise/strategies/authenticatable'

module Devise
  module Strategies
    # Strategy for signing in a user based on his login and password using LDAP.
    # Redirects to sign_in page if it's not authenticated
    class LdapAuthenticatable < Authenticatable
      # Authenticate a user based on login and password params, returning to warden
      # success and the authenticated user if everything is okay. Otherwise redirect
      # to sign in page.
      def authenticate!
        resource = valid_password? && mapping.to.authenticate_with_ldap(params[scope])
        if validate(resource)
          success!(resource)
        else
          fail(:invalid)
        end
      end
    end
  end
end

Warden::Strategies.add(:ldap_authenticatable, Devise::Strategies::LdapAuthenticatable)

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
devise_ldap_authenticatable-0.6.1 lib/devise_ldap_authenticatable/strategy.rb
prathe_devise_ldap_authenticatable-0.6.0 lib/devise_ldap_authenticatable/strategy.rb
devise_ldap_authenticatable-0.6.0 lib/devise_ldap_authenticatable/strategy.rb
devise_ldap_authenticatable-0.5.1 lib/devise_ldap_authenticatable/strategy.rb
devise_ldap_authenticatable-0.5.0 lib/devise_ldap_authenticatable/strategy.rb