Sha256: 2cff79579fbfef5fc7f95a3ac3e3a98e492f0f7870ec76d7f98f7eef9afd9d96

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

require 'oauth/controllers/consumer_controller'
class OauthConsumersController < ApplicationController
  include Oauth::Controllers::ConsumerController
  # Replace this with the equivalent for your authentication framework
  # Eg. for devise
  #
  #   before_filter :authenticate_user!, :only=>:index
  before_filter :login_required, :only=>:index
  
  def index
    @consumer_tokens=ConsumerToken.all :conditions=>{:user_id=>current_user.id}
    @services=OAUTH_CREDENTIALS.keys-@consumer_tokens.collect{|c| c.class.service_name}
  end
  
  protected
  
  # Change this to decide where you want to redirect user to after callback is finished.
  # params[:id] holds the service name so you could use this to redirect to various parts
  # of your application depending on what service you're connecting to.
  def go_back
    redirect_to root_url
  end
  
  # The plugin requires logged_in? to return true or false if the user is logged in. Uncomment and
  # call your auth frameworks equivalent below if different. eg. for devise:
  #
  # def logged_in?
  #   user_signed_in?
  # end
    
  # The plugin requires current_user to return the current logged in user. Uncomment and
  # call your auth frameworks equivalent below if different.
  # def current_user
  #   current_person
  # end

  # The plugin requires a way to log a user in. Call your auth frameworks equivalent below 
  # if different. eg. for devise:
  #
  # def current_user=(user)
  #   sign_in(user)
  # end
  
  # Override this to deny the user or redirect to a login screen depending on your framework and app
  # if different. eg. for devise:
  #
  # def deny_access!
  #   raise Acl9::AccessDenied
  # end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
le1t0-oauth-plugin-0.4.0.pre4.001 lib/generators/oauth_consumer/templates/controller.rb
oauth-plugin-0.4.0.pre4 lib/generators/oauth_consumer/templates/controller.rb
oauth-plugin-0.4.0.pre3 lib/generators/oauth_consumer/templates/controller.rb