-
Notifications
You must be signed in to change notification settings - Fork 94
UrlGenerationError for new_session_path (Custom authentication via Rails 8) #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
But what type of Authorization did you set in your BaseController? I assume you set |
I'm running into the same/similar issue. Routes aren't picked up by the Mission Control engine. I'm also using Rails Authentication generator and configured a custom class AdminController < ApplicationController
before_action :authenticate_admin!
end # config/application.rb
config.mission_control.jobs.base_controller_class = "AdminController"
config.mission_control.jobs.http_basic_auth_enabled = false # ApplicationController method
def authenticate_admin!
binding.break
redirect_to root_path, alert: "You are not authorized to access this page" unless Current.user.admin?
end This is what I see in the breakpoint: ![]() This is what I would expect them to be (works on other controllers that use the same ![]() This means the before_action filter redirects to The solution mentioned in #183 didn't work for me even though it feels somewhat related. I'll revisit this at another time, but wonder what might be wrong with this setup. |
I was able to overcome this by replacing the |
Issue
When using custom authentication via Rails 8 new Authentication generator, opening
.../jobs
, which should require a logged-in user or redirect to login page, results in a UrlGenerationError:This would make any kind of custom authentication with redirects difficult and should not only effect the Rails 8 Auth generator.
To replicate
bin/rails generate authentication
(which includesAuthentication
for all controllers)bin/dev
Quick Fix
Adding
include Rails.application.routes.url_helpers
to theMissionControl::Jobs::QueuesController
solves the problem, but does not feel like a proper fix.Weirdly, adding the url_helpers to the
MissionControl::Jobs::ApplicationController
does not help.--
Any help or suggestions appreciated.
The text was updated successfully, but these errors were encountered: