During the past month I have covered various authentication solutions for Rails. This article is the fifth in the series (oh my) and our guest today is Clearance.
Clearance is an opinionated e-mail/password-based authentication and authorization solution for Rails created by Thoughtbot Inc (the guys who created FactoryGirl, PaperClip and other cool libraries). Clearance is designed as a Rails engine. It is intended to be small, simple, and well-tested. In a sense, it is similar to Devise in that Clearance has many defaults to help you get started in nearly five minutes, and all those defaults can be easily overridden. In contrast to Devise, however, Clearance presents only minimal functionality that can be customized further as you see fit.
This solution is actively maintained, so I really recommend trying it out. In this article I will demonstrate how to integrate Clearance, restrict access, customize it, and use additional checks during sign-in.
Source code can be found on GitHub.
Working demo is available at sitepoint-clearance.herokuapp.com.
Preparations
To start off, create a new Rails app under a codename "Clear Sky":
$ rails new ClearSky -T
For this demo Rails 4.2 will be used, but Clearance is compatible with Rails 3.2, as well.
Continue reading %Simple Rails Authentication with Clearance%
by Ilya Bodrov-Krukowski via SitePoint
No comments:
Post a Comment