How to redirect to another url when auth failed

I would like to redirect to another url when auth failed.
Any idea please thanks!

plugins
  myplugin
    lib
      auth
        my_auth_controller.rb
          def after_authenticate(auth_hash)

            if not auth
              redirect_to "https://example.com"
            end 

            result = Auth::Result.new
          end