Module: Roda::RodaPlugins::HttpAuth

Defined in:
lib/roda/plugins/http_auth/version.rb,
lib/roda/plugins/http_auth.rb

Defined Under Namespace

Modules: RequestMethods

Constant Summary collapse

VERSION =
"0.1.2"
DEFAULTS =
{
  realm: "Restricted Area",
  unauthorized_headers: proc do |opts|
    {'Content-Type' => 'text/plain',
     'Content-Length' => '0',
     'WWW-Authenticate' => ('Basic realm="%s"' % opts[:realm])}
  end,
  bad_request_headers: proc do |opts|
    {'Content-Type' => 'text/plain', 'Content-Length' => '0'}
  end,
  schemes: %w[basic]
}

Class Method Summary collapse

Class Method Details

.configure(app, opts = {}) ⇒ Object



19
20
21
22
23
# File 'lib/roda/plugins/http_auth.rb', line 19

def self.configure(app, opts={})
  plugin_opts = (app.opts[:http_auth] ||= DEFAULTS)
  app.opts[:http_auth] = plugin_opts.merge(opts)
  app.opts[:http_auth].freeze
end