Module: Sinatra::Authorization

Defined in:
lib/sinatra/authorization.rb

Overview

HTTP Authorization helpers for Sinatra.

In your helpers module, include Sinatra::Authorization and then define an #authorize(user, password) method to handle user provided credentials.

Inside your events, call #login_required to trigger the HTTP Authorization window to pop up in the browser.

Code adapted from Ryan Tomayko and Christopher Schneid, shared under an MIT License

Defined Under Namespace

Modules: DSL, Helpers

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



86
87
88
89
# File 'lib/sinatra/authorization.rb', line 86

def self.registered(app)
  Sinatra.register(DSL)
  app.helpers Helpers
end