omniauth 1.0.0 → 1.0.1

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.

data/.rspec CHANGED
@@ -1,2 +1 @@
1
1
  --color
2
- --format=progress
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  rvm:
2
2
  - 1.8.7
3
- - ree
4
3
  - 1.9.2
5
4
  - 1.9.3
6
5
  - jruby
7
- - rbx-18mode
8
- # - rbx-19mode
6
+ - rbx
7
+ - rbx-2.0
8
+ - ree
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # OmniAuth: Standardized Multi-Provider Authentication
2
2
 
3
+ **OmniAuth 1.0 has several breaking changes from version 0.x. You can set
4
+ the dependency to `~> 0.3.2` if you do not wish to make the more difficult
5
+ upgrade. See [the wiki](https://github.com/intridea/omniauth/wiki/Upgrading-to-1.0)
6
+ for more information.**
7
+
3
8
  ## An Introduction
4
9
 
5
10
  OmniAuth is a libary that standardizes multi-provider authentication for
@@ -26,13 +31,15 @@ it the same way that you use any other Rack middleware. For example, to
26
31
  use the built-in Developer strategy in a Sinatra application I might do
27
32
  this:
28
33
 
29
- require 'sinatra'
30
- require 'omniauth'
34
+ ```ruby
35
+ require 'sinatra'
36
+ require 'omniauth'
31
37
 
32
- class MyApplication < Sinatra::Base
33
- use Rack::Session
34
- use OmniAuth::Strategies::Developer
35
- end
38
+ class MyApplication < Sinatra::Base
39
+ use Rack::Session
40
+ use OmniAuth::Strategies::Developer
41
+ end
42
+ ```
36
43
 
37
44
  Because OmniAuth is built for *multi-provider* authentication, I may
38
45
  want to leave room to run multiple strategies. For this, the built-in
@@ -42,10 +49,12 @@ code and using each strategy individually as middleware. This is an
42
49
  example that you might put into a Rails initializer at
43
50
  `config/initializers/omniauth.rb`:
44
51
 
45
- Rails.application.config.middleware.use OmniAuth::Builder do
46
- provider :developer unless Rails.env.production?
47
- provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
48
- end
52
+ ```ruby
53
+ Rails.application.config.middleware.use OmniAuth::Builder do
54
+ provider :developer unless Rails.env.production?
55
+ provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
56
+ end
57
+ ```
49
58
 
50
59
  You should look to the documentation for each provider you use for
51
60
  specific initialization requirements.
@@ -73,24 +82,28 @@ application that matches to the callback URL and then performs whatever
73
82
  steps are necessary for your application. For example, in a Rails app I
74
83
  would add a line in my `routes.rb` file like this:
75
84
 
76
- match '/auth/:provider/callback', to: 'sessions#create'
85
+ ```ruby
86
+ match '/auth/:provider/callback', to: 'sessions#create'
87
+ ```
77
88
 
78
89
  And I might then have a `SessionsController` with code that looks
79
90
  something like this:
80
91
 
81
- class SessionsController < ApplicationController
82
- def create
83
- @user = User.find_or_create_from_auth_hash(auth_hash)
84
- self.current_user = @user
85
- redirect_to '/'
86
- end
92
+ ```ruby
93
+ class SessionsController < ApplicationController
94
+ def create
95
+ @user = User.find_or_create_from_auth_hash(auth_hash)
96
+ self.current_user = @user
97
+ redirect_to '/'
98
+ end
87
99
 
88
- protected
100
+ protected
89
101
 
90
- def auth_hash
91
- request.env['omniauth.auth']
92
- end
93
- end
102
+ def auth_hash
103
+ request.env['omniauth.auth']
104
+ end
105
+ end
106
+ ```
94
107
 
95
108
  The `omniauth.auth` key in the environment hash gives me my
96
109
  Authentication Hash which will contain information about the just
@@ -116,8 +129,7 @@ OmniAuth, how it works, and how to use it.
116
129
  OmniAuth is tested under 1.8.7, 1.9.2, 1.9.3, JRuby, Rubinius (1.8
117
130
  mode), and Ruby Enterprise Edition.
118
131
 
119
- [![CI Build
120
- Status](https://secure.travis-ci.org/intridea/omniauth.png)](http://travis-ci.org/intridea/omniauth)
132
+ [![CI Build Status](https://secure.travis-ci.org/intridea/omniauth.png)](http://travis-ci.org/intridea/omniauth)
121
133
 
122
134
 
123
135
  ## License
data/lib/omniauth.rb CHANGED
@@ -34,7 +34,9 @@ module OmniAuth
34
34
  :default => {
35
35
  'provider' => 'default',
36
36
  'uid' => '1234',
37
- 'name' => 'Bob Example'
37
+ 'info' => {
38
+ 'name' => 'Bob Example'
39
+ }
38
40
  }
39
41
  }
40
42
  }
@@ -19,7 +19,11 @@ module OmniAuth
19
19
  if klass.is_a?(Class)
20
20
  middleware = klass
21
21
  else
22
- middleware = OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(klass.to_s)}")
22
+ begin
23
+ middleware = OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(klass.to_s)}")
24
+ rescue NameError
25
+ raise LoadError, "Could not find matching strategy for #{klass.inspect}. You may need to install an additional gem (such as omniauth-#{klass})."
26
+ end
23
27
  end
24
28
 
25
29
  use middleware, *args, &block
@@ -177,6 +177,10 @@ module OmniAuth
177
177
  # Performs the steps necessary to run the request phase of a strategy.
178
178
  def request_call
179
179
  setup_phase
180
+
181
+ #store query params from the request url, extracted in the callback_phase
182
+ session['omniauth.params'] = request.params
183
+
180
184
  if options.form.respond_to?(:call)
181
185
  options.form.call(env)
182
186
  elsif options.form
@@ -196,7 +200,7 @@ module OmniAuth
196
200
  setup_phase
197
201
  @env['omniauth.origin'] = session.delete('omniauth.origin')
198
202
  @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
199
- @env['omniauth.params'] = session.delete('query_params') || {}
203
+ @env['omniauth.params'] = session.delete('omniauth.params') || {}
200
204
  callback_phase
201
205
  end
202
206
 
@@ -250,6 +254,7 @@ module OmniAuth
250
254
  fail!(mocked_auth)
251
255
  else
252
256
  @env['omniauth.auth'] = mocked_auth
257
+ @env['omniauth.params'] = session.delete('query_params') || {}
253
258
  @env['omniauth.origin'] = session.delete('omniauth.origin')
254
259
  @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
255
260
  call_app!
@@ -1,3 +1,3 @@
1
1
  module OmniAuth
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -16,5 +16,13 @@ describe OmniAuth::Builder do
16
16
  provider ::ExampleClass
17
17
  end }.should_not raise_error
18
18
  end
19
+
20
+ it "should raise a helpful LoadError messgae if it can't find the class" do
21
+ expect {
22
+ OmniAuth::Builder.new(nil) do
23
+ provider :lorax
24
+ end
25
+ }.to raise_error(LoadError, "Could not find matching strategy for :lorax. You may need to install an additional gem (such as omniauth-lorax).")
26
+ end
19
27
  end
20
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-11-02 00:00:00.000000000Z
13
+ date: 2011-11-25 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
17
- requirement: &70252345407440 !ruby/object:Gem::Requirement
17
+ requirement: &70297966785140 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70252345407440
25
+ version_requirements: *70297966785140
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: hashie
28
- requirement: &70252345405080 !ruby/object:Gem::Requirement
28
+ requirement: &70297966784640 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '1.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70252345405080
36
+ version_requirements: *70297966784640
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: maruku
39
- requirement: &70252345401000 !ruby/object:Gem::Requirement
39
+ requirement: &70297966784140 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0.6'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70252345401000
47
+ version_requirements: *70297966784140
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: simplecov
50
- requirement: &70252345398880 !ruby/object:Gem::Requirement
50
+ requirement: &70297966783680 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0.4'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70252345398880
58
+ version_requirements: *70297966783680
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rack-test
61
- requirement: &70252345396500 !ruby/object:Gem::Requirement
61
+ requirement: &70297966783220 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0.5'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70252345396500
69
+ version_requirements: *70297966783220
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rake
72
- requirement: &70252345388780 !ruby/object:Gem::Requirement
72
+ requirement: &70297966782760 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0.8'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70252345388780
80
+ version_requirements: *70297966782760
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rdiscount
83
- requirement: &70252345387020 !ruby/object:Gem::Requirement
83
+ requirement: &70297966782300 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '1.6'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70252345387020
91
+ version_requirements: *70297966782300
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: rspec
94
- requirement: &70252345384400 !ruby/object:Gem::Requirement
94
+ requirement: &70297966781840 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '2.7'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *70252345384400
102
+ version_requirements: *70297966781840
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: yard
105
- requirement: &70252345382060 !ruby/object:Gem::Requirement
105
+ requirement: &70297966781380 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
@@ -110,7 +110,7 @@ dependencies:
110
110
  version: '0.7'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *70252345382060
113
+ version_requirements: *70297966781380
114
114
  description: A generalized Rack framework for multiple-provider authentication.
115
115
  email:
116
116
  - michael@intridea.com