Search code examples
ruby-on-railsactiveadminsidekiq

Securing Sidekiq and other admin content with Active Admin


How would it be possible to secure the Sidekiq admin page (and other content etc) behind my existing Active Admin authorization system (i.e. AdminUser)?


Solution

  • I don't use Active Admin but you probably have a model admin in your app in order to authenticate admins.

    I do have a similar admin model (Devise) and the below code in routes.rb does the trick for me :

    require 'sidekiq/web' 
    authenticate :admin do 
    mount Sidekiq::Web => '/sidekiq' 
    end
    

    If you have more to protect, especially admin related controllers, I suggest creating a namespace and authorizing your admins for every controller in the namespace. (It is probably possible to force authenticate admins for the whole namespace also, just like above)