0.01
No commit activity in last 3 years
No release in over 3 years
A user authentication middleware built with Sinatra and Warden
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.10.2
~> 0.10.2
>= 0
~> 1.0.a
~> 0.9.0
 Project Readme

Sinatra Doorman¶ ↑

A user authentication extension for Sinatra based on Warden.

Features¶ ↑

Base

  • Signup w/ email confirmation

  • Login/Logout

Optional

  • Remember Me

  • Forgotten password reset

Installation¶ ↑

This project requires Sinatra 1.0 (see #297). Currently the user model requires DataMapper, this dependency may be removed in the future.

gem install sinatra --pre
gem install warden pony dm-core dm-validations dm-timestamps
gem install sinatra-doorman

Usage¶ ↑

require 'doorman'

use Rack::Session::Cookie

#Optional, if you want user notices
require 'rack/flash'
use Rack::Flash

To use as a middleware

use Sinatra::Doorman::Middleware

To use as a Sinatra extension, call register on the features you want

#call Sinatra.register if you are writing a top-level app
register Sinatra::Doorman::Base
register Sinatra::Doorman::RememberMe
register Sinatra::Doorman::ForgotPassword

Note: usually you don’t need to call register explicitly when extending ‘classic’ top-level Sinatra apps, because the extension author will call it for you. This is not the case in this project, because I wanted to keep some components optional, and I did not want to alter the top-level namespace of any Sinatra apps using this as middleware.

Views¶ ↑

At this time, you need to copy the contents of the views folder in this project to the views folder of your Sinatra application.

It is my objective to make this middleware useful for any Rack based application. One approach that I have been considering is requesting an empty layout from the downstream app, and transforming it using Effigy.

Ideally I would like:

  • Reasonable default views without copying files from GH or gem

  • User option to replace/customize default views

  • Rendering within the application layout

I can not think of any middleware that adds to or significantly alters an app’s response body. Perhaps this is not an appropriate thing to be doing, but it makes sense to me on some level. Ultimately, I would like this code to be something that one could plug into their middleware stack and use without too much trouble.

Development and Testing¶ ↑

If you want to work on this project, there is one thing to note. When I run all the cucumber features at once, I get some kind of issue with Webrat where Infinite Redirect errors are raised on the signup feature. From what I can tell, there is not actually any infinite redirect problem. I have not got to the bottom of this yet, so in the meantime I run cucumber in two bites:

cucumber --tags @signup
cucumber --tags ~@signup