Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jgraichen/omniauth-internal
OmniAuth strategy for simple model authentication.
https://github.com/jgraichen/omniauth-internal
authentication omniauth omniauth-strategy password ruby
Last synced: 25 days ago
JSON representation
OmniAuth strategy for simple model authentication.
- Host: GitHub
- URL: https://github.com/jgraichen/omniauth-internal
- Owner: jgraichen
- License: mit
- Created: 2012-04-21T11:08:16.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-02-25T18:30:28.000Z (almost 3 years ago)
- Last Synced: 2024-03-14T22:51:04.930Z (9 months ago)
- Topics: authentication, omniauth, omniauth-strategy, password, ruby
- Language: Ruby
- Size: 4.88 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Omniauth::Internal
**omniauth-internal** is a [OmniAuth](https://github.com/intridea/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](https://github.com/jgraichen/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:
```ruby
def self.authenticate(login, password)
find_by_email(login).try(:authenticate, password)
end
```You can configure the model class used by **omniauth-internal**.
```ruby
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](http://www.opensource.org/licenses/mit-license.php)
Copyright (c) 2012, Jan Graichen