ZeroAuth Build Status Inline docs
Zero configuration authentication starter for your Rails project.
Add this line to your application's Gemfile:
gem 'zero_auth'
And then execute:
$ bundle
Or install it yourself as:
$ gem install zero_auth
- Docs: http://rdoc.info/github/bschaeffer/zero_auth/ZeroAuth/Model/Password
- Provides password salting and hashing using
BCrypt. - Instance method authentication.
- Requires
password_saltandpassword_hashattributes.
class User include ZeroAuth::Model::Password attr_accessor :password_salt, :password_hash end user = User.new user.password = 'password' user.password_salt # => BCrypt::Engine.generate_salt user.password_hash # => BCrypt::Password user.has_password?('password') # => true user.has_password?('pa$$w0rD') # => false user.authenticate!('password') # => true user.authenticate!('pa$$word') # => raises ZeroAuth::Unauthorized
# migration change_table :users do |t| t.string :password_salt, null: false, default: "" t.string :password_hash, null: false, default: "" end # model class User < ActiveRecord::Base include ZeroAuth::Model::Password end
class User < ActiveRecord::Base include MongoMapper::Document include ZeroAuth::Model::Password key :password_salt, String key :password_hash, String end
- Fork it (http://github.com/bschaeffer/zero_auth/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request