socialite 0.0.1.beta4 → 0.1.0.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. data/README.md +33 -34
  2. data/Rakefile +8 -21
  3. data/app/controllers/socialite/application_controller.rb +4 -0
  4. data/app/controllers/socialite/identities_controller.rb +2 -14
  5. data/app/controllers/socialite/session_controller.rb +20 -0
  6. data/app/controllers/socialite/users_controller.rb +0 -1
  7. data/app/views/layouts/socialite/application.html.haml +11 -0
  8. data/app/views/socialite/identities/new.html.haml +27 -0
  9. data/app/views/socialite/session/new.html.haml +31 -14
  10. data/app/views/socialite/user/edit.html.haml +1 -1
  11. data/config/routes.rb +7 -7
  12. data/lib/generators/socialite/install_generator.rb +7 -9
  13. data/lib/generators/socialite/migrations_generator.rb +34 -0
  14. data/lib/generators/socialite/templates/identity.rb.erb +25 -0
  15. data/lib/generators/socialite/templates/socialite.rb +20 -7
  16. data/lib/generators/socialite/templates/users.rb.erb +12 -0
  17. data/lib/socialite.rb +25 -27
  18. data/lib/socialite/controllers/helpers.rb +107 -111
  19. data/lib/socialite/engine.rb +19 -32
  20. data/lib/socialite/helpers/authentication.rb +1 -1
  21. data/lib/socialite/models/identity_concern.rb +91 -0
  22. data/lib/socialite/models/user_concern.rb +54 -0
  23. data/lib/socialite/version.rb +1 -1
  24. data/spec/dummy/README.rdoc +261 -0
  25. data/spec/dummy/app/assets/javascripts/application.js +9 -3
  26. data/spec/dummy/app/assets/stylesheets/application.css +11 -5
  27. data/{app/assets/images/socialite → spec/dummy/app/mailers}/.gitkeep +0 -0
  28. data/{app/assets/javascripts/socialite → spec/dummy/app/models}/.gitkeep +0 -0
  29. data/spec/dummy/app/models/identity.rb +4 -0
  30. data/spec/dummy/app/models/user.rb +4 -0
  31. data/spec/dummy/app/views/layouts/application.html.erb +1 -5
  32. data/spec/dummy/config/application.rb +19 -2
  33. data/spec/dummy/config/boot.rb +1 -11
  34. data/spec/dummy/config/database.yml +18 -2
  35. data/spec/dummy/config/environments/development.rb +8 -1
  36. data/spec/dummy/config/environments/production.rb +9 -2
  37. data/spec/dummy/config/environments/test.rb +4 -9
  38. data/spec/dummy/config/initializers/inflections.rb +5 -0
  39. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  40. data/spec/dummy/config/initializers/session_store.rb +1 -1
  41. data/spec/dummy/config/initializers/socialite.rb +26 -4
  42. data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
  43. data/spec/dummy/config/routes.rb +2 -10
  44. data/{db/migrate/20110914215410_create_users.rb → spec/dummy/db/migrate/20130206224516_create_socialite_users.rb} +2 -4
  45. data/spec/dummy/db/migrate/20130206224517_create_socialite_identities.rb +25 -0
  46. data/spec/dummy/db/schema.rb +12 -20
  47. data/{lib/tasks → spec/dummy/lib/assets}/.gitkeep +0 -0
  48. data/spec/dummy/log/.gitkeep +0 -0
  49. data/spec/dummy/public/500.html +0 -1
  50. data/spec/factories/facebook.rb +5 -5
  51. data/spec/factories/identity.rb +3 -3
  52. data/spec/factories/user.rb +10 -12
  53. data/spec/generators/socialite/install_generator_spec.rb +43 -0
  54. data/spec/generators/socialite/migrations_generator_spec.rb +27 -0
  55. data/spec/models/facebook_spec.rb +24 -21
  56. data/spec/models/identity_spec.rb +2 -2
  57. data/spec/models/user_spec.rb +7 -7
  58. data/spec/socialite_spec.rb +53 -0
  59. data/spec/spec_helper.rb +23 -10
  60. data/spec/support/identity_shared_example.rb +24 -20
  61. metadata +202 -144
  62. data/.autotest +0 -7
  63. data/.gitignore +0 -9
  64. data/.rspec +0 -2
  65. data/.travis.yml +0 -10
  66. data/.yardopts +0 -8
  67. data/Gemfile +0 -8
  68. data/Gemfile.lock +0 -208
  69. data/app/models/socialite/facebook_identity.rb +0 -5
  70. data/app/models/socialite/identity.rb +0 -5
  71. data/app/models/socialite/user.rb +0 -10
  72. data/config/initializers/simple_form.rb +0 -90
  73. data/config/locales/simple_form.en.yml +0 -23
  74. data/db/migrate/20110925224222_create_identities.rb +0 -26
  75. data/db/migrate/20110926005551_create_facebook_identities.rb +0 -12
  76. data/lib/socialite/api_wrappers/facebook.rb +0 -67
  77. data/lib/socialite/api_wrappers/twitter.rb +0 -19
  78. data/lib/socialite/models/identity.rb +0 -99
  79. data/lib/socialite/models/user.rb +0 -50
  80. data/lib/socialite/service_config.rb +0 -14
  81. data/lib/tasks/cucumber.rake +0 -65
  82. data/script/cucumber +0 -10
  83. data/script/rails +0 -6
  84. data/socialite.gemspec +0 -39
  85. data/spec/dummy/app/controllers/home_controller.rb +0 -11
  86. data/spec/dummy/app/views/home/index.html.haml +0 -12
  87. data/spec/dummy/app/views/home/show.html.haml +0 -6
data/README.md CHANGED
@@ -1,17 +1,29 @@
1
1
  # Socialite
2
2
 
3
- A Rails 3.1 engine that provides a User model with support for linking
4
- multiple authorization accounts per user (linking). Current support for
5
- Twitter, Facebook, Github and LinkedIn.
3
+ This is an opinionated Rails 3.1 mountable engine provides your application with
4
+ support for managing multiple OAuth providers per User.
6
5
 
7
- Additional authorizations can be added if they are supported by
8
- the [OmniAuth](http://github.com/intridea/omniauth) project.
6
+ ## Why make this?
9
7
 
10
- ## Development
8
+ Every site I have built in the past couple years has required implementing
9
+ authentication support for Users. Now this was simple enough when it was only
10
+ **one** provider (in my case, "Login with Facebook"), but more often then not
11
+ it evolved into "Login with `<insert_oauth_provider>`".
11
12
 
12
- We are currently working on an initial release of Socialite. Once we
13
- have a solid suite of tests in place, we will release an official 0.1.0
14
- version to the public.
13
+ Now OmniAuth has some [good write-ups](https://github.com/intridea/omniauth/wiki/Managing-Multiple-Providers)
14
+ on handling multiple providers, but it lacked any support for restricting a user
15
+ to one identity per provider. Socialite aims to solve this and while enforcing
16
+ every user to have a Basic Authentication identity as a fall-back in case of
17
+ password recovery.
18
+
19
+ ## What makes this unique?
20
+
21
+ 1. Every User can only have one identity per supported provider
22
+ * Example: User can have only 1 linked Facebook Identity at any given time
23
+ 2. Every User must have an basic-auth identity
24
+ * Example: User signs up through Facebook, but unlinks it.
25
+ Enforcing a local basic auth mechanism aids account recovery.
26
+ 3. Supports any provider strategy in the OmniAuth project.
15
27
 
16
28
  ## Resources
17
29
 
@@ -26,38 +38,25 @@ version to the public.
26
38
 
27
39
  To use Socialite in a Rails 3.1 application:
28
40
 
29
- * Require it in the Gemfile: `gem 'socialite'`
30
- * Install it by running `bundle`.
31
- * Import migrations into the parent project with `rake
32
- socialite:install:migrations`
33
- * Use the provided CSS by adding `//= require socialite` from your
34
- application's CSS manifest file
41
+ * Require it in the Gemfile:
42
+ `gem 'socialite', git: 'git://github.com/jsmestad/socialite`
43
+ * Install the gem it by running `bundle install`.
44
+ * Run the socialite generator using `rails g socialite:install` for typical
45
+ installs and `rails g active_record:socialite` for specifying custom options.
35
46
 
36
47
  ## History
37
48
 
38
49
  This project began as a fork of [Tim Riley](http://openmonkey.com)'s
39
50
  great Omnisocial plugin. The motivation for this fork is that I required
40
51
  multiple authorizations for each account (linking support) and wanted a
41
- proper Rails 3.1 Engine.
42
-
43
- ## Socialite Contributers
44
-
45
- * [Justin Smestad](http://github.com/jsmestad)
46
- * [Bobby Wilson](http://github.com/bobbyw)
47
-
48
- ### Omnisocial Contributers
49
-
50
- * [Klaus Hartl](http://github.com/carhartl)
51
- * [Stephen Aument](http://github.com/stephenaument)
52
- * [Lucas Allan](http://github.com/lucasallan)
53
- * [James Dumay](http://github.com/i386)
54
- * [Pablo Dejuan](http://github.com/pdjota)
55
- * [Chris Oliver](http://github.com/excid3)
52
+ proper mountable Rails 3.1 Engine.
56
53
 
57
54
  ## Copyright & License
58
55
 
59
- Socialite is Copyright (c) 2011 Justin Smestad. All Rights are Reserved. Code is
60
- distributed under the Apache 2.0 License. See LICENSE file for more information.
56
+ Socialite is Copyright (c) 2011- 2013 Justin Smestad. All Rights are Reserved.
57
+ Code is distributed under the Apache 2.0 License. See LICENSE file for more
58
+ information.
61
59
 
62
- The original OmniSocial code is Copyright (c) 2010-2011 [Tim Riley](http://openmonkey.com/)
63
- and [Icelab](http://icelab.com.au/), and is released under MIT License.
60
+ The original OmniSocial code is Copyright (c) 2010-2011
61
+ [Tim Riley](http://openmonkey.com/) and [Icelab](http://icelab.com.au/), and is
62
+ released under MIT License.
data/Rakefile CHANGED
@@ -5,30 +5,17 @@ rescue LoadError
5
5
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
6
  end
7
7
 
8
- begin
9
- require 'rdoc/task'
10
- rescue LoadError
11
- require 'rdoc/rdoc'
12
- require 'rake/rdoctask'
13
- RDoc::Task = Rake::RDocTask
14
- end
8
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
9
+ load 'rails/tasks/engine.rake'
10
+
11
+ Bundler::GemHelper.install_tasks
12
+
13
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
15
14
 
16
15
  require 'rspec/core'
17
16
  require 'rspec/core/rake_task'
18
17
 
19
- RSpec::Core::RakeTask.new(:spec)
18
+ desc "Run all specs in spec directory (excluding plugin specs)"
19
+ RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
20
20
 
21
21
  task :default => :spec
22
-
23
- Rake::RDocTask.new(:rdoc) do |rdoc|
24
- rdoc.rdoc_dir = 'rdoc'
25
- rdoc.title = 'Socialite'
26
- rdoc.options << '--line-numbers' << '--inline-source'
27
- rdoc.rdoc_files.include('README.rdoc')
28
- rdoc.rdoc_files.include('lib/**/*.rb')
29
- end
30
-
31
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
32
- load 'rails/tasks/engine.rake'
33
-
34
- Bundler::GemHelper.install_tasks
@@ -0,0 +1,4 @@
1
+ module Socialite
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -5,20 +5,8 @@ module Socialite
5
5
  before_filter :ensure_user, :only => [:destroy]
6
6
  respond_to :html, :json
7
7
 
8
- def create
9
- auth_hash = request.env['omniauth.auth']
10
- identity = Identity.find_or_initialize_by_oauth(auth_hash)
11
- identity.build_user if identity.user.blank?
12
-
13
- if identity.save
14
- self.current_user ||= identity.user
15
- flash_message :notice, 'You have logged in successfully.'
16
- else
17
- flash_message :error, 'An error occurred. Please try again.'
18
- end
19
- respond_with(identity) do |format|
20
- format.html { redirect_back_or_default }
21
- end
8
+ def new
9
+ @identity = env['omniauth.identity'] ||= User.new
22
10
  end
23
11
 
24
12
  def failure
@@ -7,6 +7,26 @@ module Socialite
7
7
 
8
8
  respond_to :html, :json
9
9
 
10
+ def new; end
10
11
 
12
+ def create
13
+ @identity = Identity.find_or_initialize_by_oauth(env['omniauth.auth'])
14
+ @identity.build_user if @identity.user.blank?
15
+
16
+ if @identity.save
17
+ self.current_user = @identity.user
18
+ flash_message :notice, 'You have logged in successfully.'
19
+ else
20
+ flash_message :error, 'An error occurred. Please try again.'
21
+ end
22
+ respond_with(identity) do |format|
23
+ format.html { redirect_back_or_default }
24
+ end
25
+ end
26
+
27
+ def destroy
28
+ logout!
29
+ redirect_to main_app.root_path, notice: 'Signed out!'
30
+ end
11
31
  end
12
32
  end
@@ -34,6 +34,5 @@ module Socialite
34
34
  def user
35
35
  @user = current_user
36
36
  end
37
-
38
37
  end
39
38
  end
@@ -0,0 +1,11 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title Socialite
5
+ = stylesheet_link_tag "socialite/application", :media => "all"
6
+ = javascript_include_tag "socialite/application"
7
+ = csrf_meta_tags
8
+ %body
9
+ = yield
10
+
11
+
@@ -0,0 +1,27 @@
1
+ %h1 New Account
2
+
3
+ = form_tag "/auth/identity/register" do
4
+ - if @identity && @identity.errors.any?
5
+ .error_messages
6
+ %h2 #{pluralize(@identity.errors.count, "error")} prohibited this account from being saved:
7
+ %ul
8
+ - @identity.errors.full_messages.each do |msg|
9
+ %li= msg
10
+ .field
11
+ = label_tag :name
12
+ %br
13
+ = text_field_tag :name, @identity.try(:name)
14
+ .field
15
+ = label_tag :email
16
+ %br
17
+ = text_field_tag :email, @identity.try(:email)
18
+ .field
19
+ = label_tag :password
20
+ %br
21
+ = password_field_tag :password
22
+ .field
23
+ = label_tag :password_confirmation
24
+ %br
25
+ = password_field_tag :password_confirmation
26
+ .actions
27
+ = submit_tag "Register"
@@ -1,14 +1,31 @@
1
- #socialite_login
2
- .information
3
- %h1 Sign in (or up)
4
- %p.large
5
- You can use either your Twitter or Facebook account to sign in or sign up.
6
- %p
7
- Select your preferred method and you'll be sent off to authorise us to use your account.
8
- %p
9
- It’ll only take a second and your information will be perfectly safe. We don't get access to your password and
10
- %em we won't post or tweet anything from your account
11
- without your explicit permission.
12
-
13
- = twitter_login_button
14
- = facebook_login_button
1
+ %h1 Sign In
2
+
3
+ %p
4
+ %strong Sign in through one of these services:
5
+
6
+ .auth_providers
7
+ %a.auth_provider{href: "/auth/twitter"}
8
+ #{image_tag "twitter_64.png", size: "64x64", alt: "Twitter"}
9
+ Twitter
10
+ %a.auth_provider{href: "/auth/facebook"}
11
+ #{image_tag "facebook_64.png", size: "64x64", alt: "Facebook"}
12
+ Facebook
13
+ %a.auth_provider{href: "/auth/google_apps"}
14
+ #{image_tag "google_apps_64.png", size: "64x64", alt: "Google"}
15
+ Google
16
+
17
+ %p
18
+ %strong Don't use these services?
19
+ #{link_to "Create an account", new_identity_path} or login below.
20
+
21
+ = form_tag "/auth/identity/callback" do
22
+ .field
23
+ = label_tag :auth_key, "Email"
24
+ %br
25
+ = text_field_tag :auth_key
26
+ .field
27
+ = label_tag :password
28
+ %br
29
+ = password_field_tag :password
30
+ .actions
31
+ = submit_tag "Login"
@@ -1 +1 @@
1
- = render 'users/form', :locals => {:user => @user }
1
+ = render 'users/form', :locals => {:user => @user}
@@ -1,10 +1,10 @@
1
1
  Socialite::Engine.routes.draw do
2
- match '/login' => 'session#new', :as => :login
3
- match '/auth/:service/callback' => 'identities#create', :as => :callback
4
- match '/auth/failure' => 'identities#failure'
5
- match '/logout' => 'session#destroy', :as => :logout
2
+ # match '/login' => 'session#new', :as => :login
3
+ # match '/auth/:service/callback' => 'identities#create', :as => :callback
4
+ # match '/auth/failure' => 'identities#failure'
5
+ # match '/logout' => 'session#destroy', :as => :logout
6
6
 
7
- resource :user, :except => [:new, :create] do
8
- resources :identities
9
- end
7
+ # resource :user, :except => [:new, :create] do
8
+ # resources :identities
9
+ # end
10
10
  end
@@ -1,21 +1,19 @@
1
1
  require 'rails/generators'
2
- require 'rails/generators/migration'
3
2
 
4
3
  module Socialite
5
4
  module Generators
6
- class InstallGenerator < Rails::Generators::Base
7
- include Rails::Generators::Migration
8
-
9
- desc 'Generates the socialite initializer'
10
-
11
- def self.source_root
12
- File.join(File.dirname(__FILE__), 'templates')
13
- end
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path("../templates", __FILE__)
14
7
 
8
+ desc 'Creates a socialite initializer'
15
9
  def copy_initializer
16
10
  template 'socialite.rb', 'config/initializers/socialite.rb'
17
11
  end
18
12
 
13
+ # def add_opro_routes
14
+ # socialite_routes = "mount_socialite_oauth"
15
+ # route socialite_routes
16
+ # end
19
17
  end
20
18
  end
21
19
  end
@@ -0,0 +1,34 @@
1
+ require 'rails/generators/migration'
2
+
3
+ module Socialite
4
+ module Generators
5
+ class MigrationsGenerator < ::Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ class_option :users_table,
10
+ :default => 'socialite_users',
11
+ :type => :string
12
+ class_option :identity_table,
13
+ :default => 'socialite_identities',
14
+ :type => :string
15
+
16
+ desc "add the migrations needed for socialite"
17
+
18
+ def self.next_migration_number(path)
19
+ unless @prev_migration_nr
20
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
21
+ else
22
+ @prev_migration_nr += 1
23
+ end
24
+ @prev_migration_nr.to_s
25
+ end
26
+
27
+ def copy_migrations
28
+ migration_template "users.rb.erb", "db/migrate/create_socialite_users.rb"
29
+ migration_template "identity.rb.erb", "db/migrate/create_socialite_identities.rb"
30
+ end
31
+ end
32
+ end
33
+ end
34
+
@@ -0,0 +1,25 @@
1
+ class CreateSocialiteIdentities < ActiveRecord::Migration
2
+ def up
3
+ create_table :<%= options[:identity_table] %> do |t|
4
+ t.string :uid, :provider
5
+ t.text :auth_hash
6
+ t.integer :<%= "#{options[:users_table].singularize}_id" %>
7
+ t.timestamps
8
+ end
9
+
10
+ add_index :<%= options[:identity_table] %>,
11
+ :<%= "#{options[:users_table].singularize}_id" %>
12
+
13
+ # Restrict each user to one identity per provider, to disable comment out.
14
+ add_index :<%= options[:identity_table] %>,
15
+ [:<%= "#{options[:users_table].singularize}_id" %>, :provider], :unique => true
16
+
17
+ # Database constraint to ensure uniqueness of UIDs (scoped to provider)
18
+ add_index :<%= options[:identity_table] %>,
19
+ [:provider, :uid], :unique => true
20
+ end
21
+
22
+ def down
23
+ drop_table :<%= options[:identity_table] %>
24
+ end
25
+ end
@@ -1,14 +1,27 @@
1
- require 'socialite'
2
-
3
1
  Socialite.setup do |config|
4
- # ==> Twitter
5
- # config.twitter 'APP_KEY', 'APP_SECRET'
2
+ ## Configure Classes
3
+ # If you are not using the default names set below. Please change them to
4
+ # reflect the correct classes.
5
+ #
6
+ # **NOTE** These _should_ be set to string values to prevent any possible
7
+ # errors caused by load order.
8
+ config.user_class = 'User'
9
+ config.identity_class = 'Identity'
6
10
 
7
- # ==> Facebook
8
- # config.facebook 'APP_KEY', 'APP_SECRET', :scope => 'publish_stream'
11
+ ## Add any supported OmniAuth providers
12
+ # You can pass any providers that are supported by OmniAuth simply by
13
+ # including it in your Gemfile.
14
+ #
15
+ # Examples:
16
+ # config.provider :facebook, ENV['FACEBOOK_APP_KEY'], ENV['FACEBOOK_SECRET'],
17
+ # :scope => 'email,friends'
18
+ # config.provider :identity, :on_failed_registration => lambda { |env|
19
+ # UsersController.action(:new).call(env)
20
+ # }
21
+ # config.provider :twitter, ENV['TWITTER_APP_KEY'], ENV['TWITTER_SECRET']
9
22
 
10
23
  if Rails.env.production?
11
- # Configs for production mode go here
24
+ # Any production specific information
12
25
  elsif Rails.env.development?
13
26
  # Configs for development mode go here
14
27
  end
@@ -0,0 +1,12 @@
1
+ class CreateSocialiteUsers < ActiveRecord::Migration
2
+ def up
3
+ create_table :<%= options[:users_table] %> do |t|
4
+ t.string :name
5
+ t.timestamps
6
+ end
7
+ end
8
+
9
+ def down
10
+ drop_table :<%= options[:users_table] %>
11
+ end
12
+ end
@@ -1,15 +1,10 @@
1
+ require 'socialite/engine'
2
+
1
3
  require 'haml'
2
- require 'omniauth/core'
3
- require 'omniauth/oauth'
4
+ require 'omniauth'
4
5
 
5
6
  module Socialite
6
7
  autoload :ControllerSupport, 'socialite/controller_support'
7
- autoload :ServiceConfig, 'socialite/service_config'
8
-
9
- module ApiWrappers
10
- autoload :Facebook, 'socialite/api_wrappers/facebook'
11
- autoload :Twitter, 'socialite/api_wrappers/twitter'
12
- end
13
8
 
14
9
  module Controllers
15
10
  autoload :Helpers, 'socialite/controllers/helpers'
@@ -20,35 +15,38 @@ module Socialite
20
15
  end
21
16
 
22
17
  module Models
23
- autoload :Identity, 'socialite/models/identity'
24
- autoload :User, 'socialite/models/user'
25
- autoload :FacebookIdentity, 'socialite/models/facebook_identity.rb'
18
+ autoload :IdentityConcern, 'socialite/models/identity_concern'
19
+ autoload :UserConcern, 'socialite/models/user_concern'
20
+ end
21
+
22
+ def self.setup
23
+ yield self if block_given?
26
24
  end
27
25
 
28
- mattr_accessor :service_configs, :root_path, :mount_prefix, :mounted_engine
29
- @@service_configs = {}
26
+ mattr_accessor :user_class, :identity_class, :providers
30
27
 
31
- def self.generate_token
32
- SecureRandom.base64(15).tr('+/=lIO0', 'pqrsxyz')
28
+ def self.providers
29
+ @@providers ||= []
33
30
  end
34
31
 
35
- def self.setup(entity = nil, &block)
36
- block.call self if block_given?
32
+ def self.provider(klass, *args)
33
+ @@providers ||= []
34
+ @@providers << [klass, args]
37
35
  end
38
36
 
39
- def self.mounted_engine?
40
- !!mounted_engine
37
+ def self.identity_class
38
+ identity_class_name.constantize
41
39
  end
42
40
 
43
- # config.twitter APP_KEY, APP_SECRET, :scope => ['foo', 'bar']
44
- def self.twitter(app_key, app_secret, options = {})
45
- @@service_configs[:twitter] = ServiceConfig.new(app_key, app_secret, options)
41
+ def self.identity_class_name
42
+ @@identity_class.camelize
46
43
  end
47
44
 
48
- # config.facebook APP_KEY, APP_SECRET, :scope => ['foo', 'bar']
49
- def self.facebook(app_key, app_secret, options = {})
50
- @@service_configs[:facebook] = ServiceConfig.new(app_key, app_secret, options)
45
+ def self.user_class
46
+ user_class_name.constantize
51
47
  end
52
- end
53
48
 
54
- require 'socialite/engine'
49
+ def self.user_class_name
50
+ @@user_class.camelize
51
+ end
52
+ end