omniauth 0.2.4 → 0.2.5
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.
Potentially problematic release.
This version of omniauth might be problematic. Click here for more details.
- data/.autotest +9 -0
- data/.document +5 -0
- data/.gitignore +36 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/.yardopts +4 -0
- data/Gemfile +6 -1
- data/README.markdown +121 -0
- data/Rakefile +50 -2
- data/lib/omniauth/version.rb +18 -4
- data/oa-basic/.gemtest +0 -0
- data/oa-basic/.rspec +3 -0
- data/oa-basic/.yardopts +4 -0
- data/oa-basic/LICENSE +19 -0
- data/oa-basic/README.rdoc +34 -0
- data/oa-basic/Rakefile +6 -0
- data/oa-basic/lib/oa-basic.rb +1 -0
- data/oa-basic/lib/omniauth/basic.rb +8 -0
- data/oa-basic/lib/omniauth/strategies/http_basic.rb +56 -0
- data/oa-basic/lib/omniauth/version.rb +19 -0
- data/oa-basic/oa-basic.gemspec +28 -0
- data/oa-basic/spec/omniauth/strategies/basic_spec.rb +7 -0
- data/oa-basic/spec/spec_helper.rb +11 -0
- data/oa-core/.gemtest +0 -0
- data/oa-core/.rspec +3 -0
- data/oa-core/.yardopts +4 -0
- data/oa-core/LICENSE +19 -0
- data/oa-core/Rakefile +6 -0
- data/oa-core/autotest/discover.rb +1 -0
- data/oa-core/lib/oa-core.rb +1 -0
- data/oa-core/lib/omniauth/builder.rb +33 -0
- data/oa-core/lib/omniauth/core.rb +135 -0
- data/oa-core/lib/omniauth/form.rb +184 -0
- data/oa-core/lib/omniauth/strategy.rb +227 -0
- data/oa-core/lib/omniauth/test.rb +12 -0
- data/oa-core/lib/omniauth/test/phony_session.rb +8 -0
- data/oa-core/lib/omniauth/test/strategy_macros.rb +34 -0
- data/oa-core/lib/omniauth/test/strategy_test_case.rb +49 -0
- data/oa-core/lib/omniauth/version.rb +19 -0
- data/oa-core/oa-core.gemspec +24 -0
- data/oa-core/spec/omniauth/builder_spec.rb +20 -0
- data/oa-core/spec/omniauth/core_spec.rb +79 -0
- data/oa-core/spec/omniauth/strategy_spec.rb +358 -0
- data/oa-core/spec/spec_helper.rb +12 -0
- data/oa-enterprise/.gemtest +0 -0
- data/oa-enterprise/.rspec +3 -0
- data/oa-enterprise/.yardopts +4 -0
- data/oa-enterprise/LICENSE +19 -0
- data/oa-enterprise/README.rdoc +82 -0
- data/oa-enterprise/Rakefile +6 -0
- data/oa-enterprise/lib/oa-enterprise.rb +1 -0
- data/oa-enterprise/lib/omniauth/enterprise.rb +8 -0
- data/oa-enterprise/lib/omniauth/strategies/cas.rb +47 -0
- data/oa-enterprise/lib/omniauth/strategies/cas/configuration.rb +98 -0
- data/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +84 -0
- data/oa-enterprise/lib/omniauth/strategies/ldap.rb +111 -0
- data/oa-enterprise/lib/omniauth/strategies/ldap/adaptor.rb +279 -0
- data/oa-enterprise/lib/omniauth/version.rb +19 -0
- data/oa-enterprise/oa-enterprise.gemspec +32 -0
- data/oa-enterprise/spec/fixtures/cas_failure.xml +4 -0
- data/oa-enterprise/spec/fixtures/cas_success.xml +8 -0
- data/oa-enterprise/spec/omniauth/strategies/cas_spec.rb +94 -0
- data/oa-enterprise/spec/spec_helper.rb +14 -0
- data/oa-more/.gemtest +0 -0
- data/oa-more/.rspec +3 -0
- data/oa-more/.yardopts +4 -0
- data/oa-more/LICENSE +19 -0
- data/oa-more/README.rdoc +22 -0
- data/oa-more/Rakefile +6 -0
- data/oa-more/lib/oa-more.rb +1 -0
- data/oa-more/lib/omniauth/more.rb +9 -0
- data/oa-more/lib/omniauth/strategies/flickr.rb +86 -0
- data/oa-more/lib/omniauth/strategies/windows_live.rb +39 -0
- data/oa-more/lib/omniauth/strategies/windows_live/windowslivelogin.rb +1143 -0
- data/oa-more/lib/omniauth/strategies/yupoo.rb +67 -0
- data/oa-more/lib/omniauth/version.rb +19 -0
- data/oa-more/oa-more.gemspec +30 -0
- data/oa-more/spec/omniauth/strategies/flickr_spec.rb +7 -0
- data/oa-more/spec/spec_helper.rb +11 -0
- data/oa-oauth/.gemtest +0 -0
- data/oa-oauth/.rspec +3 -0
- data/oa-oauth/.yardopts +4 -0
- data/oa-oauth/LICENSE +19 -0
- data/oa-oauth/README.rdoc +35 -0
- data/oa-oauth/Rakefile +6 -0
- data/oa-oauth/autotest/discover.rb +1 -0
- data/oa-oauth/lib/oa-oauth.rb +1 -0
- data/oa-oauth/lib/omniauth/oauth.rb +53 -0
- data/oa-oauth/lib/omniauth/strategies/bitly.rb +46 -0
- data/oa-oauth/lib/omniauth/strategies/dailymile.rb +64 -0
- data/oa-oauth/lib/omniauth/strategies/doit.rb +60 -0
- data/oa-oauth/lib/omniauth/strategies/dopplr.rb +53 -0
- data/oa-oauth/lib/omniauth/strategies/douban.rb +60 -0
- data/oa-oauth/lib/omniauth/strategies/evernote.rb +54 -0
- data/oa-oauth/lib/omniauth/strategies/facebook.rb +70 -0
- data/oa-oauth/lib/omniauth/strategies/foursquare.rb +62 -0
- data/oa-oauth/lib/omniauth/strategies/github.rb +50 -0
- data/oa-oauth/lib/omniauth/strategies/goodreads.rb +44 -0
- data/oa-oauth/lib/omniauth/strategies/google.rb +80 -0
- data/oa-oauth/lib/omniauth/strategies/gowalla.rb +64 -0
- data/oa-oauth/lib/omniauth/strategies/hyves.rb +67 -0
- data/oa-oauth/lib/omniauth/strategies/identica.rb +49 -0
- data/oa-oauth/lib/omniauth/strategies/instagram.rb +56 -0
- data/oa-oauth/lib/omniauth/strategies/instapaper.rb +40 -0
- data/oa-oauth/lib/omniauth/strategies/linked_in.rb +55 -0
- data/oa-oauth/lib/omniauth/strategies/meetup.rb +56 -0
- data/oa-oauth/lib/omniauth/strategies/miso.rb +41 -0
- data/oa-oauth/lib/omniauth/strategies/mixi.rb +59 -0
- data/oa-oauth/lib/omniauth/strategies/netflix.rb +65 -0
- data/oa-oauth/lib/omniauth/strategies/oauth.rb +85 -0
- data/oa-oauth/lib/omniauth/strategies/oauth2.rb +98 -0
- data/oa-oauth/lib/omniauth/strategies/qzone.rb +69 -0
- data/oa-oauth/lib/omniauth/strategies/rdio.rb +45 -0
- data/oa-oauth/lib/omniauth/strategies/renren.rb +87 -0
- data/oa-oauth/lib/omniauth/strategies/salesforce.rb +44 -0
- data/oa-oauth/lib/omniauth/strategies/smug_mug.rb +42 -0
- data/oa-oauth/lib/omniauth/strategies/sound_cloud.rb +46 -0
- data/oa-oauth/lib/omniauth/strategies/t163.rb +57 -0
- data/oa-oauth/lib/omniauth/strategies/teambox.rb +49 -0
- data/oa-oauth/lib/omniauth/strategies/thirty_seven_signals.rb +41 -0
- data/oa-oauth/lib/omniauth/strategies/tqq.rb +64 -0
- data/oa-oauth/lib/omniauth/strategies/trade_me.rb +45 -0
- data/oa-oauth/lib/omniauth/strategies/trip_it.rb +22 -0
- data/oa-oauth/lib/omniauth/strategies/tsina.rb +79 -0
- data/oa-oauth/lib/omniauth/strategies/tsohu.rb +57 -0
- data/oa-oauth/lib/omniauth/strategies/tumblr.rb +60 -0
- data/oa-oauth/lib/omniauth/strategies/twitter.rb +57 -0
- data/oa-oauth/lib/omniauth/strategies/type_pad.rb +76 -0
- data/oa-oauth/lib/omniauth/strategies/vimeo.rb +54 -0
- data/oa-oauth/lib/omniauth/strategies/vkontakte.rb +84 -0
- data/oa-oauth/lib/omniauth/strategies/xauth.rb +67 -0
- data/oa-oauth/lib/omniauth/strategies/yahoo.rb +55 -0
- data/oa-oauth/lib/omniauth/strategies/yammer.rb +43 -0
- data/oa-oauth/lib/omniauth/strategies/you_tube.rb +73 -0
- data/oa-oauth/lib/omniauth/version.rb +19 -0
- data/oa-oauth/oa-oauth.gemspec +33 -0
- data/oa-oauth/spec/fixtures/basecamp_200.xml +24 -0
- data/oa-oauth/spec/fixtures/campfire_200.json +10 -0
- data/oa-oauth/spec/omniauth/strategies/bitly_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/dailymile_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/doit_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/dopplr_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/douban_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/evernote_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/facebook_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/foursquare_spec.rb +18 -0
- data/oa-oauth/spec/omniauth/strategies/github_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/goodreads_spec.rb +6 -0
- data/oa-oauth/spec/omniauth/strategies/google_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/gowalla_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/hyves_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/identica_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/linked_in_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/meetup_spec.rb +14 -0
- data/oa-oauth/spec/omniauth/strategies/miso_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/netflix_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/oauth2_spec.rb +0 -0
- data/oa-oauth/spec/omniauth/strategies/oauth_spec.rb +77 -0
- data/oa-oauth/spec/omniauth/strategies/rdio_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/salesforce_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/smug_mug_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/sound_cloud_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/t163_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/teambox_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/thirty_seven_signals_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/trade_me_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/trip_it_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/tsina_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/tumblr_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/twitter_spec.rb +20 -0
- data/oa-oauth/spec/omniauth/strategies/type_pad_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/vimeo_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/vkontakte_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/yahoo_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/yammer_spec.rb +5 -0
- data/oa-oauth/spec/omniauth/strategies/you_tube_spec.rb +5 -0
- data/oa-oauth/spec/spec_helper.rb +27 -0
- data/oa-oauth/spec/support/shared_examples.rb +29 -0
- data/oa-openid/.gemtest +0 -0
- data/oa-openid/.rspec +3 -0
- data/oa-openid/.yardopts +4 -0
- data/oa-openid/LICENSE +19 -0
- data/oa-openid/README.rdoc +51 -0
- data/oa-openid/Rakefile +6 -0
- data/oa-openid/lib/oa-openid.rb +1 -0
- data/oa-openid/lib/omniauth/openid.rb +59 -0
- data/oa-openid/lib/omniauth/openid/gapps.rb +32 -0
- data/oa-openid/lib/omniauth/strategies/google_apps.rb +23 -0
- data/oa-openid/lib/omniauth/strategies/open_id.rb +132 -0
- data/oa-openid/lib/omniauth/version.rb +19 -0
- data/oa-openid/oa-openid.gemspec +29 -0
- data/oa-openid/spec/omniauth/strategies/open_id_spec.rb +71 -0
- data/oa-openid/spec/spec_helper.rb +14 -0
- data/omniauth.gemspec +3 -3
- data/tasks/all.rb +134 -0
- metadata +199 -9
- data/README.rdoc +0 -17
| @@ -0,0 +1,67 @@ | |
| 1 | 
            +
            require 'omniauth/core'
         | 
| 2 | 
            +
            require 'digest/md5'
         | 
| 3 | 
            +
            require 'rest-client'
         | 
| 4 | 
            +
            require 'multi_json'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module OmniAuth
         | 
| 7 | 
            +
              module Strategies
         | 
| 8 | 
            +
                class Yupoo
         | 
| 9 | 
            +
                  include OmniAuth::Strategy
         | 
| 10 | 
            +
                  attr_accessor :api_key, :secret_key, :options
         | 
| 11 | 
            +
                  
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  class CallbackError < StandardError
         | 
| 14 | 
            +
                    attr_accessor :error, :error_reason
         | 
| 15 | 
            +
                    def initialize(error, error_reason)
         | 
| 16 | 
            +
                      self.error = error
         | 
| 17 | 
            +
                      self.error_reason = error_reason
         | 
| 18 | 
            +
                    end
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  def initialize(app, api_key, secret_key, options = {})
         | 
| 22 | 
            +
                    super(app, :yupoo)
         | 
| 23 | 
            +
                    @api_key = api_key
         | 
| 24 | 
            +
                    @secret_key = secret_key
         | 
| 25 | 
            +
                    @options = {:scope => 'read'}.merge(options)
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  protected
         | 
| 29 | 
            +
                  
         | 
| 30 | 
            +
                  def request_phase
         | 
| 31 | 
            +
                    params = { :api_key => api_key, :perms => options[:scope] }
         | 
| 32 | 
            +
                    params[:api_sig] = yupoo_sign(params)
         | 
| 33 | 
            +
                    query_string = params.collect{ |key,value| "#{key}=#{Rack::Utils.escape(value)}" }.join('&')
         | 
| 34 | 
            +
                    redirect "http://www.yupoo.com/services/auth/?#{query_string}"
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
                  
         | 
| 37 | 
            +
                  def callback_phase
         | 
| 38 | 
            +
                    params = { :api_key => api_key, :method => 'yupoo.auth.getToken', :frob => request.params['frob'], :format => 'json', :nojsoncallback => '1' }
         | 
| 39 | 
            +
                    params[:api_sig] = yupoo_sign(params)
         | 
| 40 | 
            +
                    
         | 
| 41 | 
            +
                    response = RestClient.get('http://www.yupoo.com/api/rest/', { :params => params })
         | 
| 42 | 
            +
                    auth = MultiJson.decode(response.to_s)
         | 
| 43 | 
            +
                    raise CallbackError.new(auth['code'],auth['message']) if auth['stat'] == 'fail'
         | 
| 44 | 
            +
                    
         | 
| 45 | 
            +
                    @user = auth['auth']['user']
         | 
| 46 | 
            +
                    @access_token = auth['auth']['token']['_content']
         | 
| 47 | 
            +
                    
         | 
| 48 | 
            +
                    super
         | 
| 49 | 
            +
                  rescue CallbackError => e
         | 
| 50 | 
            +
                    fail!(:invalid_response, e)
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
                  
         | 
| 53 | 
            +
                  def auth_hash
         | 
| 54 | 
            +
                    OmniAuth::Utils.deep_merge(super, {
         | 
| 55 | 
            +
                      'uid' => @user['nsid'],
         | 
| 56 | 
            +
                      'credentials' => { 'token' => @access_token },
         | 
| 57 | 
            +
                      'user_info' => @user,
         | 
| 58 | 
            +
                      'extra' => { 'user_hash' => @user }
         | 
| 59 | 
            +
                    })
         | 
| 60 | 
            +
                  end
         | 
| 61 | 
            +
                  
         | 
| 62 | 
            +
                  def yupoo_sign(params)
         | 
| 63 | 
            +
                    Digest::MD5.hexdigest(secret_key + params.sort{|a,b| a[0].to_s <=> b[0].to_s }.flatten.join)
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
              end
         | 
| 67 | 
            +
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            module OmniAuth
         | 
| 2 | 
            +
              module Version
         | 
| 3 | 
            +
                unless defined?(::OmniAuth::Version::MAJOR)
         | 
| 4 | 
            +
                  MAJOR = 0
         | 
| 5 | 
            +
                end
         | 
| 6 | 
            +
                unless defined?(::OmniAuth::Version::MINOR)
         | 
| 7 | 
            +
                  MINOR = 2
         | 
| 8 | 
            +
                end
         | 
| 9 | 
            +
                unless defined?(::OmniAuth::Version::PATCH)
         | 
| 10 | 
            +
                  PATCH = 5
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
                unless defined?(::OmniAuth::Version::PRE)
         | 
| 13 | 
            +
                  PRE   = nil
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
                unless defined?(::OmniAuth::Version::STRING)
         | 
| 16 | 
            +
                  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 2 | 
            +
            require File.expand_path('../lib/omniauth/version', __FILE__)
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            Gem::Specification.new do |gem|
         | 
| 5 | 
            +
              gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
         | 
| 6 | 
            +
              gem.add_runtime_dependency 'multi_json',   '~> 1.0.0'
         | 
| 7 | 
            +
              gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
         | 
| 8 | 
            +
              gem.add_runtime_dependency 'rest-client',  '~> 1.6.0'
         | 
| 9 | 
            +
              gem.add_development_dependency 'json_pure', '~> 1.5'
         | 
| 10 | 
            +
              gem.add_development_dependency 'maruku', '~> 0.6'
         | 
| 11 | 
            +
              gem.add_development_dependency 'rake', '~> 0.8'
         | 
| 12 | 
            +
              gem.add_development_dependency 'rack-test', '~> 0.5'
         | 
| 13 | 
            +
              gem.add_development_dependency 'rspec', '~> 2.5'
         | 
| 14 | 
            +
              gem.add_development_dependency 'simplecov', '~> 0.4'
         | 
| 15 | 
            +
              gem.add_development_dependency 'webmock', '~> 1.6'
         | 
| 16 | 
            +
              gem.add_development_dependency 'yard', '~> 0.6'
         | 
| 17 | 
            +
              gem.add_development_dependency 'ZenTest', '~> 4.5'
         | 
| 18 | 
            +
              gem.name = 'oa-more'
         | 
| 19 | 
            +
              gem.version = OmniAuth::Version::STRING
         | 
| 20 | 
            +
              gem.description = %q{Additional strategies for OmniAuth.}
         | 
| 21 | 
            +
              gem.summary = gem.description
         | 
| 22 | 
            +
              gem.email = 'michael@intridea.com'
         | 
| 23 | 
            +
              gem.homepage = 'http://github.com/intridea/omniauth'
         | 
| 24 | 
            +
              gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
         | 
| 25 | 
            +
              gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
         | 
| 26 | 
            +
              gem.files = `git ls-files`.split("\n")
         | 
| 27 | 
            +
              gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
         | 
| 28 | 
            +
              gem.require_paths = ['lib']
         | 
| 29 | 
            +
              gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
         | 
| 30 | 
            +
            end
         | 
    
        data/oa-oauth/.gemtest
    ADDED
    
    | 
            File without changes
         | 
    
        data/oa-oauth/.rspec
    ADDED
    
    
    
        data/oa-oauth/.yardopts
    ADDED
    
    
    
        data/oa-oauth/LICENSE
    ADDED
    
    | @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 4 | 
            +
            of this software and associated documentation files (the "Software"), to deal
         | 
| 5 | 
            +
            in the Software without restriction, including without limitation the rights
         | 
| 6 | 
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 7 | 
            +
            copies of the Software, and to permit persons to whom the Software is
         | 
| 8 | 
            +
            furnished to do so, subject to the following conditions:
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            The above copyright notice and this permission notice shall be included in
         | 
| 11 | 
            +
            all copies or substantial portions of the Software.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 14 | 
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 15 | 
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 16 | 
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 17 | 
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 18 | 
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 | 
            +
            THE SOFTWARE.
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            = OmniAuth::OAuth
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            OAuth 1.0 and 2.0 strategies for the OmniAuth gem.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            == Installation
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            To get just OAuth functionality:
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                gem install oa-oauth
         | 
| 10 | 
            +
                
         | 
| 11 | 
            +
            For the full auth suite:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                gem install omniauth
         | 
| 14 | 
            +
                
         | 
| 15 | 
            +
            == Stand-Alone Example
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            Use the strategy as a middleware in your application:
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                require 'omniauth/oauth'
         | 
| 20 | 
            +
                
         | 
| 21 | 
            +
                use OmniAuth::Strategies::Twitter, 'consumer_key', 'consumer_secret'
         | 
| 22 | 
            +
                
         | 
| 23 | 
            +
            Then simply direct users to '/auth/twitter' to have them authenticate via Twitter.
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            == OmniAuth Builder
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            If you want to allow multiple providers, use the OmniAuth Builder:
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                require 'omniauth/oauth'
         | 
| 30 | 
            +
                
         | 
| 31 | 
            +
                use OmniAuth::Builder do
         | 
| 32 | 
            +
                  provider :twitter, 'consumer_key', 'consumer_secret'
         | 
| 33 | 
            +
                  provider :facebook, 'client_id', 'client_secret'
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
                
         | 
    
        data/oa-oauth/Rakefile
    ADDED
    
    
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            Autotest.add_discovery { "rspec2" }
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            require 'omniauth/oauth'
         | 
| @@ -0,0 +1,53 @@ | |
| 1 | 
            +
            require 'omniauth/core'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module OmniAuth
         | 
| 4 | 
            +
              module Strategies
         | 
| 5 | 
            +
                autoload :OAuth,              'omniauth/strategies/oauth'
         | 
| 6 | 
            +
                autoload :OAuth2,             'omniauth/strategies/oauth2'
         | 
| 7 | 
            +
                autoload :XAuth,              'omniauth/strategies/xauth'
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                autoload :Bitly,              'omniauth/strategies/bitly'
         | 
| 10 | 
            +
                autoload :Dailymile,          'omniauth/strategies/dailymile'
         | 
| 11 | 
            +
                autoload :Doit,               'omniauth/strategies/doit'
         | 
| 12 | 
            +
                autoload :Dopplr,             'omniauth/strategies/dopplr'
         | 
| 13 | 
            +
                autoload :Douban,             'omniauth/strategies/douban'
         | 
| 14 | 
            +
                autoload :Evernote,           'omniauth/strategies/evernote'
         | 
| 15 | 
            +
                autoload :Facebook,           'omniauth/strategies/facebook'
         | 
| 16 | 
            +
                autoload :Foursquare,         'omniauth/strategies/foursquare'
         | 
| 17 | 
            +
                autoload :GitHub,             'omniauth/strategies/github'
         | 
| 18 | 
            +
                autoload :Goodreads,          'omniauth/strategies/goodreads'
         | 
| 19 | 
            +
                autoload :Google,             'omniauth/strategies/google'
         | 
| 20 | 
            +
                autoload :Gowalla,            'omniauth/strategies/gowalla'
         | 
| 21 | 
            +
                autoload :Hyves,              'omniauth/strategies/hyves'
         | 
| 22 | 
            +
                autoload :Identica,           'omniauth/strategies/identica'
         | 
| 23 | 
            +
                autoload :Instagram,          'omniauth/strategies/instagram'
         | 
| 24 | 
            +
                autoload :Instapaper,         'omniauth/strategies/instapaper'
         | 
| 25 | 
            +
                autoload :LinkedIn,           'omniauth/strategies/linked_in'
         | 
| 26 | 
            +
                autoload :Meetup,             'omniauth/strategies/meetup'
         | 
| 27 | 
            +
                autoload :Miso,               'omniauth/strategies/miso'
         | 
| 28 | 
            +
                autoload :Mixi,               'omniauth/strategies/mixi'
         | 
| 29 | 
            +
                autoload :Netflix,            'omniauth/strategies/netflix'
         | 
| 30 | 
            +
                autoload :Qzone,              'omniauth/strategies/qzone'
         | 
| 31 | 
            +
                autoload :Rdio,               'omniauth/strategies/rdio'
         | 
| 32 | 
            +
                autoload :Renren,             'omniauth/strategies/renren'
         | 
| 33 | 
            +
                autoload :Salesforce,         'omniauth/strategies/salesforce'
         | 
| 34 | 
            +
                autoload :SmugMug,            'omniauth/strategies/smug_mug'
         | 
| 35 | 
            +
                autoload :SoundCloud,         'omniauth/strategies/sound_cloud'
         | 
| 36 | 
            +
                autoload :T163,               'omniauth/strategies/t163'
         | 
| 37 | 
            +
                autoload :Teambox,            'omniauth/strategies/teambox'
         | 
| 38 | 
            +
                autoload :ThirtySevenSignals, 'omniauth/strategies/thirty_seven_signals'
         | 
| 39 | 
            +
                autoload :Tqq,                'omniauth/strategies/tqq'
         | 
| 40 | 
            +
                autoload :TradeMe,            'omniauth/strategies/trade_me'
         | 
| 41 | 
            +
                autoload :TripIt,             'omniauth/strategies/trip_it'
         | 
| 42 | 
            +
                autoload :Tsina,              'omniauth/strategies/tsina'
         | 
| 43 | 
            +
                autoload :Tsohu,              'omniauth/strategies/tsohu'
         | 
| 44 | 
            +
                autoload :Tumblr,             'omniauth/strategies/tumblr'
         | 
| 45 | 
            +
                autoload :Twitter,            'omniauth/strategies/twitter'
         | 
| 46 | 
            +
                autoload :TypePad,            'omniauth/strategies/type_pad'
         | 
| 47 | 
            +
                autoload :Vimeo,              'omniauth/strategies/vimeo'
         | 
| 48 | 
            +
                autoload :Vkontakte,          'omniauth/strategies/vkontakte'
         | 
| 49 | 
            +
                autoload :Yahoo,              'omniauth/strategies/yahoo'
         | 
| 50 | 
            +
                autoload :Yammer,             'omniauth/strategies/yammer'
         | 
| 51 | 
            +
                autoload :YouTube,            'omniauth/strategies/you_tube'
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
            end
         | 
| @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            require 'omniauth/oauth'
         | 
| 2 | 
            +
            require 'multi_json'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module OmniAuth
         | 
| 5 | 
            +
              module Strategies
         | 
| 6 | 
            +
                #
         | 
| 7 | 
            +
                # Authenticate to Bitly utilizing OAuth 2.0 and retrieve
         | 
| 8 | 
            +
                # basic user information.
         | 
| 9 | 
            +
                #
         | 
| 10 | 
            +
                # @example Basic Usage
         | 
| 11 | 
            +
                #     use OmniAuth::Strategies::Bitly, 'API Key', 'Secret Key'
         | 
| 12 | 
            +
                class Bitly < OAuth2
         | 
| 13 | 
            +
                  # @param [Rack Application] app standard middleware application parameter
         | 
| 14 | 
            +
                  # @param [String] api_key the application id as [registered on Bitly](http://bit.ly/a/account)
         | 
| 15 | 
            +
                  # @param [String] secret_key the application secret as [registered on Bitly](http://bit.ly/a/account)
         | 
| 16 | 
            +
                  def initialize(app, api_key = nil, secret_key = nil, options = {}, &block)
         | 
| 17 | 
            +
                    client_options = {
         | 
| 18 | 
            +
                      :site => 'https://bit.ly',
         | 
| 19 | 
            +
                      :authorize_url => 'https://bit.ly/oauth/authorize',
         | 
| 20 | 
            +
                      :access_token_url => 'https://api-ssl.bit.ly/oauth/access_token'
         | 
| 21 | 
            +
                    }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                    super(app, :bitly, api_key, secret_key, client_options, options, &block)
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  protected
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def user_data
         | 
| 29 | 
            +
                    {
         | 
| 30 | 
            +
                      'login' => @access_token['login'],
         | 
| 31 | 
            +
                      'api_key' => @access_token['apiKey']
         | 
| 32 | 
            +
                    }
         | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  def auth_hash
         | 
| 36 | 
            +
                    OmniAuth::Utils.deep_merge(super, {
         | 
| 37 | 
            +
                      'uid' => @access_token['login'],
         | 
| 38 | 
            +
                      'user_info' => user_data,
         | 
| 39 | 
            +
                      'extra' => {'user_hash' => user_data}
         | 
| 40 | 
            +
                    })
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            end
         | 
| @@ -0,0 +1,64 @@ | |
| 1 | 
            +
            require 'omniauth/oauth'
         | 
| 2 | 
            +
            require 'multi_json'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module OmniAuth
         | 
| 5 | 
            +
              module Strategies
         | 
| 6 | 
            +
                #
         | 
| 7 | 
            +
                # Authenticate to DailyMile utilizing OAuth 2.0 and retrieve
         | 
| 8 | 
            +
                # basic user information.
         | 
| 9 | 
            +
                #
         | 
| 10 | 
            +
                # @example Basic Usage
         | 
| 11 | 
            +
                #     use OmniAuth::Strategies::DailyMile, 'CLIENT_ID', 'CLIENT_SECRET'
         | 
| 12 | 
            +
                class Dailymile < OAuth2
         | 
| 13 | 
            +
                  # @param [Rack Application] app standard middleware application parameter
         | 
| 14 | 
            +
                  # @param [String] client_id the application id as [registered on Dailymile](http://www.dailymile.com/api/consumers/new)
         | 
| 15 | 
            +
                  # @param [String] cliend_secret the application secret as [registered on Dailymile](http://www.dailymile.com/api/consumers/new)
         | 
| 16 | 
            +
                  def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
         | 
| 17 | 
            +
                    client_options = {
         | 
| 18 | 
            +
                      :site => 'https://api.dailymile.com/oauth',
         | 
| 19 | 
            +
                      :authorize_path => '/oauth/authorize',
         | 
| 20 | 
            +
                      :access_token_path => '/oauth/token'
         | 
| 21 | 
            +
                    }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                    super(app, :dailymile, client_id, client_secret, client_options, options, &block)
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  protected
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def user_data
         | 
| 29 | 
            +
                    @data ||= MultiJson.decode(@access_token.get("/people/me.json"))
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  def request_phase
         | 
| 33 | 
            +
                    options[:response_type] ||= 'code'
         | 
| 34 | 
            +
                    super
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  def callback_phase
         | 
| 38 | 
            +
                    options[:grant_type] ||= 'authorization_code'
         | 
| 39 | 
            +
                    super
         | 
| 40 | 
            +
                  end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  def user_info
         | 
| 43 | 
            +
                    {
         | 
| 44 | 
            +
                      'name' => user_data['display_name'],
         | 
| 45 | 
            +
                      'nickname' => user_data['username'],
         | 
| 46 | 
            +
                      'location' => user_data['location'],
         | 
| 47 | 
            +
                      'image' => user_data['photo_url'],
         | 
| 48 | 
            +
                      'description' => user_data['goal'],
         | 
| 49 | 
            +
                      'urls' => {
         | 
| 50 | 
            +
                        'dailymile' => user_data['url']
         | 
| 51 | 
            +
                      }
         | 
| 52 | 
            +
                    }
         | 
| 53 | 
            +
                  end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                  def auth_hash
         | 
| 56 | 
            +
                    OmniAuth::Utils.deep_merge(super, {
         | 
| 57 | 
            +
                      'uid' => user_data["url"].split('/').last,
         | 
| 58 | 
            +
                      'user_info' => user_info,
         | 
| 59 | 
            +
                      'extra' => {'user_hash' => user_data}
         | 
| 60 | 
            +
                    })
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
            end
         | 
| @@ -0,0 +1,60 @@ | |
| 1 | 
            +
            require 'omniauth/oauth'
         | 
| 2 | 
            +
            require 'multi_json'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module OmniAuth
         | 
| 5 | 
            +
              module Strategies
         | 
| 6 | 
            +
                class Doit < OAuth2
         | 
| 7 | 
            +
                  def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
         | 
| 8 | 
            +
                    client_options = {
         | 
| 9 | 
            +
                      :site => 'https://openapi.doit.im',
         | 
| 10 | 
            +
                      :authorize_url => 'https://openapi.doit.im/oauth/authorize',
         | 
| 11 | 
            +
                      :access_token_url => 'https://openapi.doit.im/oauth/access_token'
         | 
| 12 | 
            +
                    }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    super(app, :doit, consumer_key, consumer_secret, client_options, options, &block)
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  protected
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  def user_data
         | 
| 20 | 
            +
                    @data ||= MultiJson.decode(@access_token.get(client.site+"/v1/settings"),{'Authorization'=> 'OAuth'+@access_token.token})
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  def request_phase
         | 
| 24 | 
            +
                    options[:response_type] ||= "code"
         | 
| 25 | 
            +
                    super
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def callback_phase
         | 
| 29 | 
            +
                    options[:grant_type] ||= 'authorization_code'
         | 
| 30 | 
            +
                    super
         | 
| 31 | 
            +
                  end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  def user_info
         | 
| 34 | 
            +
                    {
         | 
| 35 | 
            +
                      'account' => user_data['account'],
         | 
| 36 | 
            +
                      'username'=> user_data['username'],
         | 
| 37 | 
            +
                      'nickname'=> user_data['nickname'],
         | 
| 38 | 
            +
                      'gender'=> user_data['gender'],
         | 
| 39 | 
            +
                      'week_start'=> user_data['week_start'],
         | 
| 40 | 
            +
                      'birthday_day'=> user_data['birthday_day'],
         | 
| 41 | 
            +
                      'birthday_month'=> user_data['birthday_month'],
         | 
| 42 | 
            +
                      'birthday_year'=> user_data['birthday_year'],
         | 
| 43 | 
            +
                      'language'=> user_data['language'],
         | 
| 44 | 
            +
                      'user_timezone'=> user_data['user_timezone'],
         | 
| 45 | 
            +
                      'remind_email'=> user_data['remind_email'],
         | 
| 46 | 
            +
                      'created'=> user_data['created'],
         | 
| 47 | 
            +
                      'updated'=> user_data['updated']
         | 
| 48 | 
            +
                    }
         | 
| 49 | 
            +
                  end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  def auth_hash
         | 
| 52 | 
            +
                    OmniAuth::Utils.deep_merge(super, {
         | 
| 53 | 
            +
                      'uid' => user_data['id'],
         | 
| 54 | 
            +
                      'user_info' => user_info,
         | 
| 55 | 
            +
                      'extra' => {'user_hash' => user_data}
         | 
| 56 | 
            +
                    })
         | 
| 57 | 
            +
                  end
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
              end
         | 
| 60 | 
            +
            end
         |