omniauth 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of omniauth might be problematic. Click here for more details.

Files changed (55) hide show
  1. data/.gitignore +49 -29
  2. data/.travis.yml +2 -0
  3. data/Gemfile +4 -0
  4. data/{LICENSE → LICENSE.md} +1 -1
  5. data/{README.markdown → README.md} +11 -5
  6. data/Rakefile +2 -1
  7. data/lib/omniauth/version.rb +1 -1
  8. data/oa-basic/Gemfile +7 -0
  9. data/oa-basic/lib/omniauth/version.rb +1 -1
  10. data/oa-basic/oa-basic.gemspec +1 -2
  11. data/oa-core/Gemfile +3 -0
  12. data/oa-core/lib/omniauth/form.rb +5 -3
  13. data/oa-core/lib/omniauth/strategy.rb +5 -5
  14. data/oa-core/lib/omniauth/version.rb +1 -1
  15. data/oa-core/oa-core.gemspec +1 -1
  16. data/oa-core/spec/omniauth/strategy_spec.rb +5 -0
  17. data/oa-enterprise/Gemfile +7 -0
  18. data/oa-enterprise/lib/omniauth/strategies/cas/service_ticket_validator.rb +13 -6
  19. data/oa-enterprise/lib/omniauth/version.rb +1 -1
  20. data/oa-enterprise/oa-enterprise.gemspec +1 -2
  21. data/oa-enterprise/spec/omniauth/strategies/ldap_spec.rb +41 -0
  22. data/oa-more/Gemfile +7 -0
  23. data/oa-more/lib/omniauth/more.rb +2 -0
  24. data/oa-more/lib/omniauth/strategies/draugiem.rb +104 -0
  25. data/oa-more/lib/omniauth/strategies/ign.rb +93 -0
  26. data/oa-more/lib/omniauth/strategies/yupoo.rb +8 -8
  27. data/oa-more/lib/omniauth/version.rb +1 -1
  28. data/oa-more/oa-more.gemspec +1 -2
  29. data/oa-more/spec/omniauth/strategies/draugiem_spec.rb +51 -0
  30. data/oa-more/spec/spec_helper.rb +1 -1
  31. data/oa-oauth/Gemfile +7 -0
  32. data/oa-oauth/lib/omniauth/oauth.rb +3 -0
  33. data/oa-oauth/lib/omniauth/strategies/facebook.rb +1 -1
  34. data/oa-oauth/lib/omniauth/strategies/google.rb +2 -2
  35. data/oa-oauth/lib/omniauth/strategies/gowalla.rb +9 -1
  36. data/oa-oauth/lib/omniauth/strategies/linked_in.rb +17 -16
  37. data/oa-oauth/lib/omniauth/strategies/mailru.rb +107 -0
  38. data/oa-oauth/lib/omniauth/strategies/oauth.rb +2 -4
  39. data/oa-oauth/lib/omniauth/strategies/oauth2.rb +5 -12
  40. data/oa-oauth/lib/omniauth/strategies/plurk.rb +58 -0
  41. data/oa-oauth/lib/omniauth/strategies/taobao.rb +79 -0
  42. data/oa-oauth/lib/omniauth/strategies/vkontakte.rb +7 -4
  43. data/oa-oauth/lib/omniauth/version.rb +1 -1
  44. data/oa-oauth/oa-oauth.gemspec +1 -2
  45. data/oa-oauth/spec/omniauth/strategies/mailru_spec.rb +5 -0
  46. data/oa-oauth/spec/omniauth/strategies/plurk_spec.rb +5 -0
  47. data/oa-oauth/spec/omniauth/strategies/taobao_spec.rb +5 -0
  48. data/oa-openid/Gemfile +7 -0
  49. data/oa-openid/lib/omniauth/openid.rb +1 -0
  50. data/oa-openid/lib/omniauth/strategies/steam.rb +55 -0
  51. data/oa-openid/lib/omniauth/version.rb +1 -1
  52. data/oa-openid/oa-openid.gemspec +1 -2
  53. data/omniauth.gemspec +8 -8
  54. data/tasks/all.rb +1 -1
  55. metadata +34 -18
data/.gitignore CHANGED
@@ -1,36 +1,56 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- /live
5
- .rvmrc
6
-
7
- dist/*
8
-
9
- ## TEXTMATE
1
+ !.autotest
2
+ !.document
3
+ !.gemtest
4
+ !.gitignore
5
+ !.rspec
6
+ !.yardopts
7
+ *.gem
8
+ *.rbc
9
+ *.sw[a-z]
10
10
  *.tmproj
11
- tmtags
12
-
13
- ## EMACS
11
+ *.tmproject
12
+ *.un~
14
13
  *~
15
- \#*
14
+ .*
15
+ .DS_Store
16
+ .Spotlight-V100
17
+ .Trashes
16
18
  .\#*
17
-
18
- ## VIM
19
- *.swp
20
-
21
- ## PROJECT::GENERAL
22
- coverage
23
- rdoc
24
- pkg
25
- tmp
26
- oa-live
27
-
28
- ## PROJECT::SPECIFIC
29
- *.gem
19
+ ._*
30
20
  .bundle
31
- .project
21
+ .config
22
+ .directory
23
+ .elc
32
24
  .loadpath
25
+ .project
26
+ .redcar
27
+ .rvmrc
33
28
  .yardoc
34
- doc
35
-
29
+ /.emacs.desktop
30
+ /.emacs.desktop.lock
31
+ /live
32
+ Desktop.ini
36
33
  Gemfile.lock
34
+ Icon?
35
+ InstalledFiles
36
+ Session.vim
37
+ Thumbs.db
38
+ \#*
39
+ \#*\#
40
+ _yardoc
41
+ auto-save-list
42
+ coverage
43
+ dist/*
44
+ doc
45
+ doc/
46
+ lib/bundler/man
47
+ oa-live
48
+ pkg
49
+ pkg/*
50
+ rdoc
51
+ spec/reports
52
+ test/tmp
53
+ test/version_tmp
54
+ tmp
55
+ tmtags
56
+ tramp
@@ -3,5 +3,7 @@ rvm:
3
3
  - 1.8.7
4
4
  - 1.9.1
5
5
  - 1.9.2
6
+ - jruby
6
7
  - rbx
7
8
  - ree
9
+ - ruby-head
data/Gemfile CHANGED
@@ -1,5 +1,9 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
+ platforms :jruby do
4
+ gem 'jruby-openssl', '~> 0.7'
5
+ end
6
+
3
7
  gemspec :path => 'oa-basic'
4
8
  gemspec :path => 'oa-core'
5
9
  gemspec :path => 'oa-enterprise'
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
1
+ Copyright (c) 2010-2011 Michael Bleigh, Erik Michaels-Ober, and Intridea, Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -11,6 +11,9 @@ To install OmniAuth, simply install the gem:
11
11
 
12
12
  gem install omniauth
13
13
 
14
+ ## Continuous Integration
15
+ [![Build Status](http://travis-ci.org/intridea/omniauth.png)](http://travis-ci.org/intridea/omniauth)
16
+
14
17
  ## Providers
15
18
 
16
19
  OmniAuth currently supports the following external providers:
@@ -33,17 +36,20 @@ OmniAuth currently supports the following external providers:
33
36
  * Instagram (credit: [kiyoshi](https://github.com/kiyoshi))
34
37
  * Instapaper (credit: [micpringle](https://github.com/micpringle))
35
38
  * LinkedIn (credit: [mbleigh](https://github.com/mbleigh))
39
+ * Mailru (credit: [lexer](https://github.com/lexer))
36
40
  * Meetup (credit [coderoshi](https://github.com/coderoshi))
37
41
  * Miso (credit: [rickenharp](https://github.com/rickenharp))
38
42
  * Mixi (credit: [kiyoshi](https://github.com/kiyoshi))
39
43
  * Netflix (credit: [caged](https://github.com/caged))
44
+ * Plurk (credit: [albb0920](http://github.com/albb0920))
40
45
  * Qzone (credit: [quake](https://github.com/quake))
41
- * Rdio (via [brandonweiss](http://github.com/brandonweiss))
46
+ * Rdio (via [brandonweiss](https://github.com/brandonweiss))
42
47
  * Renren (credit: [quake](https://github.com/quake))
43
48
  * Salesforce (via [CloudSpokes](http://www.cloudspokes.com))
44
49
  * SmugMug (credit: [pchilton](https://github.com/pchilton))
45
50
  * SoundCloud (credit: [leemartin](https://github.com/leemartin))
46
51
  * T163 (credit: [quake](https://github.com/quake))
52
+ * Taobao (credit: [l4u](https://github.com/l4u))
47
53
  * TeamBox (credit [jrom](https://github.com/jrom))
48
54
  * Tqq (credit: [quake](https://github.com/quake))
49
55
  * TradeMe (credit: [pchilton](https://github.com/pchilton))
@@ -103,12 +109,12 @@ The `user_info` hash will automatically be populated with as much information ab
103
109
 
104
110
  ## Resources
105
111
 
106
- 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:
112
+ 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:
107
113
 
108
114
  * [CI Build Status](http://travis-ci.org/#!/intridea/omniauth)
109
- * [Roadmap](http://github.com/intridea/omniauth/wiki/Roadmap)
110
- * [Changelog](http://github.com/intridea/omniauth/wiki/Changelog)
111
- * [Report Issues](http://github.com/intridea/omniauth/issues)
115
+ * [Roadmap](https://github.com/intridea/omniauth/wiki/Roadmap)
116
+ * [Changelog](https://github.com/intridea/omniauth/wiki/Changelog)
117
+ * [Report Issues](https://github.com/intridea/omniauth/issues)
112
118
  * [Mailing List](http://groups.google.com/group/omniauth)
113
119
 
114
120
  ## OmniAuth Core
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env rake
2
+
1
3
  $:.unshift File.expand_path('..', __FILE__)
2
4
  require 'tasks/all'
3
5
 
@@ -47,4 +49,3 @@ namespace :doc do
47
49
  task.files = PROJECTS.map{|project| "#{root}/#{project}/lib/**/*.rb"} + ['README.markdown', 'LICENSE']
48
50
  end
49
51
  end
50
-
@@ -7,7 +7,7 @@ module OmniAuth
7
7
  MINOR = 2
8
8
  end
9
9
  unless defined?(::OmniAuth::Version::PATCH)
10
- PATCH = 5
10
+ PATCH = 6
11
11
  end
12
12
  unless defined?(::OmniAuth::Version::PRE)
13
13
  PRE = nil
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ platforms :jruby do
4
+ gem 'jruby-openssl', '~> 0.7'
5
+ end
6
+
7
+ gemspec
@@ -7,7 +7,7 @@ module OmniAuth
7
7
  MINOR = 2
8
8
  end
9
9
  unless defined?(::OmniAuth::Version::PATCH)
10
- PATCH = 5
10
+ PATCH = 6
11
11
  end
12
12
  unless defined?(::OmniAuth::Version::PRE)
13
13
  PRE = nil
@@ -3,7 +3,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
6
- gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
7
6
  gem.add_runtime_dependency 'rest-client', '~> 1.6.0'
8
7
  gem.add_development_dependency 'maruku', '~> 0.6'
9
8
  gem.add_development_dependency 'simplecov', '~> 0.4'
@@ -11,7 +10,7 @@ Gem::Specification.new do |gem|
11
10
  gem.add_development_dependency 'rake', '~> 0.8'
12
11
  gem.add_development_dependency 'rspec', '~> 2.5'
13
12
  gem.add_development_dependency 'webmock', '~> 1.6'
14
- gem.add_development_dependency 'yard', '~> 0.6'
13
+ gem.add_development_dependency 'yard', '~> 0.7'
15
14
  gem.add_development_dependency 'ZenTest', '~> 4.5'
16
15
  gem.name = 'oa-basic'
17
16
  gem.version = OmniAuth::Version::STRING
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
@@ -90,13 +90,14 @@ module OmniAuth
90
90
 
91
91
  def initialize(options = {})
92
92
  options[:title] ||= "Authentication Info Required"
93
+ options[:header_info] ||= ""
93
94
  self.options = options
94
95
 
95
96
  @html = ""
96
- header(options[:title])
97
+ header(options[:title],options[:header_info])
97
98
  end
98
99
 
99
- def self.build(title=nil, &block)
100
+ def self.build(title=nil,&block)
100
101
  form = OmniAuth::Form.new(title)
101
102
  form.instance_eval(&block)
102
103
  end
@@ -138,13 +139,14 @@ module OmniAuth
138
139
  self
139
140
  end
140
141
 
141
- def header(title)
142
+ def header(title,header_info)
142
143
  @html << <<-HTML
143
144
  <!DOCTYPE html>
144
145
  <html>
145
146
  <head>
146
147
  <title>#{title}</title>
147
148
  #{css}
149
+ #{header_info}
148
150
  </head>
149
151
  <body>
150
152
  <h1>#{title}</h1>
@@ -3,7 +3,7 @@ require 'omniauth/core'
3
3
  module OmniAuth
4
4
  class NoSessionError < StandardError; end
5
5
  # The Strategy is the base unit of OmniAuth's ability to
6
- # wrangle multiple providers. Each strategy provided by
6
+ # wrangle multiple providers. Each strategy provided by
7
7
  # OmniAuth includes this mixin to gain the default functionality
8
8
  # necessary to be compatible with the OmniAuth library.
9
9
  module Strategy
@@ -41,9 +41,9 @@ module OmniAuth
41
41
  return request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
42
42
  return callback_call if on_callback_path?
43
43
  return other_phase if respond_to?(:other_phase)
44
- @app.call(env)
44
+ @app.call(env)
45
45
  end
46
-
46
+
47
47
  # Performs the steps necessary to run the request phase of a strategy.
48
48
  def request_call
49
49
  setup_phase
@@ -81,7 +81,7 @@ module OmniAuth
81
81
  end
82
82
 
83
83
  def mock_call!(env)
84
- return mock_request_call if on_request_path?
84
+ return mock_request_call if on_request_path?
85
85
  return mock_callback_call if on_callback_path?
86
86
  call_app!
87
87
  end
@@ -95,7 +95,7 @@ module OmniAuth
95
95
  elsif env['HTTP_REFERER'] && !env['HTTP_REFERER'].match(/#{request_path}$/)
96
96
  @env['rack.session']['omniauth.origin'] = env['HTTP_REFERER']
97
97
  end
98
- redirect(callback_path)
98
+ redirect(script_name + callback_path)
99
99
  end
100
100
 
101
101
  def mock_callback_call
@@ -7,7 +7,7 @@ module OmniAuth
7
7
  MINOR = 2
8
8
  end
9
9
  unless defined?(::OmniAuth::Version::PATCH)
10
- PATCH = 5
10
+ PATCH = 6
11
11
  end
12
12
  unless defined?(::OmniAuth::Version::PRE)
13
13
  PRE = nil
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.add_development_dependency 'rack-test', '~> 0.5'
8
8
  gem.add_development_dependency 'rake', '~> 0.8'
9
9
  gem.add_development_dependency 'rspec', '~> 2.5'
10
- gem.add_development_dependency 'yard', '~> 0.6'
10
+ gem.add_development_dependency 'yard', '~> 0.7'
11
11
  gem.add_development_dependency 'ZenTest', '~> 4.5'
12
12
  gem.name = 'oa-core'
13
13
  gem.version = OmniAuth::Version::STRING
@@ -258,6 +258,11 @@ describe OmniAuth::Strategy do
258
258
  strategy.call(make_env('/AUTH/Test'))[0].should == 302
259
259
  end
260
260
 
261
+ it 'should respect SCRIPT_NAME (a.k.a. BaseURI)' do
262
+ response = strategy.call(make_env('/auth/test', 'SCRIPT_NAME' => '/sub_uri'))
263
+ response[1]['Location'].should == '/sub_uri/auth/test/callback'
264
+ end
265
+
261
266
  it 'should be case insensitive on callback path' do
262
267
  strategy.call(make_env('/AUTH/TeSt/CaLlBAck')).should == strategy.call(make_env('/auth/test/callback'))
263
268
  end
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ platforms :jruby do
4
+ gem 'jruby-openssl', '~> 0.7'
5
+ end
6
+
7
+ gemspec
@@ -38,14 +38,21 @@ module OmniAuth
38
38
  # returns nil if given nil
39
39
  def parse_user_info(node)
40
40
  return nil if node.nil?
41
- node.children.inject({}) do |hash, child|
42
- unless child.kind_of?(Nokogiri::XML::Text) ||
43
- child.name == 'cas:proxies' ||
44
- child.name == 'proxies'
45
- hash[child.name.sub(/^cas:/, '')] = child.content
41
+ hash = {}
42
+ node.children.each do |e|
43
+ unless e.kind_of?(Nokogiri::XML::Text) ||
44
+ e.name == 'cas:proxies' ||
45
+ e.name == 'proxies'
46
+ # There are no child elements
47
+ if e.element_children.count == 0
48
+ hash[e.name.sub(/^cas:/, '')] = e.content
49
+ elsif e.element_children.count
50
+ hash[e.name.sub(/^cas:/, '')] = [] if hash[e.name.sub(/^cas:/, '')].nil?
51
+ hash[e.name.sub(/^cas:/, '')].push parse_user_info e
52
+ end
46
53
  end
47
- hash
48
54
  end
55
+ hash
49
56
  end
50
57
 
51
58
  # finds an `<cas:authenticationSuccess>` node in
@@ -7,7 +7,7 @@ module OmniAuth
7
7
  MINOR = 2
8
8
  end
9
9
  unless defined?(::OmniAuth::Version::PATCH)
10
- PATCH = 5
10
+ PATCH = 6
11
11
  end
12
12
  unless defined?(::OmniAuth::Version::PRE)
13
13
  PRE = nil
@@ -3,7 +3,6 @@ require File.expand_path('../lib/omniauth/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.add_runtime_dependency 'addressable', '2.2.4'
6
- gem.add_runtime_dependency 'jruby-openssl', '~> 0.7.3' if RUBY_PLATFORM == 'java'
7
6
  gem.add_runtime_dependency 'nokogiri', '~> 1.4.2'
8
7
  gem.add_runtime_dependency 'net-ldap', '~> 0.2.2'
9
8
  gem.add_runtime_dependency 'oa-core', OmniAuth::Version::STRING
@@ -15,7 +14,7 @@ Gem::Specification.new do |gem|
15
14
  gem.add_development_dependency 'rake', '~> 0.8'
16
15
  gem.add_development_dependency 'rspec', '~> 2.5'
17
16
  gem.add_development_dependency 'webmock', '~> 1.6'
18
- gem.add_development_dependency 'yard', '~> 0.6'
17
+ gem.add_development_dependency 'yard', '~> 0.7'
19
18
  gem.add_development_dependency 'ZenTest', '~> 4.5'
20
19
  gem.name = 'oa-enterprise'
21
20
  gem.version = OmniAuth::Version::STRING
@@ -0,0 +1,41 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+ require 'cgi'
3
+
4
+ describe OmniAuth::Strategies::LDAP, :type => :strategy do
5
+
6
+ include OmniAuth::Test::StrategyTestCase
7
+
8
+ def strategy
9
+ @ldap_server ||= 'ldap.example.org'
10
+ [OmniAuth::Strategies::LDAP, {
11
+ :host => @ldap_server,
12
+ :port => 636,
13
+ :method => :ssl,
14
+ :uid => 'jeremyf',
15
+ :base => 'o="University of OmniAuth", st=Sublime, c=RubyNation',
16
+ }]
17
+ end
18
+
19
+ describe 'GET /auth/ldap' do
20
+ before do
21
+ get '/auth/ldap'
22
+ end
23
+
24
+ # TODO: Add checks that page has authentication form; I attempted
25
+ # to use `should have_tag` but that was not working.
26
+ it 'should get authentication page' do
27
+ last_response.status.should == 200
28
+ end
29
+ end
30
+
31
+ describe 'POST /auth/ldap' do
32
+ before do
33
+ post '/auth/ldap', {:username => 'jeremy', :password => 'valid_password' }
34
+ end
35
+
36
+ it 'should redirect us to /auth/ldap/callback' do
37
+ last_response.should be_redirect
38
+ last_response.location.should == '/auth/ldap/callback'
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ platforms :jruby do
4
+ gem 'jruby-openssl', '~> 0.7'
5
+ end
6
+
7
+ gemspec
@@ -5,5 +5,7 @@ module OmniAuth
5
5
  autoload :WindowsLive, 'omniauth/strategies/windows_live'
6
6
  autoload :Flickr, 'omniauth/strategies/flickr'
7
7
  autoload :Yupoo, 'omniauth/strategies/yupoo'
8
+ autoload :Ign, 'omniauth/strategies/ign'
9
+ autoload :Draugiem, 'omniauth/strategies/draugiem'
8
10
  end
9
11
  end