Class: Devise::Strategies::HttpAuthenticatable

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

Overview

Sign in an user using HTTP authentication.

Instance Method Summary collapse

Methods inherited from Base

#mapping

Instance Method Details

#authenticate!Object



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

def authenticate!
  username, password = username_and_password

  if resource = mapping.to.authenticate_with_http(username, password)
    success!(resource)
  else
    custom!([401, custom_headers, ["HTTP Basic: Access denied.\n"]])
  end
end

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  http_authentication? && mapping.to.respond_to?(:authenticate_with_http)
end