Sha256: 8c15f1153ae1d3c6e9df0663f3ec356ce2c440b8c7ccd37d93d153ff179263e2

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 Bytes

Contents

class ExvoAuth::Dejavu
  def initialize(app)
    @app    = app
  end
  
  def call(env)
    dejavu(env) if Rack::Request.new(env).path == "/auth/dejavu"
    @app.call(env)
  end
  
  private
  
  def dejavu(env)
    data = MultiJson.decode(Base64.decode64(Rack::Request.new(env).params["stored_request"]))

    env["QUERY_STRING"]   = Rack::Utils.build_nested_query(data["params"]) # Will not work with file uploads.
    env["SCRIPT_NAME"]    = data["script_name"]
    env["PATH_INFO"]      = data["path_info"]
    env["REQUEST_METHOD"] = data["method"]
    env["CONTENT_TYPE"]   = data["content_type"]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exvo-auth-0.9.3 lib/exvo_auth/dejavu.rb
exvo-auth-0.9.2 lib/exvo_auth/dejavu.rb
exvo-auth-0.9.0 lib/exvo_auth/dejavu.rb