No release in over 3 years
Low commit activity in last 3 years
A OmniAuth strategy to authenticate using a model class.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Omniauth::Internal

omniauth-internal is a OmniAuth strategy to authenticate using Rails 3.1 has_secure_password by delegating to User.authenticate(username, password).

omniauth-internal can be used as an authenticator for OmniAuth MultiPassword.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-internal'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth-internal

Usage

Add a authenticate class method to your model:

  def self.authenticate(login, password)
    find_by_email(login).try(:authenticate, password)
  end

You can configure the model class used by omniauth-internal.

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :internal, :model => ::MyUser
end

Options

** model ** The model to call authenticate on. (default: User)

** title ** The title text shown on default login form. (default: "Restricted Access")

** fields ** The request parameter names to fetch username and password. (default: [ "username", "password" ])

License

MIT License

Copyright (c) 2012, Jan Graichen