omniauth 1.5.0 → 1.6.0

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adaedd6ed510684435163428545cd3da3a722155
4
- data.tar.gz: a4f2b288d6d829ff75bc1a64a5fbe89f06f4140b
3
+ metadata.gz: 3cccf2cece86480c5d9904baf73c1425b186bb48
4
+ data.tar.gz: be26db1136cc2fa234b6599525328d7f4ee052a2
5
5
  SHA512:
6
- metadata.gz: 7e237d3b7d874036ab193edba6ca29c8575310c0d1e8472ceaf4350272c9e2cf18f275c4809c44b82a0d824a6ad186a9bc6e6ba34259d591040b769c4b774e49
7
- data.tar.gz: f7990c9e91a5c082d8178f7483c172cc19b812c4c5ec4c1655cc869adcd25a3ee504c7acc46b0508ce80b3ca17f17959d9315970353a0a48220a67b9ff5962c1
6
+ metadata.gz: 75d6812700ed6fb651401d0233b64c1394e94688299dbe826592514e3c4713fd6ea1df17ba7395330fb01865894eb1393de1c0453854d7898928085a504ba4e5
7
+ data.tar.gz: 20c23e7f2ef3c67898a3bb313ded1919f16a32eb34872601c852321405f48658b1f311ad9ac20a607a93e70f63080ca1b20f21d75995784655abd64007831054
@@ -0,0 +1,20 @@
1
+ Please complete all sections.
2
+
3
+ ### Configuration
4
+
5
+ - Provider Gem: `omniauth-*`
6
+ - Ruby Version: ``
7
+ - Framework: ``
8
+ - Platform: ``
9
+
10
+ ### Expected Behavior
11
+
12
+ Tell us what should happen.
13
+
14
+ ### Actual Behavior
15
+
16
+ Tell us what happens instead.
17
+
18
+ ### Steps to Reproduce
19
+
20
+ Please list all steps to reproduce the issue.
data/Gemfile CHANGED
@@ -5,12 +5,15 @@ gem 'rake', '>= 12.0'
5
5
  gem 'yard', '>= 0.9'
6
6
 
7
7
  group :development do
8
+ gem 'benchmark-ips'
8
9
  gem 'kramdown'
10
+ gem 'memory_profiler'
9
11
  gem 'pry'
10
12
  end
11
13
 
12
14
  group :test do
13
- gem 'hashie', '~> 3.5.0', :platforms => [:jruby_18]
15
+ gem 'coveralls', :require => false
16
+ gem 'hashie', '>= 3.4.6', '< 3.6.0', :platforms => [:jruby_18]
14
17
  gem 'json', '~> 2.0.3', :platforms => [:jruby_18, :jruby_19, :ruby_19]
15
18
  gem 'mime-types', '~> 3.1', :platforms => [:jruby_18]
16
19
  gem 'rack', '>= 1.6.2', :platforms => [:jruby_18, :jruby_19, :ruby_19, :ruby_20, :ruby_21]
data/README.md CHANGED
@@ -13,11 +13,6 @@
13
13
  [codeclimate]: https://codeclimate.com/github/omniauth/omniauth
14
14
  [coveralls]: https://coveralls.io/r/omniauth/omniauth
15
15
 
16
- **OmniAuth 1.0 has several breaking changes from version 0.x. You can set
17
- the dependency to `~> 0.3.2` if you do not wish to make the more difficult
18
- upgrade. See [the wiki](https://github.com/omniauth/omniauth/wiki/Upgrading-to-1.0)
19
- for more information.**
20
-
21
16
  ## An Introduction
22
17
  OmniAuth is a library that standardizes multi-provider authentication for
23
18
  web applications. It was created to be powerful, flexible, and do as
@@ -143,7 +138,7 @@ your first stop if you are wondering about a more in-depth look at
143
138
  OmniAuth, how it works, and how to use it.
144
139
 
145
140
  ## Supported Ruby Versions
146
- OmniAuth is tested under 1.9.3, 2.0.0, 2.1.10, 2.2.5, 2.3.1, and JRuby.
141
+ OmniAuth is tested under 2.1.10, 2.2.6, 2.3.3, 2.4.0, and JRuby.
147
142
 
148
143
  ## Versioning
149
144
  This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
data/Rakefile CHANGED
@@ -15,3 +15,38 @@ rescue LoadError
15
15
  end
16
16
 
17
17
  task :default => [:spec, :rubocop]
18
+
19
+ namespace :perf do
20
+ task :setup do
21
+ require 'omniauth'
22
+ require 'rack/test'
23
+ app = Rack::Builder.new do |b|
24
+ b.use Rack::Session::Cookie, :secret => 'abc123'
25
+ b.use OmniAuth::Strategies::Developer
26
+ b.run lambda { |_env| [200, {}, ['Not Found']] }
27
+ end.to_app
28
+ @app = Rack::MockRequest.new(app)
29
+
30
+ def call_app(path = ENV['GET_PATH'] || '/')
31
+ result = @app.get(path)
32
+ raise "Did not succeed #{result.body}" unless result.status == 200
33
+ result
34
+ end
35
+ end
36
+
37
+ task :ips => :setup do
38
+ require 'benchmark/ips'
39
+ Benchmark.ips do |x|
40
+ x.report('ips') { call_app }
41
+ end
42
+ end
43
+
44
+ task :mem => :setup do
45
+ require 'memory_profiler'
46
+ num = Integer(ENV['CNT'] || 1)
47
+ report = MemoryProfiler.report do
48
+ num.times { call_app }
49
+ end
50
+ report.pretty_print
51
+ end
52
+ end
@@ -20,7 +20,7 @@ module OmniAuth
20
20
  end
21
21
 
22
22
  def regular_writer(key, value)
23
- if key.to_s == 'info' && !value.is_a?(InfoHash)
23
+ if key.to_s == 'info' && value.is_a?(::Hash) && !value.is_a?(InfoHash)
24
24
  value = InfoHash.new(value)
25
25
  end
26
26
  super
@@ -21,9 +21,9 @@ module OmniAuth
21
21
  # Returns an inherited set of default options set at the class-level
22
22
  # for each strategy.
23
23
  def default_options
24
- return @default_options if instance_variable_defined?(:@default_options) && @default_options
24
+ # existing = superclass.default_options if superclass.respond_to?(:default_options)
25
25
  existing = superclass.respond_to?(:default_options) ? superclass.default_options : {}
26
- @default_options = OmniAuth::Strategy::Options.new(existing)
26
+ @default_options ||= OmniAuth::Strategy::Options.new(existing)
27
27
  end
28
28
 
29
29
  # This allows for more declarative subclassing of strategies by allowing
@@ -88,9 +88,12 @@ module OmniAuth
88
88
  end
89
89
 
90
90
  %w(uid info extra credentials).each do |fetcher|
91
- class_eval <<-RUBY
91
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
92
+ attr_reader :#{fetcher}_proc
93
+ private :#{fetcher}_proc
94
+
92
95
  def #{fetcher}(&block)
93
- return @#{fetcher}_proc unless block_given?
96
+ return #{fetcher}_proc unless block_given?
94
97
  @#{fetcher}_proc = block
95
98
  end
96
99
 
@@ -132,7 +135,7 @@ module OmniAuth
132
135
  @options = self.class.default_options.dup
133
136
 
134
137
  options.deep_merge!(args.pop) if args.last.is_a?(Hash)
135
- options.name ||= self.class.to_s.split('::').last.downcase
138
+ options[:name] ||= self.class.to_s.split('::').last.downcase
136
139
 
137
140
  self.class.args.each do |arg|
138
141
  break if args.empty?
@@ -199,6 +202,8 @@ module OmniAuth
199
202
  log :info, 'Request phase initiated.'
200
203
  # store query params from the request url, extracted in the callback_phase
201
204
  session['omniauth.params'] = request.GET
205
+ # store query headers from the request url, extracted in the callback_phase
206
+ session['omniauth.headers'] = headers
202
207
  OmniAuth.config.before_request_phase.call(env) if OmniAuth.config.before_request_phase
203
208
  if options.form.respond_to?(:call)
204
209
  log :info, 'Rendering form from supplied Rack endpoint.'
@@ -223,6 +228,7 @@ module OmniAuth
223
228
  @env['omniauth.origin'] = session.delete('omniauth.origin')
224
229
  @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
225
230
  @env['omniauth.params'] = session.delete('omniauth.params') || {}
231
+ @env['omniauth.headers'] = session.delete('omniauth.headers') || {}
226
232
  OmniAuth.config.before_callback_phase.call(@env) if OmniAuth.config.before_callback_phase
227
233
  callback_phase
228
234
  end
@@ -234,8 +240,8 @@ module OmniAuth
234
240
  end
235
241
 
236
242
  def on_request_path?
237
- if options.request_path.respond_to?(:call)
238
- options.request_path.call(env)
243
+ if options[:request_path].respond_to?(:call)
244
+ options[:request_path].call(env)
239
245
  else
240
246
  on_path?(request_path)
241
247
  end
@@ -257,7 +263,7 @@ module OmniAuth
257
263
  # in the event that OmniAuth has been configured to be
258
264
  # in test mode.
259
265
  def mock_call!(*)
260
- return mock_request_call if on_request_path?
266
+ return mock_request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)
261
267
  return mock_callback_call if on_callback_path?
262
268
  call_app!
263
269
  end
@@ -266,6 +272,7 @@ module OmniAuth
266
272
  setup_phase
267
273
 
268
274
  session['omniauth.params'] = request.GET
275
+ session['omniauth.headers'] = headers
269
276
  OmniAuth.config.before_request_phase.call(env) if OmniAuth.config.before_request_phase
270
277
  if request.params['origin']
271
278
  @env['rack.session']['omniauth.origin'] = request.params['origin']
@@ -280,12 +287,14 @@ module OmniAuth
280
287
  setup_phase
281
288
  @env['omniauth.origin'] = session.delete('omniauth.origin')
282
289
  @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
290
+ @env['omniauth.params'] = session.delete('omniauth.params') || {}
291
+ @env['omniauth.headers'] = session.delete('omniauth.headers') || {}
292
+
283
293
  mocked_auth = OmniAuth.mock_auth_for(name.to_s)
284
294
  if mocked_auth.is_a?(Symbol)
285
295
  fail!(mocked_auth)
286
296
  else
287
297
  @env['omniauth.auth'] = mocked_auth
288
- @env['omniauth.params'] = session.delete('omniauth.params') || {}
289
298
  OmniAuth.config.before_callback_phase.call(@env) if OmniAuth.config.before_callback_phase
290
299
  call_app!
291
300
  end
@@ -299,7 +308,7 @@ module OmniAuth
299
308
  if options[:setup].respond_to?(:call)
300
309
  log :info, 'Setup endpoint detected, running now.'
301
310
  options[:setup].call(env)
302
- elsif options.setup?
311
+ elsif options[:setup]
303
312
  log :info, 'Calling through to underlying application for setup.'
304
313
  setup_env = env.merge('PATH_INFO' => setup_path, 'REQUEST_METHOD' => 'GET')
305
314
  call_app!(setup_env)
@@ -440,7 +449,7 @@ module OmniAuth
440
449
  end
441
450
 
442
451
  def name
443
- options.name
452
+ options[:name]
444
453
  end
445
454
 
446
455
  def redirect(uri)
@@ -498,5 +507,10 @@ module OmniAuth
498
507
  (request.env['HTTP_X_FORWARDED_PROTO'] && request.env['HTTP_X_FORWARDED_PROTO'].split(',')[0] == 'https') ||
499
508
  request.env['rack.url_scheme'] == 'https'
500
509
  end
510
+
511
+ def headers
512
+ headers = env.select { |key, _value| key.start_with? 'HTTP_' }
513
+ Hash[headers.map { |key, value| [key.sub(/^HTTP_/, ''), value] }]
514
+ end
501
515
  end
502
516
  end
@@ -10,7 +10,7 @@ module OmniAuth
10
10
  # include OmniAuth::Test::StrategyTestCase
11
11
  # def strategy
12
12
  # # return the parameters to a Rack::Builder map call:
13
- # [MyStrategy.new, :some, :configuration, :options => 'here']
13
+ # [MyStrategy, :some, :configuration, :options => 'here']
14
14
  # end
15
15
  # setup do
16
16
  # post '/auth/my_strategy/callback', :user => { 'name' => 'Dylan', 'id' => '445' }
@@ -1,3 +1,3 @@
1
1
  module OmniAuth
2
- VERSION = '1.5.0'.freeze
2
+ VERSION = '1.6.0'.freeze
3
3
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'omniauth/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.add_dependency 'hashie', ['~> 3.5.0', '< 4']
7
+ spec.add_dependency 'hashie', ['>= 3.4.6', '< 3.6.0']
8
8
  spec.add_dependency 'rack', ['>= 1.6.2', '< 3']
9
9
  spec.add_development_dependency 'bundler', '~> 1.14'
10
10
  spec.add_development_dependency 'rake', '~> 12.0'
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.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -10,28 +10,28 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-02-11 00:00:00.000000000 Z
13
+ date: 2017-02-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hashie
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 3.5.0
21
+ version: 3.4.6
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '4'
24
+ version: 3.6.0
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
- - - "~>"
29
+ - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: 3.5.0
31
+ version: 3.4.6
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '4'
34
+ version: 3.6.0
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rack
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +89,7 @@ executables: []
89
89
  extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
+ - ".github/ISSUE_TEMPLATE.md"
92
93
  - ".gitignore"
93
94
  - ".rspec"
94
95
  - ".rubocop.yml"
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  version: 1.3.5
134
135
  requirements: []
135
136
  rubyforge_project:
136
- rubygems_version: 2.6.4
137
+ rubygems_version: 2.6.10
137
138
  signing_key:
138
139
  specification_version: 4
139
140
  summary: A generalized Rack framework for multiple-provider authentication.