Class: Rack::FacebookSession

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/facebook_session.rb

Constant Summary collapse

FACEBOOK_SESSION_KEY =
'fb_sig_session_key'

Instance Method Summary collapse

Constructor Details

#initialize(app, session_key = '_session_id') ⇒ FacebookSession

Returns a new instance of FacebookSession.



8
9
10
11
# File 'lib/rack/facebook_session.rb', line 8

def initialize(app, session_key = '_session_id')
  @app = app
  @session_key = session_key
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rack/facebook_session.rb', line 13

def call(env)
  req = Rack::Request.new(env)
  key = req.POST[FACEBOOK_SESSION_KEY] || req.GET[FACEBOOK_SESSION_KEY]
  env['HTTP_COOKIE'] = [ @session_key, key ].join('=').freeze unless key.nil?

  @app.call(env)
end