Project

authifer

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Run your own Authentication provider!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Authifer

Trust me Authifer, I'm not half as think as you drunk I am!

One obstacles to chiseling away a monolithic application architecture is managing user authentication on several smaller apps.

Authifer abstracts authentication into it's own application so you can focus your attention on adding useful features for your customers instead of managing user identities.

Usage

A fully working implementation of authifer is Make Headspaces Auth website - source

Feel free to reference the code for inspiration.

require 'sinatra'

Authifer.configure do |config|
  config.database_url = 'sqlite3://db/auth_provider.sqlite3'
end

use Authifer::App

helpers do
  include Authifer::AuthenticationHelper
  include Authifer::Paths
end

get '/' do
  if logged_in?
    "<a href='#{ delete_session_path }'>log out</a>"
  else
    "<a href='#{ new_session_path }'>log in</a>" +
    " or " +
    "<a href='#{ new_user_path }'>register</a>"
  end
end

Configuration

The configure block allows you to set several options:

  1. views_path - optional - The absolute path to your authifer templates. Defaults to the views inside the authifer gem
  2. database_url - required - The full url to your database. Make sure you've included the proper gem for your database! We use the ActiveRecord ORM under the covers.
  3. enforce_ssl - optional - Whether you want to raise errors on requests that don't come in over HTTPS. Defaults to true.

An example development configuration:

Authifer.configure do |config|
  config.enforce_ssl = false
  config.views_path = File.join(File.path(File.expand_path(__FILE__)),'views', 'authifer')
  config.database_url = 'sqlite3://db/auth_provider.sqlite3'
end

Check out these sample views.

Contributing

We love pull requests and issues!

For enhancements

Create an issue or pull request with:

  1. A good name
  2. Tests where applicable

For bug fixes

Create an issue with:

  1. Reproduction steps
  2. Stack trace if applicable
  3. Proposed fix if applicable