kule / sinatra-authorization

HTTP Authorization helpers for Sinatra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sinatra Authorization

HTTP Authorization helpers for Sinatra.

Example

require "sinatra/authorization"

set :authorization_realm, "Protected zone"

helpers do
  def authorize(login, password)
    login == "admin" && password == "secret"
  end
end

get "/" do
  "Hello"
end

get "/admin" do
  login_required

  "Welcome in protected zone"
end

About

HTTP Authorization helpers for Sinatra


Languages

Language:Ruby 100.0%