Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cyberdelia/sequel-password
Sequel plugins to handle password hashing
https://github.com/cyberdelia/sequel-password
password sequel sequel-plugin
Last synced: 29 days ago
JSON representation
Sequel plugins to handle password hashing
- Host: GitHub
- URL: https://github.com/cyberdelia/sequel-password
- Owner: cyberdelia
- Created: 2015-04-04T05:38:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-14T22:23:08.000Z (almost 7 years ago)
- Last Synced: 2024-05-02T05:54:01.673Z (7 months ago)
- Topics: password, sequel, sequel-plugin
- Language: Ruby
- Homepage: https://rubygems.org/gems/sequel_password
- Size: 14.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sequel password
This sequel plugin adds authentication and password hashing to Sequel models.
It supports pbkdf2 and bcrypt hashers.## Installation
Install it directly using gem:
```
gem install sequel_password
```Or adding it to your ``Gemfile``:
```
gem "sequel_password"
```## Usage
### Configure
A straightforward example, using the password column for storage explicitely,
and using the default hashers:```ruby
class User < Sequel::Model
plugin :password, column: :password
end
```You can also specify a custom list of hashers to be used. The first hashers will
be considered as the default, choose carefully:```ruby
class User < Sequel::Model
plugin :password, hashers: {
pbkdf2_sha256: PBKDF2Hasher.new,
bcrypt_sha256: BCryptSHA256Hasher.new
}
end
```### Authenticate
To authenticate users with their given plain text password:
```ruby
user = User[email: email]
user && user.authenticate(password)
```