Class: ClassyCAS::Strategies::DeviseDatabase

Inherits:
Base
  • Object
show all
Defined in:
lib/strategies/devise_database.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#fail, #fail!, #redirect_to_login_with_service_url

Instance Attribute Details

#authentication_hashObject

Returns the value of attribute authentication_hash.



5
6
7
# File 'lib/strategies/devise_database.rb', line 5

def authentication_hash
  @authentication_hash
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/strategies/devise_database.rb', line 5

def password
  @password
end

Instance Method Details

#authenticate!Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/strategies/devise_database.rb', line 11

def authenticate!
  resource = valid_password? && User.find_for_database_authentication(authentication_hash)

  if validate(resource){ resource.valid_password?(password) }
    resource.after_database_authentication
    success!(resource)
  else
    fail(:invalid)
  end
end

#valid?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/strategies/devise_database.rb', line 7

def valid?
  params_authenticatable? && with_authentication_hash(params)
end