diff --git a/.gitignore b/.gitignore
index 737b05e..9118f59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,36 +1,56 @@
-## MAC OS
-.DS_Store
-
-/live
-.rvmrc
-
-dist/*
-
-## TEXTMATE
-*.tmproj
-tmtags
-
-## EMACS
-*~
-\#*
-.\#*
-
-## VIM
-*.swp
-
-## PROJECT::GENERAL
-coverage
-rdoc
-pkg
-tmp
-oa-live
-
-## PROJECT::SPECIFIC
+!.autotest
+!.document
+!.gemtest
+!.gitignore
+!.rspec
+!.yardopts
*.gem
+*.rbc
+*.sw[a-z]
+*.tmproj
+*.tmproject
+*.un~
+*~
+.*
+.DS_Store
+.Spotlight-V100
+.Trashes
+.\#*
+._*
.bundle
-.project
+.config
+.directory
+.elc
.loadpath
+.project
+.redcar
+.rvmrc
.yardoc
-doc
-
+/.emacs.desktop
+/.emacs.desktop.lock
+/live
+Desktop.ini
Gemfile.lock
+Icon?
+InstalledFiles
+Session.vim
+Thumbs.db
+\#*
+\#*\#
+_yardoc
+auto-save-list
+coverage
+dist/*
+doc
+doc/
+lib/bundler/man
+oa-live
+pkg
+pkg/*
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
+tmtags
+tramp
diff --git a/.travis.yml b/.travis.yml
index 03281a1..dbee033 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,5 +3,7 @@ rvm:
- 1.8.7
- 1.9.1
- 1.9.2
+ - jruby
- rbx
- ree
+ - ruby-head
diff --git a/Gemfile b/Gemfile
index 9a9c7e4..e61efb6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,13 @@
source 'http://rubygems.org'
+platforms :jruby do
+ gem 'jruby-openssl', '~> 0.7'
+end
+
+group :development do
+ gem 'yard', :git => 'https://github.com/lsegal/yard.git'
+end
+
gemspec :path => 'oa-basic'
gemspec :path => 'oa-core'
gemspec :path => 'oa-enterprise'
diff --git a/LICENSE b/LICENSE.md
similarity index 92%
rename from LICENSE
rename to LICENSE.md
index 811fa0e..143f9d4 100644
--- a/LICENSE
+++ b/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
+Copyright (c) 2010-2011 Michael Bleigh, Erik Michaels-Ober, and Intridea, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.markdown b/README.md
similarity index 94%
rename from README.markdown
rename to README.md
index e686d90..9aeaf46 100644
--- a/README.markdown
+++ b/README.md
@@ -11,7 +11,6 @@ To install OmniAuth, simply install the gem:
gem install omniauth
-
## Continuous Integration
[![Build Status](http://travis-ci.org/intridea/omniauth.png)](http://travis-ci.org/intridea/omniauth)
@@ -43,7 +42,7 @@ OmniAuth currently supports the following external providers:
* Mixi (credit: [kiyoshi](https://github.com/kiyoshi))
* Netflix (credit: [caged](https://github.com/caged))
* Qzone (credit: [quake](https://github.com/quake))
- * Rdio (via [brandonweiss](http://github.com/brandonweiss))
+ * Rdio (via [brandonweiss](https://github.com/brandonweiss))
* Renren (credit: [quake](https://github.com/quake))
* Salesforce (via [CloudSpokes](http://www.cloudspokes.com))
* SmugMug (credit: [pchilton](https://github.com/pchilton))
@@ -108,12 +107,12 @@ The `user_info` hash will automatically be populated with as much information ab
## Resources
-The best place to find more information is the [OmniAuth Wiki](http://github.com/intridea/omniauth/wiki). Some specific information you might be interested in:
+The best place to find more information is the [OmniAuth Wiki](https://github.com/intridea/omniauth/wiki). Some specific information you might be interested in:
* [CI Build Status](http://travis-ci.org/#!/intridea/omniauth)
-* [Roadmap](http://github.com/intridea/omniauth/wiki/Roadmap)
-* [Changelog](http://github.com/intridea/omniauth/wiki/Changelog)
-* [Report Issues](http://github.com/intridea/omniauth/issues)
+* [Roadmap](https://github.com/intridea/omniauth/wiki/Roadmap)
+* [Changelog](https://github.com/intridea/omniauth/wiki/Changelog)
+* [Report Issues](https://github.com/intridea/omniauth/issues)
* [Mailing List](http://groups.google.com/group/omniauth)
## OmniAuth Core
diff --git a/Rakefile b/Rakefile
index 5323e05..6a538e9 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,5 @@
+#!/usr/bin/env rake
+
$:.unshift File.expand_path('..', __FILE__)
require 'tasks/all'
@@ -47,4 +49,3 @@ namespace :doc do
task.files = PROJECTS.map{|project| "#{root}/#{project}/lib/**/*.rb"} + ['README.markdown', 'LICENSE']
end
end
-
diff --git a/oa-basic/Gemfile b/oa-basic/Gemfile
index c80ee36..af3f2ef 100644
--- a/oa-basic/Gemfile
+++ b/oa-basic/Gemfile
@@ -1,3 +1,11 @@
-source "http://rubygems.org"
+source 'http://rubygems.org'
+
+platforms :jruby do
+ gem 'jruby-openssl', '~> 0.7'
+end
+
+group :development do
+ gem 'yard', :git => 'https://github.com/lsegal/yard.git'
+end
gemspec
diff --git a/oa-basic/oa-basic.gemspec b/oa-basic/oa-basic.gemspec
index 642cc9c..276807f 100644
--- a/oa-basic/oa-basic.gemspec
+++ b/oa-basic/oa-basic.gemspec
@@ -3,7 +3,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
- gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
gem.add_runtime_dependency 'rest-client', '~> 1.6.0'
gem.add_development_dependency 'maruku', '~> 0.6'
gem.add_development_dependency 'simplecov', '~> 0.4'
@@ -11,7 +10,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake', '~> 0.8'
gem.add_development_dependency 'rspec', '~> 2.5'
gem.add_development_dependency 'webmock', '~> 1.6'
- gem.add_development_dependency 'yard', '~> 0.6'
+ # gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-basic'
gem.version = OmniAuth::Version::STRING
diff --git a/oa-core/Gemfile b/oa-core/Gemfile
index c80ee36..3c1dac6 100644
--- a/oa-core/Gemfile
+++ b/oa-core/Gemfile
@@ -1,3 +1,7 @@
-source "http://rubygems.org"
+source 'http://rubygems.org'
+
+group :development do
+ gem 'yard', :git => 'https://github.com/lsegal/yard.git'
+end
gemspec
diff --git a/oa-core/lib/omniauth/form.rb b/oa-core/lib/omniauth/form.rb
index 0d68cce..99b7427 100644
--- a/oa-core/lib/omniauth/form.rb
+++ b/oa-core/lib/omniauth/form.rb
@@ -90,13 +90,14 @@ module OmniAuth
def initialize(options = {})
options[:title] ||= "Authentication Info Required"
+ options[:header_info] ||= ""
self.options = options
@html = ""
- header(options[:title])
+ header(options[:title],options[:header_info])
end
- def self.build(title=nil, &block)
+ def self.build(title=nil,&block)
form = OmniAuth::Form.new(title)
if block.arity > 0
yield form
@@ -143,13 +144,14 @@ module OmniAuth
self
end
- def header(title)
+ def header(title,header_info)
@html << <<-HTML
#{title}
#{css}
+ #{header_info}
#{title}
diff --git a/oa-core/lib/omniauth/strategy.rb b/oa-core/lib/omniauth/strategy.rb
index 2b46076..b01f8f5 100644
--- a/oa-core/lib/omniauth/strategy.rb
+++ b/oa-core/lib/omniauth/strategy.rb
@@ -99,7 +99,7 @@ module OmniAuth
elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
@env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
end
- redirect(callback_path)
+ redirect(script_name + callback_path)
end
def mock_callback_call
diff --git a/oa-core/oa-core.gemspec b/oa-core/oa-core.gemspec
index 82f7620..21be5b1 100644
--- a/oa-core/oa-core.gemspec
+++ b/oa-core/oa-core.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rack-test', '~> 0.5'
gem.add_development_dependency 'rake', '~> 0.8'
gem.add_development_dependency 'rspec', '~> 2.5'
- gem.add_development_dependency 'yard', '~> 0.6'
+ # gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-core'
gem.version = OmniAuth::Version::STRING
diff --git a/oa-core/spec/omniauth/strategy_spec.rb b/oa-core/spec/omniauth/strategy_spec.rb
index b18681b..e7c2f49 100644
--- a/oa-core/spec/omniauth/strategy_spec.rb
+++ b/oa-core/spec/omniauth/strategy_spec.rb
@@ -258,6 +258,11 @@ describe OmniAuth::Strategy do
strategy.call(make_env('/AUTH/Test'))[0].should == 302
end
+ it 'should respect SCRIPT_NAME (a.k.a. BaseURI)' do
+ response = strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri'))
+ response[1]['Location'].should == '/sub_uri/auth/test/callback'
+ end
+
it 'should be case insensitive on callback path' do
strategy.call(make_env('/AUTH/TeSt/CaLlBAck')).should == strategy.call(make_env('/auth/test/callback'))
end
diff --git a/oa-enterprise/Gemfile b/oa-enterprise/Gemfile
index c80ee36..af3f2ef 100644
--- a/oa-enterprise/Gemfile
+++ b/oa-enterprise/Gemfile
@@ -1,3 +1,11 @@
-source "http://rubygems.org"
+source 'http://rubygems.org'
+
+platforms :jruby do
+ gem 'jruby-openssl', '~> 0.7'
+end
+
+group :development do
+ gem 'yard', :git => 'https://github.com/lsegal/yard.git'
+end
gemspec
diff --git a/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb b/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb
index 898919d..7433e0a 100644
--- a/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb
+++ b/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb
@@ -38,14 +38,21 @@ module OmniAuth
# returns nil if given nil
def parse_user_info(node)
return nil if node.nil?
- node.children.inject({}) do |hash, child|
- unless child.kind_of?(Nokogiri::XML::Text) ||
- child.name == 'cas:proxies' ||
- child.name == 'proxies'
- hash[child.name.sub(/^cas:/, '')] = child.content
+ hash = {}
+ node.children.each do |e|
+ unless e.kind_of?(Nokogiri::XML::Text) ||
+ e.name == 'cas:proxies' ||
+ e.name == 'proxies'
+ # There are no child elements
+ if e.element_children.count == 0
+ hash[e.name.sub(/^cas:/, '')] = e.content
+ elsif e.element_children.count
+ hash[e.name.sub(/^cas:/, '')] = [] if hash[e.name.sub(/^cas:/, '')].nil?
+ hash[e.name.sub(/^cas:/, '')].push parse_user_info e
+ end
end
- hash
end
+ hash
end
# finds an `` node in
diff --git a/oa-enterprise/oa-enterprise.gemspec b/oa-enterprise/oa-enterprise.gemspec
index e0946a2..a0fcc01 100644
--- a/oa-enterprise/oa-enterprise.gemspec
+++ b/oa-enterprise/oa-enterprise.gemspec
@@ -2,8 +2,7 @@
require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
- gem.add_runtime_dependency 'addressable', '2.2.4'
- gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
+ gem.add_runtime_dependency 'addressable', '~> 2.2.6'
gem.add_runtime_dependency 'nokogiri', '~> 1.4.2'
gem.add_runtime_dependency 'net-ldap', '~> 0.2.2'
gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
@@ -15,7 +14,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake', '~> 0.8'
gem.add_development_dependency 'rspec', '~> 2.5'
gem.add_development_dependency 'webmock', '~> 1.6'
- gem.add_development_dependency 'yard', '~> 0.6'
+ # gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-enterprise'
gem.version = OmniAuth::Version::STRING
diff --git a/oa-more/Gemfile b/oa-more/Gemfile
index c80ee36..af3f2ef 100644
--- a/oa-more/Gemfile
+++ b/oa-more/Gemfile
@@ -1,3 +1,11 @@
-source "http://rubygems.org"
+source 'http://rubygems.org'
+
+platforms :jruby do
+ gem 'jruby-openssl', '~> 0.7'
+end
+
+group :development do
+ gem 'yard', :git => 'https://github.com/lsegal/yard.git'
+end
gemspec
diff --git a/oa-more/lib/omniauth/more.rb b/oa-more/lib/omniauth/more.rb
index 659fa93..7ebb4cb 100644
--- a/oa-more/lib/omniauth/more.rb
+++ b/oa-more/lib/omniauth/more.rb
@@ -5,5 +5,6 @@ module OmniAuth
autoload :WindowsLive, 'omniauth/strategies/windows_live'
autoload :Flickr, 'omniauth/strategies/flickr'
autoload :Yupoo, 'omniauth/strategies/yupoo'
+ autoload :Ign, 'omniauth/strategies/ign'
end
end
diff --git a/oa-more/lib/omniauth/strategies/ign.rb b/oa-more/lib/omniauth/strategies/ign.rb
new file mode 100644
index 0000000..27e3675
--- /dev/null
+++ b/oa-more/lib/omniauth/strategies/ign.rb
@@ -0,0 +1,93 @@
+require 'omniauth/core'
+require 'openssl'
+
+module OmniAuth
+ module Strategies
+ class Ign
+ include OmniAuth::Strategy
+ IDENTIFIER_URL_PARAMETER = ""
+
+ class CallbackError < StandardError
+ attr_accessor :error, :error_reason
+ def initialize(error, error_reason)
+ self.error = error
+ self.error_reason = error_reason
+ end
+ end
+
+ def initialize(app, api_key, hostname=nil, options = {})
+ options[:name] ||= "ign"
+ super(app, :ign)
+ @api_key = api_key
+ @hostname = hostname
+ end
+
+ protected
+
+ def request_phase
+ OmniAuth::Form.build(:title => 'IGN Authentication', :header_info=>js) do
+ label_field('Identifying you with the IGN server', IDENTIFIER_URL_PARAMETER)
+ end.to_response
+ end
+
+ def callback_phase
+ signature = OpenSSL::HMAC.hexdigest('sha1', @api_key, ("#{request.params["username"]}::#{request.params["timestamp"]}"))
+
+ raise CallbackError.new("Invalid Signature","The supplied and calculated signature did not match, user not approved.") if signature != request.params["signature"]
+
+ super
+ rescue CallbackError => e
+ fail!(:invalid_response, e)
+ end
+
+ def auth_hash
+ OmniAuth::Utils.deep_merge(super, {
+ 'uid' => "ign-" + request.params["username"],
+ 'credentials' => { 'token' => request.params["signature"] },
+ 'user_info' => user_info,
+ 'extra' => { 'user_hash' => request.params }
+ })
+ end
+
+ def user_info
+ {
+ 'nickname' => request.params["username"],
+ }
+ end
+
+ def js
+ @js = <<-JS
+ $(document).ready(function() {
+ $.ajax({
+ url: "http://#{@hostname}/users/current.json?callback=z33k",
+ type: "get",
+ dataType:"jsonp",
+ success: function(data) {
+ if(typeof data.error == 'undefined'){
+ // There is a current My IGN user
+ var username = data.my_ign_username;
+ var signature = data.signature;
+ var timestamp = data.timestamp;
+ window.location = "/auth/ign/callback?username=" +username+"&signature="+signature+"×tamp=" + timestamp;
+ }
+ else{
+ nouser();
+ }
+ }
+ });
+ return false;
+ });
+ function nouser() {
+ var url = "http://my.ign.com/login?r="+window.location;
+ top.location = url;
+ window.location = url;
+ }
+ JS
+ "\n" +
+ "\n" +
+ "\n"
+ end
+
+ end
+ end
+end
\ No newline at end of file
diff --git a/oa-more/oa-more.gemspec b/oa-more/oa-more.gemspec
index ffd6b2e..d617cc9 100644
--- a/oa-more/oa-more.gemspec
+++ b/oa-more/oa-more.gemspec
@@ -2,7 +2,6 @@
require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
- gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
gem.add_runtime_dependency 'multi_json', '~> 1.0.0'
gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
gem.add_runtime_dependency 'rest-client', '~> 1.6.0'
@@ -13,7 +12,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rspec', '~> 2.5'
gem.add_development_dependency 'simplecov', '~> 0.4'
gem.add_development_dependency 'webmock', '~> 1.6'
- gem.add_development_dependency 'yard', '~> 0.6'
+ # gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-more'
gem.version = OmniAuth::Version::STRING
diff --git a/oa-oauth/Gemfile b/oa-oauth/Gemfile
index c80ee36..af3f2ef 100644
--- a/oa-oauth/Gemfile
+++ b/oa-oauth/Gemfile
@@ -1,3 +1,11 @@
-source "http://rubygems.org"
+source 'http://rubygems.org'
+
+platforms :jruby do
+ gem 'jruby-openssl', '~> 0.7'
+end
+
+group :development do
+ gem 'yard', :git => 'https://github.com/lsegal/yard.git'
+end
gemspec
diff --git a/oa-oauth/lib/omniauth/strategies/facebook.rb b/oa-oauth/lib/omniauth/strategies/facebook.rb
index d6c701e..ea87e33 100644
--- a/oa-oauth/lib/omniauth/strategies/facebook.rb
+++ b/oa-oauth/lib/omniauth/strategies/facebook.rb
@@ -45,7 +45,7 @@ module OmniAuth
def user_info
{
- 'nickname' => user_data["link"].split('/').last,
+ 'nickname' => user_data["username"],
'email' => (user_data["email"] if user_data["email"]),
'first_name' => user_data["first_name"],
'last_name' => user_data["last_name"],
diff --git a/oa-oauth/lib/omniauth/strategies/linked_in.rb b/oa-oauth/lib/omniauth/strategies/linked_in.rb
index fded7fd..019c9fd 100644
--- a/oa-oauth/lib/omniauth/strategies/linked_in.rb
+++ b/oa-oauth/lib/omniauth/strategies/linked_in.rb
@@ -40,10 +40,13 @@ module OmniAuth
'description' => person['headline'],
'public_profile_url' => person['public_profile_url']
}
- hash['urls']={}
- person['member_url_resources']['member_url'].each do |url|
- hash['urls']["#{url['name']}"]=url['url']
- end
+ hash['urls']={}
+ member_urls = person['member_url_resources']['member_url']
+ if (!member_urls.nil?) and (!member_urls.empty?)
+ [member_urls].flatten.each do |url|
+ hash['urls']["#{url['name']}"]=url['url']
+ end
+ end
hash['urls']['LinkedIn'] = person['public_profile_url']
hash['name'] = "#{hash['first_name']} #{hash['last_name']}"
hash
diff --git a/oa-oauth/lib/omniauth/strategies/oauth2.rb b/oa-oauth/lib/omniauth/strategies/oauth2.rb
index 2499421..c1446b8 100644
--- a/oa-oauth/lib/omniauth/strategies/oauth2.rb
+++ b/oa-oauth/lib/omniauth/strategies/oauth2.rb
@@ -80,6 +80,8 @@ module OmniAuth
fail!(:invalid_credentials, e)
rescue ::MultiJson::DecodeError => e
fail!(:invalid_response, e)
+ rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
+ fail!(:timeout, e)
end
def build_access_token
@@ -89,7 +91,7 @@ module OmniAuth
def auth_hash
credentials = {'token' => @access_token.token}
- credentials.merge('refresh_token' => @access_token.refresh_token) if @access_token.expires?
+ credentials.merge!('refresh_token' => @access_token.refresh_token) if @access_token.expires?
OmniAuth::Utils.deep_merge(super, {'credentials' => credentials})
end
diff --git a/oa-oauth/lib/omniauth/strategies/vkontakte.rb b/oa-oauth/lib/omniauth/strategies/vkontakte.rb
index 992abf3..1e51b1d 100644
--- a/oa-oauth/lib/omniauth/strategies/vkontakte.rb
+++ b/oa-oauth/lib/omniauth/strategies/vkontakte.rb
@@ -29,17 +29,19 @@ module OmniAuth
def user_data
# http://vkontakte.ru/developers.php?o=-17680044&p=Description+of+Fields+of+the+fields+Parameter
- @fields ||= ['uid', 'first_name', 'last_name', 'nickname', 'domain', 'sex', 'city', 'country', 'timezone', 'photo', 'photo_big']
+ @fields ||= ['uid', 'first_name', 'last_name', 'nickname', 'domain', 'sex', 'bdate', 'city', 'country', 'timezone', 'photo', 'photo_big']
# http://vkontakte.ru/developers.php?o=-1&p=getProfiles
@data ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getProfiles?uid=#{@access_token['user_id']}&fields=#{@fields.join(',')}&access_token=#{@access_token.token}"))['response'][0]
# we need these 2 additional requests since vkontakte returns only ids of the City and Country
# http://vkontakte.ru/developers.php?o=-17680044&p=getCities
- @city ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCities?cids=#{@data['city']}&access_token=#{@access_token.token}"))['response'].try(:[], 0).try(:[], 'name')
+ cities = MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCities?cids=#{@data['city']}&access_token=#{@access_token.token}"))['response']
+ @city ||= cities.first['name'] if cities && cities.first
# http://vkontakte.ru/developers.php?o=-17680044&p=getCountries
- @country ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCountries?cids=#{@data['country']}&access_token=#{@access_token}"))['response'].try(:[], 0).try(:[], 'name')
+ countries = MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCountries?cids=#{@data['country']}&access_token=#{@access_token}"))['response']
+ @country ||= countries.first['name'] if countries && countries.first
end
def request_phase
@@ -49,10 +51,11 @@ module OmniAuth
def user_info
{
- 'firstname' => @data['first_name'],
+ 'first_name' => @data['first_name'],
'last_name' => @data['last_name'],
'name' => "#{@data['first_name']} #{@data['last_name']}",
'nickname' => @data['nickname'],
+ 'birth_date' => @data['bdate'],
'image' => @data['photo'],
'location' => "#{@country}, #{@city}",
'urls' => {
diff --git a/oa-oauth/oa-oauth.gemspec b/oa-oauth/oa-oauth.gemspec
index 7608183..0e0f3d8 100644
--- a/oa-oauth/oa-oauth.gemspec
+++ b/oa-oauth/oa-oauth.gemspec
@@ -3,7 +3,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
gem.add_runtime_dependency 'faraday', '~> 0.6.1'
- gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
gem.add_runtime_dependency 'multi_json', '~> 1.0.0'
gem.add_runtime_dependency 'multi_xml', '~> 0.2.2'
gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
@@ -16,7 +15,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rspec', '~> 2.5'
gem.add_development_dependency 'simplecov', '~> 0.4'
gem.add_development_dependency 'webmock', '~> 1.6'
- gem.add_development_dependency 'yard', '~> 0.6'
+ # gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-oauth'
gem.version = OmniAuth::Version::STRING
diff --git a/oa-openid/Gemfile b/oa-openid/Gemfile
index c80ee36..af3f2ef 100644
--- a/oa-openid/Gemfile
+++ b/oa-openid/Gemfile
@@ -1,3 +1,11 @@
-source "http://rubygems.org"
+source 'http://rubygems.org'
+
+platforms :jruby do
+ gem 'jruby-openssl', '~> 0.7'
+end
+
+group :development do
+ gem 'yard', :git => 'https://github.com/lsegal/yard.git'
+end
gemspec
diff --git a/oa-openid/lib/omniauth/openid.rb b/oa-openid/lib/omniauth/openid.rb
index e1d3eec..b16e8c9 100644
--- a/oa-openid/lib/omniauth/openid.rb
+++ b/oa-openid/lib/omniauth/openid.rb
@@ -55,5 +55,6 @@ module OmniAuth
module Strategies
autoload :OpenID, 'omniauth/strategies/open_id'
autoload :GoogleApps, 'omniauth/strategies/google_apps'
+ autoload :Steam, 'omniauth/strategies/steam'
end
end
diff --git a/oa-openid/lib/omniauth/strategies/steam.rb b/oa-openid/lib/omniauth/strategies/steam.rb
new file mode 100644
index 0000000..4169c93
--- /dev/null
+++ b/oa-openid/lib/omniauth/strategies/steam.rb
@@ -0,0 +1,55 @@
+require 'omniauth/openid'
+module OmniAuth
+ module Strategies
+ class Steam < OmniAuth::Strategies::OpenID
+ def initialize(app, store = nil, api_key = nil, options = {}, &block)
+ options[:identifier] ||= "http://steamcommunity.com/openid"
+ options[:name] ||= 'steam'
+ @api_key = api_key
+ super(app, store, options, &block)
+ end
+
+ def user_info(response=nil)
+ player = user_hash['response']['players']['player'].first
+ nickname = player["personaname"]
+ name = player["realname"]
+ url = player["profileurl"]
+ country = player["loccountrycode"]
+ state = player["locstatecode"]
+ city = player["loccityid"]
+
+ {
+ 'nickname' => nickname,
+ 'name' => name,
+ 'url' => url,
+ 'location' => "#{city}, #{state}, #{country}"
+ }
+ end
+
+ def user_hash
+ # Steam provides no information back on a openid response other than a 64bit user id
+ # Need to use this information and make a API call to get user information from steam.
+ if @api_key
+ unless @user_hash
+ uri = URI.parse("http://api.steampowered.com/")
+ req = Net::HTTP::Get.new("#{uri.path}ISteamUser/GetPlayerSummaries/v0001/?key=#{@api_key}&steamids=#{@openid_response.display_identifier.split("/").last}")
+ res = Net::HTTP.start(uri.host, uri.port) {|http|
+ http.request(req)
+ }
+ end
+ @user_hash ||= MultiJson.decode(res.body)
+ else
+ {}
+ end
+ end
+
+ def auth_hash
+ OmniAuth::Utils.deep_merge(super, {
+ 'uid' => @openid_response.display_identifier.split("/").last,
+ 'user_info' => user_info,
+ 'extra' => {'user_hash' => user_hash}
+ })
+ end
+ end
+ end
+end
diff --git a/oa-openid/oa-openid.gemspec b/oa-openid/oa-openid.gemspec
index 7033956..3864527 100644
--- a/oa-openid/oa-openid.gemspec
+++ b/oa-openid/oa-openid.gemspec
@@ -2,7 +2,6 @@
require File.expand_path('../lib/omniauth/version', __FILE__)
Gem::Specification.new do |gem|
- gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
gem.add_runtime_dependency 'rack-openid', '~> 1.3.1'
gem.add_runtime_dependency 'ruby-openid-apps-discovery', '~> 1.2.0'
@@ -12,7 +11,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rspec', '~> 2.5'
gem.add_development_dependency 'simplecov', '~> 0.4'
gem.add_development_dependency 'webmock', '~> 1.6'
- gem.add_development_dependency 'yard', '~> 0.6'
+ # gem.add_development_dependency 'yard', '~> 0.7'
gem.add_development_dependency 'ZenTest', '~> 4.5'
gem.name = 'oa-openid'
gem.version = OmniAuth::Version::STRING
diff --git a/omniauth.gemspec b/omniauth.gemspec
index 81d4d9d..734f7d4 100644
--- a/omniauth.gemspec
+++ b/omniauth.gemspec
@@ -5,16 +5,16 @@ Gem::Specification.new do |gem|
%w(oa-core oa-oauth oa-identity oa-basic oa-openid oa-enterprise oa-more).each do |subgem|
gem.add_runtime_dependency subgem, OmniAuth::Version::STRING
end
- gem.name = 'omniauth'
- gem.version = OmniAuth::Version::STRING
- gem.summary = %q{Rack middleware for standardized multi-provider authentication.}
+ gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
gem.description = %q{OmniAuth is an authentication framework that that separates the concept of authentiation from the concept of identity, providing simple hooks for any application to have one or multiple authentication providers for a user.}
gem.email = ['michael@intridea.com', 'sferik@gmail.com']
- gem.homepage = 'http://github.com/intridea/omniauth'
- gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
gem.files = `git ls-files`.split("\n")
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ gem.homepage = 'http://github.com/intridea/omniauth'
+ gem.name = 'omniauth'
gem.require_paths = ['lib']
- gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
+ gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6')
+ gem.summary = %q{Rack middleware for standardized multi-provider authentication.}
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ gem.version = OmniAuth::Version::STRING
end