No commit activity in last 3 years
No release in over 3 years
Provides authentication related stuff.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

Authentication-Service¶ ↑

Authentication support for Rails applications. Can be also used with non Rails apps.

Quick start¶ ↑

In your Gemfile:

gem 'authentication-service'

In your ApplicationController:

include AuthenticationService::Rails
authentication_service :account => Persistance::Account, :session => Persistance::Session
before_filter :authenticate

Generate required stuff:

rails generate authentication_service:all

It generates models (with corresponding migrations):

  • persistance/account.rb - the account model

  • persistance/session.rb - used to persist sessions

It generates sessions controller and view:

  • sessions_controller.rb - controller to authenticate users

  • views/sessions/new.html.erb - login form template

It injects routes.

Enabling authentication¶ ↑

In ApplicationController before_filter enables authentication for entire app:

before_filter :authenticate

It can be also skipped for entire controller or for individual actions:

skip_filter :authenticate #Skips for entire controller
skip_filter :authenticate, :only => [:index] #Skips just for index action
before_filter :authenticate, :only => [:index] #Authenticates just index action.

Testing¶ ↑

To mark your controller as authenticated just add following line:

@controller.current_session = mock(:current_session)