Ruby on Rails Monday, March 28, 2011

Hey,


this started as OmniAuth issue and is pretty well document here: https://github.com/intridea/omniauth/issues/#issue/239/comment/917065

If you have a bare Rails app with Devise gem (Warden itself would probably be enough), add the following middleware to simulate OmniAuth behavior:

class BreakApp
 def initialize(app)
   @app = app
 end

 def call(env)
   @app.call(env.dup) # call 1
   @app.call(env) # call 2
 end
end

and call Warden in ApplicationController before_filter e.g.:

request.env['warden'].authenticate(:scope => :user)

then params[:controller] and params[:action] are missing.

If you remove the before filter *or* change the first call in the middleware to @app.call(env) (without #dup) it works fine. I prepared a sample app to show this issue: https://github.com/szimek/omniauth_dynamic_providers_bug

I have no idea if this issue is caused by Rails or Warden code. Any ideas why path parameters are missing and how to fix it are welcome :)

Cheers,
Szymon 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment