Sha256: 1ba0846ff8a0ebf4d122308a5e067463a4d0bb5df6f0f3a1c667500450b579ed

Contents?: true

Size: 888 Bytes

Versions: 1

Compression:

Stored size: 888 Bytes

Contents

module Reflex
  module Authlogic
    class CallbackFilter
      def initialize(app)
        @app = app
      end

      def call(env)
        # if :react_callback_method is available in the session and the requested URL's query
        # contains ReactOAuthSession, change the REQUEST_METHOD to :react_callback_method
        if env["rack.session"][:react_callback_method].present? && env["QUERY_STRING"] =~ /ReactOAuthSession/   
          env["REQUEST_METHOD"] = env["rack.session"].delete(:react_callback_method).to_s.upcase
          
          if env["rack.session"][:react_callback_location].present?
            location = env["rack.session"].delete(:react_callback_location)
            
            env["REQUEST_URI"] = location
            env["PATH_INFO"]   = location.split('?').first
          end
        end
        
        @app.call(env)
      end      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reflex-0.0.3 lib/reflex/authlogic/callback_filter.rb