Module: Roda::RodaPlugins::HttpAuth

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

Defined Under Namespace

Modules: InstanceMethods

Constant Summary collapse

VERSION =
"0.2.0"
DEFAULTS =
{
  realm: "Restricted Area",
  unauthorized_headers: ->(opts) do
    { 'WWW-Authenticate' => ('Basic realm="%s"' % opts[:realm]) }
  end,
  unauthorized: ->(r) {},
  schemes: %w[basic]
}

Class Method Summary collapse

Class Method Details

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



15
16
17
18
19
# File 'lib/roda/plugins/http_auth.rb', line 15

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