omniauth 1.2.2 → 1.3.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 +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +33 -57
- data/.travis.yml +16 -20
- data/Gemfile +7 -16
- data/Gemfile.rack-1.3.x +8 -13
- data/Gemfile.rack-master +16 -0
- data/README.md +1 -1
- data/lib/omniauth.rb +11 -15
- data/lib/omniauth/auth_hash.rb +1 -1
- data/lib/omniauth/builder.rb +6 -2
- data/lib/omniauth/form.rb +1 -1
- data/lib/omniauth/strategies/developer.rb +1 -1
- data/lib/omniauth/strategy.rb +26 -16
- data/lib/omniauth/version.rb +1 -1
- data/omniauth.gemspec +2 -3
- metadata +13 -24
- data/.gemtest +0 -0
- data/Guardfile +0 -10
- data/spec/helper.rb +0 -55
- data/spec/omniauth/auth_hash_spec.rb +0 -111
- data/spec/omniauth/builder_spec.rb +0 -50
- data/spec/omniauth/failure_endpoint_spec.rb +0 -58
- data/spec/omniauth/form_spec.rb +0 -23
- data/spec/omniauth/strategies/developer_spec.rb +0 -73
- data/spec/omniauth/strategy_spec.rb +0 -768
- data/spec/omniauth_spec.rb +0 -145
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db04fc4ab8d9dba42728ba79989f142dcd82bac6
|
4
|
+
data.tar.gz: 911610ee6a8e350ea53daeffa0f37d4d2a7997b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2de66181c46fc2e4a669606e5335fa21e64a317020847835832b204a5a5e382056c2c6244b02fa91359f0214bbe773f0520371b4fea51a65af3c6e95b3ea043b
|
7
|
+
data.tar.gz: 254628c583eed6e57ccd6e75e029a9686f7470abc1fe08e011f6170dc6f8a80becb5a4c036b0c7e1419197b61e4d9432f72997eb68823a097ea9eb3609ad613f
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,81 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
CountKeywordArgs: true
|
1
|
+
Lint/HandleExceptions:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Metrics/BlockNesting:
|
5
|
+
Max: 2
|
6
|
+
|
7
|
+
Metrics/LineLength:
|
8
|
+
AllowURI: true
|
9
|
+
Enabled: false
|
11
10
|
|
12
|
-
MethodLength:
|
11
|
+
Metrics/MethodLength:
|
13
12
|
CountComments: false
|
14
13
|
Max: 15
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
Metrics/ParameterLists:
|
16
|
+
Max: 4
|
17
|
+
CountKeywordArgs: true
|
18
|
+
|
19
|
+
Metrics/AbcSize:
|
20
|
+
Enabled: false
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
Style/AccessModifierIndentation:
|
23
|
+
EnforcedStyle: outdent
|
24
|
+
|
25
|
+
Style/CollectionMethods:
|
22
26
|
PreferredMethods:
|
23
27
|
map: 'collect'
|
24
28
|
reduce: 'inject'
|
25
29
|
find: 'detect'
|
26
30
|
find_all: 'select'
|
27
31
|
|
28
|
-
|
29
|
-
LineLength:
|
30
|
-
Enabled: false
|
31
|
-
|
32
|
-
# Disable documentation checking until a class needs to be documented once
|
33
|
-
Documentation:
|
32
|
+
Style/Documentation:
|
34
33
|
Enabled: false
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
EnforcedStyle: hash_rockets
|
39
|
-
|
40
|
-
# No spaces inside hash literals
|
41
|
-
SpaceInsideHashLiteralBraces:
|
42
|
-
EnforcedStyle: no_space
|
35
|
+
Style/DotPosition:
|
36
|
+
EnforcedStyle: trailing
|
43
37
|
|
44
|
-
|
45
|
-
DotPosition:
|
38
|
+
Style/DoubleNegation:
|
46
39
|
Enabled: false
|
47
40
|
|
48
|
-
|
49
|
-
Encoding:
|
41
|
+
Style/EachWithObject:
|
50
42
|
Enabled: false
|
51
43
|
|
52
|
-
|
53
|
-
AccessModifierIndentation:
|
54
|
-
EnforcedStyle: outdent
|
55
|
-
|
56
|
-
EmptyLinesAroundAccessModifier:
|
57
|
-
Enabled: true
|
58
|
-
|
59
|
-
# Align ends correctly
|
60
|
-
EndAlignment:
|
61
|
-
AlignWith: variable
|
62
|
-
|
63
|
-
# Indentation of when/else
|
64
|
-
CaseIndentation:
|
65
|
-
IndentWhenRelativeTo: end
|
66
|
-
IndentOneStep: false
|
67
|
-
|
68
|
-
Lambda:
|
44
|
+
Style/Encoding:
|
69
45
|
Enabled: false
|
70
46
|
|
71
|
-
|
47
|
+
Style/HashSyntax:
|
48
|
+
EnforcedStyle: hash_rockets
|
49
|
+
|
50
|
+
Style/Lambda:
|
72
51
|
Enabled: false
|
73
52
|
|
74
|
-
RaiseArgs:
|
53
|
+
Style/RaiseArgs:
|
75
54
|
EnforcedStyle: compact
|
76
55
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
EachWithObject:
|
81
|
-
Enabled: false
|
56
|
+
Style/SpaceInsideHashLiteralBraces:
|
57
|
+
EnforcedStyle: no_space
|
data/.travis.yml
CHANGED
@@ -1,37 +1,33 @@
|
|
1
1
|
bundler_args: --without development
|
2
|
+
before_install: gem install bundler
|
3
|
+
cache: bundler
|
4
|
+
env:
|
5
|
+
global:
|
6
|
+
- JRUBY_OPTS="$JRUBY_OPTS --debug"
|
2
7
|
gemfile:
|
3
8
|
- Gemfile
|
4
9
|
- Gemfile.rack-1.3.x
|
5
10
|
language: ruby
|
6
11
|
rvm:
|
12
|
+
- jruby-18mode
|
13
|
+
- jruby-19mode
|
14
|
+
- jruby-9000
|
7
15
|
- 1.8.7
|
8
|
-
- 1.9.2
|
9
16
|
- 1.9.3
|
10
17
|
- 2.0.0
|
11
|
-
- 2.1
|
18
|
+
- 2.1
|
19
|
+
- 2.2
|
20
|
+
- jruby-head
|
12
21
|
- rbx-2
|
13
22
|
- ruby-head
|
14
23
|
matrix:
|
15
24
|
include:
|
16
|
-
- rvm:
|
17
|
-
|
18
|
-
gemfile: Gemfile
|
19
|
-
- rvm: jruby-18mode
|
20
|
-
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
21
|
-
gemfile: Gemfile.rack-1.3.x
|
22
|
-
- rvm: jruby-19mode
|
23
|
-
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
24
|
-
gemfile: Gemfile
|
25
|
-
- rvm: jruby-19mode
|
26
|
-
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
27
|
-
gemfile: Gemfile.rack-1.3.x
|
28
|
-
- rvm: jruby-head
|
29
|
-
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
30
|
-
gemfile: Gemfile
|
31
|
-
- rvm: jruby-head
|
32
|
-
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
33
|
-
gemfile: Gemfile.rack-1.3.x
|
25
|
+
- rvm: 2.2.2
|
26
|
+
gemfile: Gemfile.rack-master
|
34
27
|
allow_failures:
|
35
28
|
- rvm: jruby-head
|
29
|
+
- rvm: rbx-2
|
36
30
|
- rvm: ruby-head
|
31
|
+
- gemfile: Gemfile.rack-master
|
37
32
|
fast_finish: true
|
33
|
+
sudo: false
|
data/Gemfile
CHANGED
@@ -5,29 +5,20 @@ gem 'rake'
|
|
5
5
|
gem 'yard'
|
6
6
|
|
7
7
|
group :development do
|
8
|
-
gem 'growl'
|
9
|
-
platforms :ruby_19, :ruby_20 do
|
10
|
-
gem 'guard'
|
11
|
-
gem 'guard-bundler'
|
12
|
-
gem 'guard-rspec'
|
13
|
-
end
|
14
8
|
gem 'kramdown'
|
15
|
-
gem 'plymouth', :platforms => [:ruby_19, :ruby_20, :ruby_21]
|
16
9
|
gem 'pry'
|
17
|
-
gem 'pry-debugger', :platforms => [:mri_19, :mri_20]
|
18
|
-
gem 'pry-byebug', :platforms => [:mri_21]
|
19
|
-
gem 'rb-fsevent'
|
20
10
|
end
|
21
11
|
|
22
12
|
group :test do
|
23
|
-
gem 'coveralls'
|
24
|
-
gem '
|
25
|
-
gem '
|
13
|
+
gem 'coveralls'
|
14
|
+
gem 'hashie', '~> 2.0.5', :platforms => [:jruby_18, :ruby_18]
|
15
|
+
gem 'json', '>= 1.8.1', :platforms => [:jruby_18, :jruby_19, :ruby_18, :ruby_19]
|
16
|
+
gem 'mime-types', '~> 1.25', :platforms => [:jruby_18, :ruby_18]
|
26
17
|
gem 'rack-test'
|
27
|
-
gem 'rest-client', '~> 1.6.0', :platforms => [:
|
18
|
+
gem 'rest-client', '~> 1.6.0', :platforms => [:jruby_18, :ruby_18]
|
28
19
|
gem 'rspec', '~> 3.0'
|
29
|
-
gem 'rubocop', '>= 0.
|
30
|
-
gem 'simplecov',
|
20
|
+
gem 'rubocop', '>= 0.25', :platforms => [:ruby_19, :ruby_20, :ruby_21, :ruby_22]
|
21
|
+
gem 'simplecov', '>= 0.9'
|
31
22
|
end
|
32
23
|
|
33
24
|
gemspec
|
data/Gemfile.rack-1.3.x
CHANGED
@@ -6,20 +6,15 @@ gem 'rake'
|
|
6
6
|
gem 'yard'
|
7
7
|
|
8
8
|
group :test do
|
9
|
-
gem 'coveralls'
|
10
|
-
gem '
|
11
|
-
gem '
|
9
|
+
gem 'coveralls'
|
10
|
+
gem 'hashie', '~> 2.0.5', :platforms => [:jruby_18, :ruby_18]
|
11
|
+
gem 'json', '>= 1.8.1', :platforms => [:jruby_18, :jruby_18, :ruby_18, :ruby_19]
|
12
|
+
gem 'mime-types', '~> 1.25', :platforms => [:jruby_18, :ruby_18]
|
12
13
|
gem 'rack-test'
|
13
|
-
gem 'rest-client', '~> 1.6.0', :platforms => [:
|
14
|
-
gem 'rspec', '
|
15
|
-
gem 'rubocop', '>= 0.
|
16
|
-
gem 'simplecov',
|
17
|
-
end
|
18
|
-
|
19
|
-
platforms :rbx do
|
20
|
-
gem 'racc'
|
21
|
-
gem 'rubinius-coverage', '~> 2.0'
|
22
|
-
gem 'rubysl', '~> 2.0'
|
14
|
+
gem 'rest-client', '~> 1.6.0', :platforms => [:jruby_18, :ruby_18]
|
15
|
+
gem 'rspec', '~> 3.0'
|
16
|
+
gem 'rubocop', '>= 0.25', :platforms => [:ruby_19, :ruby_20, :ruby_21]
|
17
|
+
gem 'simplecov', '>= 0.9'
|
23
18
|
end
|
24
19
|
|
25
20
|
gemspec
|
data/Gemfile.rack-master
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'jruby-openssl', :platforms => :jruby
|
4
|
+
gem 'rack', :git => 'https://github.com/rack/rack.git'
|
5
|
+
gem 'rake'
|
6
|
+
gem 'yard'
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
gem 'coveralls'
|
10
|
+
gem 'rack-test'
|
11
|
+
gem 'rspec', '~> 3.0'
|
12
|
+
gem 'rubocop', '>= 0.25'
|
13
|
+
gem 'simplecov', '>= 0.9'
|
14
|
+
end
|
15
|
+
|
16
|
+
gemspec
|
data/README.md
CHANGED
@@ -143,7 +143,7 @@ your first stop if you are wondering about a more in-depth look at
|
|
143
143
|
OmniAuth, how it works, and how to use it.
|
144
144
|
|
145
145
|
## Supported Ruby Versions
|
146
|
-
OmniAuth is tested under 1.8.7, 1.9.
|
146
|
+
OmniAuth is tested under 1.8.7, 1.9.3, 2.0.0, 2.1.0, JRuby, and Rubinius.
|
147
147
|
|
148
148
|
## Versioning
|
149
149
|
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
|
data/lib/omniauth.rb
CHANGED
@@ -82,19 +82,15 @@ module OmniAuth
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
def add_mock(provider,
|
86
|
-
#
|
87
|
-
mock
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
95
|
-
else
|
96
|
-
next
|
97
|
-
end
|
85
|
+
def add_mock(provider, original = {})
|
86
|
+
# Create key-stringified new hash from given auth hash
|
87
|
+
mock = {}
|
88
|
+
original.each_pair do |key, val|
|
89
|
+
mock[key.to_s] = if val.is_a? Hash
|
90
|
+
Hash[val.each_pair { |k, v| [k.to_s, v] }]
|
91
|
+
else
|
92
|
+
val
|
93
|
+
end
|
98
94
|
end
|
99
95
|
|
100
96
|
# Merge with the default mock and ensure provider is correct.
|
@@ -136,7 +132,7 @@ module OmniAuth
|
|
136
132
|
end
|
137
133
|
|
138
134
|
module Utils
|
139
|
-
|
135
|
+
module_function
|
140
136
|
|
141
137
|
def form_css
|
142
138
|
"<style type='text/css'>#{OmniAuth.config.form_css}</style>"
|
@@ -161,7 +157,7 @@ module OmniAuth
|
|
161
157
|
return OmniAuth.config.camelizations[word.to_s] if OmniAuth.config.camelizations[word.to_s]
|
162
158
|
|
163
159
|
if first_letter_in_uppercase
|
164
|
-
word.to_s.gsub(
|
160
|
+
word.to_s.gsub(%r{/(.?)}) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
|
165
161
|
else
|
166
162
|
word.first + camelize(word)[1..-1]
|
167
163
|
end
|
data/lib/omniauth/auth_hash.rb
CHANGED
data/lib/omniauth/builder.rb
CHANGED
@@ -2,7 +2,7 @@ module OmniAuth
|
|
2
2
|
class Builder < ::Rack::Builder
|
3
3
|
def initialize(app, &block)
|
4
4
|
@options = nil
|
5
|
-
if rack14?
|
5
|
+
if rack14? || rack2?
|
6
6
|
super
|
7
7
|
else
|
8
8
|
@app = app
|
@@ -12,7 +12,11 @@ module OmniAuth
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def rack14?
|
15
|
-
Rack.release.split('.')[1].to_i >= 4
|
15
|
+
Rack.release.start_with?('1.') && (Rack.release.split('.')[1].to_i >= 4)
|
16
|
+
end
|
17
|
+
|
18
|
+
def rack2?
|
19
|
+
Rack.release.start_with? '2.'
|
16
20
|
end
|
17
21
|
|
18
22
|
def on_failure(&block)
|
data/lib/omniauth/form.rb
CHANGED
@@ -37,7 +37,7 @@ module OmniAuth
|
|
37
37
|
def request_phase
|
38
38
|
form = OmniAuth::Form.new(:title => 'User Info', :url => callback_path)
|
39
39
|
options.fields.each do |field|
|
40
|
-
form.text_field field.to_s.capitalize.
|
40
|
+
form.text_field field.to_s.capitalize.tr('_', ' '), field.to_s
|
41
41
|
end
|
42
42
|
form.button 'Sign In'
|
43
43
|
form.to_response
|
data/lib/omniauth/strategy.rb
CHANGED
@@ -6,7 +6,7 @@ module OmniAuth
|
|
6
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
|
-
module Strategy
|
9
|
+
module Strategy # rubocop:disable ModuleLength
|
10
10
|
def self.included(base)
|
11
11
|
OmniAuth.strategies << base
|
12
12
|
|
@@ -169,7 +169,7 @@ module OmniAuth
|
|
169
169
|
# the request path is recognized.
|
170
170
|
#
|
171
171
|
# @param env [Hash] The Rack environment.
|
172
|
-
def call!(env) # rubocop:disable CyclomaticComplexity
|
172
|
+
def call!(env) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
|
173
173
|
unless env['rack.session']
|
174
174
|
error = OmniAuth::NoSessionError.new('You must provide a session to use OmniAuth.')
|
175
175
|
fail(error)
|
@@ -194,7 +194,7 @@ module OmniAuth
|
|
194
194
|
end
|
195
195
|
|
196
196
|
# Performs the steps necessary to run the request phase of a strategy.
|
197
|
-
def request_call # rubocop:disable CyclomaticComplexity, MethodLength
|
197
|
+
def request_call # rubocop:disable CyclomaticComplexity, MethodLength, PerceivedComplexity
|
198
198
|
setup_phase
|
199
199
|
log :info, 'Request phase initiated.'
|
200
200
|
# store query params from the request url, extracted in the callback_phase
|
@@ -278,14 +278,14 @@ module OmniAuth
|
|
278
278
|
|
279
279
|
def mock_callback_call
|
280
280
|
setup_phase
|
281
|
+
@env['omniauth.origin'] = session.delete('omniauth.origin')
|
282
|
+
@env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
|
281
283
|
mocked_auth = OmniAuth.mock_auth_for(name.to_s)
|
282
284
|
if mocked_auth.is_a?(Symbol)
|
283
285
|
fail!(mocked_auth)
|
284
286
|
else
|
285
287
|
@env['omniauth.auth'] = mocked_auth
|
286
288
|
@env['omniauth.params'] = session.delete('omniauth.params') || {}
|
287
|
-
@env['omniauth.origin'] = session.delete('omniauth.origin')
|
288
|
-
@env['omniauth.origin'] = nil if env['omniauth.origin'] == ''
|
289
289
|
OmniAuth.config.before_callback_phase.call(@env) if OmniAuth.config.before_callback_phase
|
290
290
|
call_app!
|
291
291
|
end
|
@@ -377,23 +377,27 @@ module OmniAuth
|
|
377
377
|
end
|
378
378
|
|
379
379
|
def request_path
|
380
|
-
options[:request_path].is_a?(String) ? options[:request_path] : "#{path_prefix}/#{name}"
|
380
|
+
@request_path ||= options[:request_path].is_a?(String) ? options[:request_path] : "#{path_prefix}/#{name}"
|
381
381
|
end
|
382
382
|
|
383
383
|
def callback_path
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
384
|
+
@callback_path ||= begin
|
385
|
+
path = options[:callback_path] if options[:callback_path].is_a?(String)
|
386
|
+
path ||= current_path if options[:callback_path].respond_to?(:call) && options[:callback_path].call(env)
|
387
|
+
path ||= custom_path(:request_path)
|
388
|
+
path ||= "#{path_prefix}/#{name}/callback"
|
389
|
+
path
|
390
|
+
end
|
389
391
|
end
|
390
392
|
|
391
393
|
def setup_path
|
392
394
|
options[:setup_path] || "#{path_prefix}/#{name}/setup"
|
393
395
|
end
|
394
396
|
|
397
|
+
CURRENT_PATH_REGEX = %r{/$}
|
398
|
+
EMPTY_STRING = ''.freeze
|
395
399
|
def current_path
|
396
|
-
request.path_info.downcase.sub(
|
400
|
+
@current_path ||= request.path_info.downcase.sub(CURRENT_PATH_REGEX, EMPTY_STRING)
|
397
401
|
end
|
398
402
|
|
399
403
|
def query_string
|
@@ -475,6 +479,12 @@ module OmniAuth
|
|
475
479
|
OmniAuth.config.on_failure.call(env)
|
476
480
|
end
|
477
481
|
|
482
|
+
def dup
|
483
|
+
super.tap do
|
484
|
+
@options = @options.dup
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
478
488
|
class Options < Hashie::Mash; end
|
479
489
|
|
480
490
|
protected
|
@@ -488,10 +498,10 @@ module OmniAuth
|
|
488
498
|
|
489
499
|
def ssl?
|
490
500
|
request.env['HTTPS'] == 'on' ||
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
501
|
+
request.env['HTTP_X_FORWARDED_SSL'] == 'on' ||
|
502
|
+
request.env['HTTP_X_FORWARDED_SCHEME'] == 'https' ||
|
503
|
+
(request.env['HTTP_X_FORWARDED_PROTO'] && request.env['HTTP_X_FORWARDED_PROTO'].split(',')[0] == 'https') ||
|
504
|
+
request.env['rack.url_scheme'] == 'https'
|
495
505
|
end
|
496
506
|
end
|
497
507
|
end
|