HTTP Basic Auth Rails Admin
I'm trying to use basic http authentication on my admin panel. I'm using
Rails Admin.
I want to require http basic auth for the admin login.
In my application controller I'm trying the following:
before_action :basic_auth_admin, if: :admin_url?
private
def admin_url?
request.url.scan(/\/{1}admin.*/).size > 0
end
def basic_auth_admin
authenticate_or_request_with_http_basic do |username, password|
username == "user" && password == "pass"
end
end
In Chrome/Firefox I cannot access the admin login. Chrome continues to
prompt for credentials and Firefox just continues loading.
Please advise. If there's a better way to accomplish my goal please let me
know.
No comments:
Post a Comment