Skip to content

Instantly share code, notes, and snippets.

@williamn
Created February 10, 2017 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williamn/09840cf9982a565376dbdc723b7d4223 to your computer and use it in GitHub Desktop.
Save williamn/09840cf9982a565376dbdc723b7d4223 to your computer and use it in GitHub Desktop.
HTTP Basic authentication
class ApplicationController < ActionController::Base
if ENV["DISALLOW_ALL_WEB_CRAWLERS"].present?
http_basic_authenticate_with(
name: ENV.fetch("BASIC_AUTH_USERNAME"),
password: ENV.fetch("BASIC_AUTH_PASSWORD"),
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment