Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 13 commits
  • 16 files changed
  • 0 commit comments
  • 5 contributors
View
2 lib/omniauth/version.rb
@@ -10,7 +10,7 @@ module Version
PATCH = 0
end
unless defined?(::OmniAuth::Version::PRE)
- PRE = "rc1"
+ PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
View
2 oa-basic/lib/omniauth/version.rb
@@ -10,7 +10,7 @@ module Version
PATCH = 0
end
unless defined?(::OmniAuth::Version::PRE)
- PRE = "rc1"
+ PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
View
2 oa-core/lib/omniauth/version.rb
@@ -10,7 +10,7 @@ module Version
PATCH = 0
end
unless defined?(::OmniAuth::Version::PRE)
- PRE = "rc1"
+ PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
View
2 oa-enterprise/lib/omniauth/version.rb
@@ -10,7 +10,7 @@ module Version
PATCH = 0
end
unless defined?(::OmniAuth::Version::PRE)
- PRE = "rc1"
+ PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
View
2 oa-more/lib/omniauth/version.rb
@@ -10,7 +10,7 @@ module Version
PATCH = 0
end
unless defined?(::OmniAuth::Version::PRE)
- PRE = "rc1"
+ PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
View
2 oa-oauth/lib/omniauth/oauth.rb
@@ -36,7 +36,6 @@ module Strategies
autoload :TypePad, 'omniauth/strategies/oauth/type_pad'
autoload :Vimeo, 'omniauth/strategies/oauth/vimeo'
autoload :Yahoo, 'omniauth/strategies/oauth/yahoo'
- autoload :Yammer, 'omniauth/strategies/oauth/yammer'
autoload :YouTube, 'omniauth/strategies/oauth/you_tube'
autoload :OAuth2, 'omniauth/strategies/oauth2'
@@ -65,6 +64,7 @@ module Strategies
autoload :Viadeo, 'omniauth/strategies/oauth2/viadeo'
autoload :Vkontakte, 'omniauth/strategies/oauth2/vkontakte'
autoload :WePay, 'omniauth/strategies/oauth2/we_pay'
+ autoload :Yammer, 'omniauth/strategies/oauth2/yammer'
autoload :XAuth, 'omniauth/strategies/xauth'
View
2 oa-oauth/lib/omniauth/strategies/google_oauth2.rb
@@ -22,7 +22,7 @@ def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
def request_phase
google_email_scope = "www.googleapis.com/auth/userinfo.email"
options[:scope] ||= "https://#{google_email_scope}"
- options[:scope] << "https://#{google_email_scope}" unless options[:scope] =~ %r[http[s]?:\/\/#{google_email_scope}]
+ options[:scope] << " https://#{google_email_scope}" unless options[:scope] =~ %r[http[s]?:\/\/#{google_email_scope}]
redirect client.auth_code.authorize_url(
{:redirect_uri => callback_url, :response_type => "code"}.merge(options))
end
View
20 oa-oauth/lib/omniauth/strategies/oauth/goodreads.rb
@@ -24,19 +24,19 @@ def auth_hash
end
def user_info(access_token)
- authenticated_user = MultiXml.parse(@access_token.get('/api/auth_user').body)
- id = authenticated_user.xpath('GoodreadsResponse/user').attribute('id').value.to_i
- response_doc = MultiXml.parse(open("http://www.goodreads.com/user/show/#{id}.xml?key=#{@consumer_key}").read)
- user = response_doc.xpath('GoodreadsResponse/user')
+ authenticated_user = MultiXml.parse(access_token.get('/api/auth_user').body)
+ id = authenticated_user['GoodreadsResponse']['user']['id'].to_i
+ response_doc = MultiXml.parse(access_token.get("/user/show/#{id}.xml?key=#{@consumer_key}").body)
+ user = response_doc['GoodreadsResponse']['user']
hash = {
'id' => id,
- 'name' => user.xpath('name').text,
- 'user_name' => user.xpath('user_name').text,
- 'image_url' => user.xpath('image_url').text,
- 'about' => user.xpath('about').text,
- 'location' => user.xpath('location').text,
- 'website' => user.xpath('website').text,
+ 'name' => user['name'],
+ 'user_name' => user['user_name'],
+ 'image_url' => user['image_url'],
+ 'about' => user['about'],
+ 'location' => user['location'],
+ 'website' => user['website'],
}
end
end
View
2 oa-oauth/lib/omniauth/strategies/oauth/twitter.rb
@@ -17,7 +17,7 @@ def initialize(app, consumer_key=nil, consumer_secret=nil, options={}, &block)
:site => 'https://api.twitter.com',
}
options[:authorize_params] = {:force_login => 'true'} if options.delete(:force_login) == true
- client_options[:authorize_path] = '/oauth/authorize' unless options[:sign_in] == false
+ client_options[:authorize_path] = '/oauth/authenticate' unless options[:sign_in] == false
super(app, options[:name] || :twitter, consumer_key, consumer_secret, client_options, options, &block)
end
View
48 oa-oauth/lib/omniauth/strategies/oauth/yammer.rb
@@ -1,48 +0,0 @@
-require 'omniauth/oauth'
-require 'multi_json'
-
-module OmniAuth
- module Strategies
- class Yammer < OmniAuth::Strategies::OAuth
- def initialize(app, consumer_key=nil, consumer_secret=nil, options={}, &block)
- client_options = {
- :access_token_path => '/oauth/access_token',
- :authorize_path => '/oauth/authorize',
- :request_token_path => '/oauth/request_token',
- :site => 'https://www.yammer.com',
- }
- super(app, :yammer, consumer_key, consumer_secret, client_options, options, &block)
- end
-
- def auth_hash
- OmniAuth::Utils.deep_merge(
- super, {
- 'uid' => user_hash['id'],
- 'user_info' => user_info,
- 'extra' => {
- 'user_hash' => user_hash,
- },
- }
- )
- end
-
- def user_info
- user_hash = self.user_hash
- {
- 'nickname' => user_hash['name'],
- 'name' => user_hash['full-name'],
- 'location' => user_hash['location'],
- 'image' => user_hash['mugshot-url'],
- 'description' => user_hash['job-title'],
- 'urls' => {
- 'Yammer' => user_hash['web-url'],
- },
- }
- end
-
- def user_hash
- @user_hash ||= MultiJson.decode(@access_token.get('/api/v1/users/current.json').body)
- end
- end
- end
-end
View
63 oa-oauth/lib/omniauth/strategies/oauth2/yammer.rb
@@ -0,0 +1,63 @@
+require 'omniauth/oauth'
+require 'multi_json'
+
+module OmniAuth
+ module Strategies
+ # OAuth 2.0 based authentication with GitHub. In order to
+ # sign up for an application, you need to [register an application](http://github.com/account/applications/new)
+ # and provide the proper credentials to this middleware.
+ class Yammer < OmniAuth::Strategies::OAuth2
+ def initialize(app, client_id=nil, client_secret=nil, options={}, &block)
+ client_options = {
+ :token_url => '/oauth2/access_token.json',
+ :authorize_url => '/dialog/oauth',
+ :site => 'https://www.yammer.com'
+ }
+ super(app, :yammer, client_id, client_secret, client_options, options, &block)
+ end
+
+ def auth_hash
+ OmniAuth::Utils.deep_merge(
+ super, {
+ 'uid' => user_hash['id'],
+ 'user_info' => user_info,
+ 'extra' => {
+ 'user_hash' => user_hash,
+ },
+ }
+ )
+ end
+
+ def user_info
+ user_hash = self.user_hash
+ {
+ 'nickname' => user_hash['name'],
+ 'name' => user_hash['full_name'],
+ 'location' => user_hash['location'],
+ 'image' => user_hash['mugshot_url'],
+ 'description' => user_hash['job_title'],
+ 'email' => user_hash['contact']['email_addresses'][0]['address'],
+ 'urls' => {
+ 'Yammer' => user_hash['web_url'],
+ },
+ }
+ end
+
+ def build_access_token
+ # Dance to get the real token out of the object returned by Yammer
+ verifier = request.params['code']
+ temp_access_token = client.auth_code.get_token(verifier, {:redirect_uri => callback_url}.merge(options))
+ token = eval(temp_access_token.token)['token']
+ @access_token = ::OAuth2::AccessToken.new(client, token, temp_access_token.params)
+ rescue ::OAuth2::Error => e
+ raise e.response.inspect
+ end
+
+ def user_hash
+ @user_hash ||= MultiJson.decode(@access_token.get('/api/v1/users/current.json').body)
+ end
+
+
+ end
+ end
+end
View
2 oa-oauth/lib/omniauth/version.rb
@@ -10,7 +10,7 @@ module Version
PATCH = 0
end
unless defined?(::OmniAuth::Version::PRE)
- PRE = "rc1"
+ PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
View
2 oa-oauth/oa-oauth.gemspec
@@ -4,7 +4,7 @@ require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
gem.add_dependency 'faraday', '~> 0.7.3'
gem.add_dependency 'multi_json', '~> 1.0.0'
- gem.add_dependency 'multi_xml', '~> 0.3.0'
+ gem.add_dependency 'multi_xml', '~> 0.4.0'
gem.add_dependency 'oa-core', OmniAuth::Version::STRING
gem.add_dependency 'oauth', '~> 0.4.0'
gem.add_dependency 'oauth2', '~> 0.5.0'
View
4 oa-oauth/spec/omniauth/strategies/oauth/twitter_spec.rb
@@ -13,9 +13,9 @@ def app
}.to_app
end
- it 'should use the authorize path by default' do
+ it 'should use the authenticate path by default' do
s = strategy_class.new(app, 'abc', 'def')
- s.consumer.options[:authorize_path].should == '/oauth/authorize'
+ s.consumer.options[:authorize_path].should == '/oauth/authenticate'
end
it 'should set options[:authorize_params] to { :force_login => "true" } if :force_login is true' do
View
2 .../omniauth/strategies/oauth/yammer_spec.rb → ...omniauth/strategies/oauth2/yammer_spec.rb
@@ -1,5 +1,5 @@
require 'spec_helper'
describe OmniAuth::Strategies::Yammer do
- it_should_behave_like 'an oauth strategy'
+ it_should_behave_like 'an oauth2 strategy'
end
View
2 oa-openid/lib/omniauth/version.rb
@@ -10,7 +10,7 @@ module Version
PATCH = 0
end
unless defined?(::OmniAuth::Version::PRE)
- PRE = "rc1"
+ PRE = nil
end
unless defined?(::OmniAuth::Version::STRING)
STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')

No commit comments for this range

Something went wrong with that request. Please try again.