TIL: Secure ActiveAdmin with HTTP Basic Authentication
May 26, 2023
ActiveAdmin is an invaluable tool for doing MVP’s or quick Prototypes in Rails.
But most of the time I don’t want to include Devise or some other authentication solution. Which make HTTP Basic Authentication the simplest solution.
This is how to (insecurely) secure you ActiveAdmin install with HTTP Basic Authentication:
# config/initializers/active_admin.rb
Rails.configuration.to_prepare do
ActiveAdmin::BaseController.class_eval do
http_basic_authenticate_with name: 'some username', password: 'password'
end
end