Class: AuthlogicConnect::CallbackFilter
- Inherits:
-
Object
- Object
- AuthlogicConnect::CallbackFilter
- Defined in:
- lib/authlogic_connect/callback_filter.rb
Instance Method Summary collapse
-
#call(env) ⇒ Object
this intercepts how the browser interprets the url.
-
#initialize(app) ⇒ CallbackFilter
constructor
A new instance of CallbackFilter.
Constructor Details
#initialize(app) ⇒ CallbackFilter
Returns a new instance of CallbackFilter.
2 3 4 |
# File 'lib/authlogic_connect/callback_filter.rb', line 2 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
this intercepts how the browser interprets the url. so we override it and say, “if we’ve stored a variable in the session called :auth_callback_method, then convert that into a POST call so we re-call the original method”
10 11 12 13 14 15 16 17 18 |
# File 'lib/authlogic_connect/callback_filter.rb', line 10 def call(env) if env["rack.session"].nil? raise "Make sure you are setting the session in Rack too! Place this in config/application.rb" end unless env["rack.session"][:auth_callback_method].blank? env["REQUEST_METHOD"] = env["rack.session"].delete(:auth_callback_method).to_s.upcase end @app.call(env) end |