Module: Facebooker::Rails::Controller

Includes:
ProfilePublisherExtensions
Defined in:
lib/facebooker/rails/cucumber.rb,
lib/facebooker/rails/controller.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ProfilePublisherExtensions

#render_publisher_error, #render_publisher_interface, #render_publisher_response, #wants_interface?

Class Method Details

.included(controller) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/facebooker/rails/controller.rb', line 7

def self.included(controller)
  controller.extend(ClassMethods)
  #controller.before_filter :set_adapter <-- security hole noted by vchu
  controller.before_filter :set_facebook_request_format
  controller.helper_attr :facebook_session_parameters
  controller.helper_method :request_comes_from_facebook?
end

Instance Method Details

#create_facebook_sessionObject



24
25
26
# File 'lib/facebooker/rails/controller.rb', line 24

def create_facebook_session
  secure_with_facebook_params! || secure_with_cookies! || secure_with_token!
end

#facebook_paramsObject



44
45
46
# File 'lib/facebooker/rails/controller.rb', line 44

def facebook_params
  @facebook_params ||= verified_facebook_params
end

#facebook_sessionObject



16
17
18
# File 'lib/facebooker/rails/controller.rb', line 16

def facebook_session
  @facebook_session
end

#facebook_session_parametersObject



20
21
22
# File 'lib/facebooker/rails/controller.rb', line 20

def facebook_session_parameters
  {:fb_sig_session_key=>params[:fb_sig_session_key]}
end

#redirect_to(*args) ⇒ Object

prevent Facebooker from rendering fb:redirect



18
19
20
# File 'lib/facebooker/rails/cucumber.rb', line 18

def redirect_to(*args)
  super
end

#set_facebook_sessionObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/facebooker/rails/controller.rb', line 28

def set_facebook_session
  # first, see if we already have a session
  session_set = session_already_secured?
  # if not, see if we can load it from the environment
  unless session_set
    session_set = create_facebook_session
    session[:facebook_session] = @facebook_session if session_set
  end
  if session_set
    capture_facebook_friends_if_available! 
    Session.current = facebook_session
  end
  return session_set
end