Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
initial working code commit, connects to facebook
  • Loading branch information
bhbryant committed May 18, 2010
1 parent bb5cf91 commit 303df96
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 2 deletions.
Empty file modified .document 100644 → 100755
Empty file.
Empty file modified .gitignore 100644 → 100755
Empty file.
Empty file modified LICENSE 100644 → 100755
Empty file.
Empty file modified README.rdoc 100644 → 100755
Empty file.
11 changes: 9 additions & 2 deletions Rakefile 100644 → 100755
@@ -1,16 +1,23 @@
require 'rubygems'
require 'rake'
require File.join(File.dirname(__FILE__), 'lib', 'devise_oauth2_authenticatable', 'version')

begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "devise_oauth2_authenticatable"
gem.summary = %Q{TODO: one-line summary of your gem}
gem.description = %Q{TODO: longer description of your gem}
gem.version = ::Devise::Oauth2Authenticatable::VERSION
gem.summary = %{Devise << OAuth2}
gem.description = %{Implements OAuth2 for devises, specifically integrating with facebook Graph}
gem.email = "benjamin@bryantmarkowsky.com"
gem.homepage = "http://github.com/bhbryant/devise_oauth2_authenticatable"
gem.authors = ["bhbryant"]
gem.add_development_dependency "rspec", ">= 1.2.9"

gem.add_dependency'devise', '>= 1.0.0'
gem.add_dependency "oauth2"
gem.add_dependency "json"

# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
Expand Down
59 changes: 59 additions & 0 deletions lib/devise_oauth2_authenticatable.rb 100644 → 100755
@@ -0,0 +1,59 @@
# encoding: utf-8
require 'devise'
require 'oauth2'


require 'devise_oauth2_authenticatable/model'
require 'devise_oauth2_authenticatable/strategy'
require 'devise_oauth2_authenticatable/schema'
require 'devise_oauth2_authenticatable/routes'
#require 'devise_oauth2_authenticatable/controller_filters'
require 'devise_oauth2_authenticatable/view_helpers'


module Devise
# Specifies the name of the database column name used for storing
# the oauth UID. Useful if this info should be saved in a
# generic column if different authentication solutions are used.
mattr_accessor :oauth2_uid_field
@@oauth2_uid_field = :oauth2_uid

# Specifies the name of the database column name used for storing
# the user Facebook session key. Useful if this info should be saved in a
# generic column if different authentication solutions are used.
mattr_accessor :oauth2_token_field
@@oauth2_token_field = :oauth2_token

# Specifies if account should be created if no account exists for
# a specified Facebook UID or not.
mattr_accessor :oauth2_auto_create_account
@@oauth2_auto_create_account = true

def self.oauth2_client
@@oauth2_client ||= OAuth2::Client.new(OAUTH2_CONFIG['client_id'], OAUTH2_CONFIG['client_secret'], :site => OAUTH2_CONFIG['authorization_server'])
end


def self.session_sign_in_url(request, mapping)
url = URI.parse(request.url)
url.path = "#{mapping.parsed_path}/#{mapping.path_names[:sign_in]}"
url.query = nil
url.to_s
end

def self.requested_scope
@@requested_scope ||= OAUTH2_CONFIG['requested_scope']
end

end

# Load core I18n locales: en
#
I18n.load_path.unshift File.join(File.dirname(__FILE__), *%w[devise_oauth2_authenticatable locales en.yml])

# Add +:facebook_connectable+ strategies to defaults.
#
Devise.add_module(:oauth2_authenticatable,
:strategy => true,
:controller => :sessions,
:model => 'devise_oauth2_authenticatable/model')
Empty file modified spec/devise_oauth2_authenticatable_spec.rb 100644 → 100755
Empty file.
Empty file modified spec/spec.opts 100644 → 100755
Empty file.
Empty file modified spec/spec_helper.rb 100644 → 100755
Empty file.

0 comments on commit 303df96

Please sign in to comment.