Created
April 13, 2011 14:08
-
-
Save scottwater/917607 to your computer and use it in GitHub Desktop.
Quick samples on securing Resque::Server
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
require 'resque/server' | |
class SecureResqueServer < Resque::Server | |
before do | |
redirect '/' unless some_condition_is_met! | |
end | |
end |
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
require 'resque/server' | |
class SecureResqueServer < Resque::Server | |
use Rack::Auth::Basic, "Restricted Area" do |username, password| | |
[username, password] == ['admin', 'admin'] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I banged my head on this for a while before finding this helpful gist. In Rails 6 I did the following:
config/routes.rb
config/initializers/resque_auth.rb
I don't put the user and password directly in the code, I load those as environment variables from a file I do not check into version control for security.
config/env_config.yml
config/application.rb