Module: Authlogic::Session::HttpAuth::Config

Defined in:
lib/authlogic/session/http_auth.rb

Overview

Configuration for the HTTP basic auth feature of Authlogic.

Instance Method Summary collapse

Instance Method Details

#allow_http_basic_auth(value = nil) ⇒ Object Also known as: allow_http_basic_auth=

Do you want to allow your users to log in via HTTP basic auth?

I recommend keeping this enabled. The only time I feel this should be disabled is if you are not comfortable having your users provide their raw username and password. Whatever the reason, you can disable it here.

  • Default: true

  • Accepts: Boolean



27
28
29
# File 'lib/authlogic/session/http_auth.rb', line 27

def allow_http_basic_auth(value = nil)
  rw_config(:allow_http_basic_auth, value, true)
end

#http_basic_auth_realm(value = nil) ⇒ Object Also known as: http_basic_auth_realm=

HTTP authentication realm

Sets the HTTP authentication realm.

Note: This option has no effect unless request_http_basic_auth is true

  • Default: ‘Application’

  • Accepts: String



62
63
64
# File 'lib/authlogic/session/http_auth.rb', line 62

def http_basic_auth_realm(value = nil)
  rw_config(:http_basic_auth_realm, value, 'Application')
end

#request_http_basic_auth(value = nil) ⇒ Object Also known as: request_http_basic_auth=

Whether or not to request HTTP authentication

If set to true and no HTTP authentication credentials are sent with the request, the Rails controller method authenticate_or_request_with_http_basic will be used and a ‘401 Authorization Required’ header will be sent with the response. In most cases, this will cause the classic HTTP authentication popup to appear in the users browser.

If set to false, the Rails controller method authenticate_with_http_basic is used and no 401 header is sent.

Note: This parameter has no effect unless allow_http_basic_auth is true

  • Default: false

  • Accepts: Boolean



49
50
51
# File 'lib/authlogic/session/http_auth.rb', line 49

def request_http_basic_auth(value = nil)
  rw_config(:request_http_basic_auth, value, false)
end