Created
November 18, 2013 21:31
-
-
Save obfusk/7535687 to your computer and use it in GitHub Desktop.
[OBSOLETE: NOW THAT PULL REQUEST IS MERGED, YOU CAN USE BCRYPT w/ COMFORTABLE-MEXICAN-SOFA] comfortable-mexican-sofa http auth w/ bcrypt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gemfile: | |
# gem 'bcrypt-ruby' | |
# | |
# config/initializers/comfortable_mexican_sofa.rb: | |
# config.admin_auth = 'ComfortableMexicanSofa::HttpAuthBCrypt' | |
# ComfortableMexicanSofa::HttpAuthBCrypt.username = 'myname' | |
# ComfortableMexicanSofa::HttpAuthBCrypt.password = BCrypt::Password.new '...hash...' | |
require 'bcrypt' | |
module ComfortableMexicanSofa::HttpAuthBCrypt | |
mattr_accessor :username, :password | |
def authenticate | |
authenticate_or_request_with_http_basic do |username, password| | |
self.username == username && self.password == password | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment