blindgaenger / sinatra-auth

use the basic HTTP authentication of rack in your sinatra application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sinatra-Auth

I know, I know! There are already some implementations out there. Please don’t
ask me why … I just did it!

Your choice

Just let me put my stuff to all the other projects, ok? Now it’s up to you. :)

  • blindgaenger / sinatra-auth « Yep, this project!

    Adds Rack::Auth as middleware and checks protected routes before dispatching to sinatra.

Done?

Installation

sudo gem source —add http://gems.github.com sudo gem install blindgaenger-sinatra-auth

Usage

Use auth to configure :basic authorization and the realm My App. The block
checks your creditals.

configure do auth :basic, “My App” do |username, password| username == ‘foo’ && password = ‘bar’ end end

Define your routes as usual, but now you can protect some of them.


  get '/public' do
    'free'
  end

  protect do
    get '/private' do
      'secret'
    end
  end

Done!

Contact

You can contact me via mail at blindgaenger at gmail dot com, or leave me a
message on my Github profile.

About

use the basic HTTP authentication of rack in your sinatra application


Languages

Language:Ruby 100.0%