Where does Devise validate authorization? How to use byebug?

I have been trying to find where Devise makes the decision to allow a user to be authorized.

I’m pretty sure (but not certain) this is where Devise ,creates authenticate_user!, user_signed_in?, current_user, and user_session .

~/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-4.3.0/lib/devise/controllers/helpers.rb def self.define_helpers(mapping) #:nodoc: mapping = mapping.name

    class_eval <<-METHODS, __FILE__, __LINE__ + 1
      def authenticate_#{mapping}!(opts={})
        opts[:scope] = :#{mapping}
        warden.authenticate!(opts) if !devise_controller? || opts.delete(:force)
      end

      def #{mapping}_signed_in?
        !!current_#{mapping}
      end

      def current_#{mapping}
        @current_#{mapping} ||= warden.authenticate(scope: :#{mapping})
      end

      def #{mapping}_session
        current_#{mapping} && warden.session(:#{mapping})
      end
    METHODS

    ActiveSupport.on_load(:action_controller) do
      if respond_to?(:helper_method)
        helper_method "current_#{mapping}", "#{mapping}_signed_in?", "#{mapping}_session"
      end
    end
  end

``

I use byebug to try to debug things.

Assuming def authenticate_#{mapping}!(opts={}) opts[:scope] = :#{mapping} warden.authenticate!(opts) if !devise_controller? || opts.delete(:force) end

``

starts on line 114, I have tried

b /home/my-project/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-4.3.0/lib/devise/controllers/helpers.rb:115

``

byebug then, quite reasonably, complains "*** Line 115 is not a valid breakpoint in file /home/ … /helpers.rb

“module ClassMethods” can be found at line 15 in /home/my-project/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-4.3.0/lib/devise/controllers/helpers.rb

So, I tried (byebug) b ClassMethods#authenticate_user! Successfully created breakpoint with id 3

``

But that does not seem to trip a breakpoint.

Interestingly, byebug seems to accept the following (byebug) b ClassMethods#current_user1 Successfully created breakpoint with id 6

``

even though ClassMethods#current_user1 doesn’t exist.

So, how to I set a breakpoint and spelunk where Devise does its user authorization?