Module: Roda::RodaPlugins::HttpAuth

Defined in:
lib/zleb/plugins/http_auth.rb

Defined Under Namespace

Modules: InstanceMethods

Constant Summary collapse

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



17
18
19
20
21
# File 'lib/zleb/plugins/http_auth.rb', line 17

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