omniauth 1.1.4 → 1.2.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2de96580841043efbf6ce867bbe6b574482e1e3
4
- data.tar.gz: df751e517e48515d401fc11b2552cf87d75b278a
3
+ metadata.gz: 3f39a414c0faa20fa73d5154f76f3a99197aceda
4
+ data.tar.gz: 071d7f140c3910a94348999054d2b401c2a534dd
5
5
  SHA512:
6
- metadata.gz: 459fee400c08cffb08c4518bb70d323ff6705bb434a085a3a9ea74097437275d58d61cd631055573c66d8e973d764513f4d783ce4eb2d95e88c93c8babe29774
7
- data.tar.gz: 4bff6e3d866ccc5dcb62ecaaf2d878378b9618978f3cc7c8100b40f70258ed99f955e6f0533512304cbd2b0646fd2ba71e2c87f903f475ea8a23a85268edee6b
6
+ metadata.gz: 08d531039bef8a998707e80adcf913155b8a1d54d6e673dc878c754abb64dd33adbe91d357bec0e63d3b8b784353d032e68ea347d10487c16d36a4517b528040
7
+ data.tar.gz: 636a8819d05c07c3636745731dea74c39e31945ca2a09f138d3ee84fa6b876c00f2596f93e915748c05940b6536d3a9a487462f1ecf97adbb94d4194bc8dc730
Binary file
data.tar.gz.sig CHANGED
Binary file
File without changes
@@ -0,0 +1,11 @@
1
+ *.gem
2
+ *~
3
+ .bundle
4
+ .rvmrc
5
+ .yardoc
6
+ Gemfile.lock
7
+ coverage/*
8
+ doc/*
9
+ log/*
10
+ measurement/*
11
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --order random
@@ -0,0 +1,82 @@
1
+ AllCops:
2
+ Includes:
3
+ - 'Gemfile'
4
+ - 'Rakefile'
5
+ - 'omniauth.gemspec'
6
+
7
+ # Avoid long parameter lists
8
+ ParameterLists:
9
+ Max: 4
10
+ CountKeywordArgs: true
11
+
12
+ MethodLength:
13
+ CountComments: false
14
+ Max: 14
15
+
16
+ # Avoid more than `Max` levels of nesting.
17
+ BlockNesting:
18
+ Max: 2
19
+
20
+ # Align with the style guide.
21
+ CollectionMethods:
22
+ PreferredMethods:
23
+ map: 'collect'
24
+ reduce: 'inject'
25
+ find: 'detect'
26
+ find_all: 'select'
27
+
28
+ # Do not force public/protected/private keyword to be indented at the same
29
+ # level as the def keyword. My personal preference is to outdent these keywords
30
+ # because I think when scanning code it makes it easier to identify the
31
+ # sections of code and visually separate them. When the keyword is at the same
32
+ # level I think it sort of blends in with the def keywords and makes it harder
33
+ # to scan the code and see where the sections are.
34
+ AccessModifierIndentation:
35
+ Enabled: false
36
+
37
+ # Limit line length
38
+ LineLength:
39
+ Enabled: false
40
+
41
+ # Disable documentation checking until a class needs to be documented once
42
+ Documentation:
43
+ Enabled: false
44
+
45
+ # Enforce Ruby 1.8-compatible hash syntax
46
+ HashSyntax:
47
+ EnforcedStyle: hash_rockets
48
+
49
+ # No spaces inside hash literals
50
+ SpaceInsideHashLiteralBraces:
51
+ EnforcedStyle: no_space
52
+
53
+ # Allow dots at the end of lines
54
+ DotPosition:
55
+ Enabled: false
56
+
57
+ # Don't require magic comment at the top of every file
58
+ Encoding:
59
+ Enabled: false
60
+
61
+ # Enforce outdenting of access modifiers (i.e. public, private, protected)
62
+ AccessModifierIndentation:
63
+ EnforcedStyle: outdent
64
+
65
+ EmptyLinesAroundAccessModifier:
66
+ Enabled: true
67
+
68
+ # Align ends correctly
69
+ EndAlignment:
70
+ AlignWith: variable
71
+
72
+ # Indentation of when/else
73
+ CaseIndentation:
74
+ IndentWhenRelativeTo: end
75
+ IndentOneStep: false
76
+
77
+ Lambda:
78
+ Enabled: false
79
+
80
+ HandleExceptions:
81
+ Exclude:
82
+ - 'spec'
@@ -0,0 +1,42 @@
1
+ before_install:
2
+ - gem update bundler
3
+ - bundle --version
4
+ - gem update --system 2.1.11
5
+ - gem --version
6
+ bundler_args: --without development
7
+ gemfile:
8
+ - Gemfile
9
+ - Gemfile.rack-1.3.x
10
+ language: ruby
11
+ rvm:
12
+ - 1.8.7
13
+ - 1.9.2
14
+ - 1.9.3
15
+ - 2.0.0
16
+ - 2.1.0
17
+ - rbx
18
+ - ruby-head
19
+ matrix:
20
+ include:
21
+ - rvm: jruby-18mode
22
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
23
+ gemfile: Gemfile
24
+ - rvm: jruby-18mode
25
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
26
+ gemfile: Gemfile.rack-1.3.x
27
+ - rvm: jruby-19mode
28
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
29
+ gemfile: Gemfile
30
+ - rvm: jruby-19mode
31
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
32
+ gemfile: Gemfile.rack-1.3.x
33
+ - rvm: jruby-head
34
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
35
+ gemfile: Gemfile
36
+ - rvm: jruby-head
37
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
38
+ gemfile: Gemfile.rack-1.3.x
39
+ allow_failures:
40
+ - rvm: jruby-head
41
+ - rvm: ruby-head
42
+ fast_finish: true
data/Gemfile ADDED
@@ -0,0 +1,37 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'jruby-openssl', :platforms => :jruby
4
+ gem 'rake'
5
+ gem 'yard'
6
+
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
+ gem 'kramdown'
15
+ gem 'plymouth', :platforms => [:ruby_19, :ruby_20, :ruby_21]
16
+ gem 'pry'
17
+ gem 'pry-debugger', :platforms => [:mri_19, :mri_20, :mri_21]
18
+ gem 'rb-fsevent'
19
+ end
20
+
21
+ group :test do
22
+ gem 'coveralls', :require => false
23
+ gem 'json', '>= 1.8.1', :platforms => [:jruby, :rbx, :ruby_18, :ruby_19]
24
+ gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
25
+ gem 'rack-test'
26
+ gem 'rspec', '>= 2.14'
27
+ gem 'rubocop', '>= 0.16', :platforms => [:ruby_19, :ruby_20, :ruby_21]
28
+ gem 'simplecov', :require => false
29
+ end
30
+
31
+ platforms :rbx do
32
+ gem 'racc'
33
+ gem 'rubinius-coverage', '~> 2.0'
34
+ gem 'rubysl', '~> 2.0'
35
+ end
36
+
37
+ gemspec
@@ -0,0 +1,24 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'jruby-openssl', :platforms => :jruby
4
+ gem 'rack', '~> 1.3.0'
5
+ gem 'rake'
6
+ gem 'yard'
7
+
8
+ group :test do
9
+ gem 'coveralls', :require => false
10
+ gem 'json', '>= 1.8.1', :platforms => [:jruby, :rbx, :ruby_18, :ruby_19]
11
+ gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
12
+ gem 'rack-test'
13
+ gem 'rspec', '>= 2.14'
14
+ gem 'rubocop', '>= 0.16', :platforms => [:ruby_19, :ruby_20, :ruby_21]
15
+ gem 'simplecov', :require => false
16
+ end
17
+
18
+ platforms :rbx do
19
+ gem 'racc'
20
+ gem 'rubinius-coverage', '~> 2.0'
21
+ gem 'rubysl', '~> 2.0'
22
+ end
23
+
24
+ gemspec
@@ -0,0 +1,10 @@
1
+ guard 'rspec', :version => 2 do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec/" }
5
+ end
6
+
7
+ guard 'bundler' do
8
+ watch('Gemfile')
9
+ watch(/^.+\.gemspec/)
10
+ end
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Dependency Status](https://gemnasium.com/intridea/omniauth.png?travis)][gemnasium]
6
6
  [![Code Climate](https://codeclimate.com/github/intridea/omniauth.png)][codeclimate]
7
7
  [![Coverage Status](https://coveralls.io/repos/intridea/omniauth/badge.png?branch=master)][coveralls]
8
-
8
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/intridea/omniauth/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
9
9
 
10
10
  [gem]: https://rubygems.org/gems/omniauth
11
11
  [travis]: http://travis-ci.org/intridea/omniauth
@@ -13,6 +13,7 @@
13
13
  [codeclimate]: https://codeclimate.com/github/intridea/omniauth
14
14
  [coveralls]: https://coveralls.io/r/intridea/omniauth
15
15
 
16
+
16
17
  **OmniAuth 1.0 has several breaking changes from version 0.x. You can set
17
18
  the dependency to `~> 0.3.2` if you do not wish to make the more difficult
18
19
  upgrade. See [the wiki](https://github.com/intridea/omniauth/wiki/Upgrading-to-1.0)
@@ -93,7 +94,7 @@ steps are necessary for your application. For example, in a Rails app I
93
94
  would add a line in my `routes.rb` file like this:
94
95
 
95
96
  ```ruby
96
- match '/auth/:provider/callback', to: 'sessions#create'
97
+ get '/auth/:provider/callback', to: 'sessions#create'
97
98
  ```
98
99
 
99
100
  And I might then have a `SessionsController` with code that looks
@@ -143,8 +144,7 @@ your first stop if you are wondering about a more in-depth look at
143
144
  OmniAuth, how it works, and how to use it.
144
145
 
145
146
  ## Supported Ruby Versions
146
- OmniAuth is tested under 1.8.7, 1.9.2, 1.9.3, JRuby (1.8 mode), and Rubinius
147
- (1.8 and 1.9 modes).
147
+ OmniAuth is tested under 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1.0, JRuby, and Rubinius.
148
148
 
149
149
  ## Versioning
150
150
  This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
data/Rakefile CHANGED
@@ -1,6 +1,17 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
+
3
4
  require 'rspec/core/rake_task'
4
5
  RSpec::Core::RakeTask.new(:spec)
5
- task :default => :spec
6
6
  task :test => :spec
7
+
8
+ begin
9
+ require 'rubocop/rake_task'
10
+ Rubocop::RakeTask.new
11
+ rescue LoadError
12
+ task :rubocop do
13
+ $stderr.puts 'Rubocop is disabled'
14
+ end
15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Av5x0pGitSIkumUp7V8iEZ/6ehr7Y9e
17
+ XOg4eeun5L/JjmjARoW2kNdvkRD3c2EeSLqWvQRsBlypHfhs6JJuLlyZPGhU3R/v
18
+ Sf3lVKpBCWgRpGTvy45XVpB+59y33PJmEuQ1PTEOYvQyao9UKMAAaAN/7qWQtjl0
19
+ hlw=
20
+ -----END CERTIFICATE-----
@@ -17,7 +17,7 @@ module OmniAuth
17
17
  autoload :FailureEndpoint, 'omniauth/failure_endpoint'
18
18
 
19
19
  def self.strategies
20
- @@strategies ||= []
20
+ @strategies ||= []
21
21
  end
22
22
 
23
23
  class Configuration
@@ -25,35 +25,29 @@ module OmniAuth
25
25
 
26
26
  def self.default_logger
27
27
  logger = Logger.new(STDOUT)
28
- logger.progname = "omniauth"
28
+ logger.progname = 'omniauth'
29
29
  logger
30
30
  end
31
31
 
32
- @@defaults = {
33
- :camelizations => {},
34
- :path_prefix => '/auth',
35
- :on_failure => OmniAuth::FailureEndpoint,
36
- :form_css => Form::DEFAULT_CSS,
37
- :test_mode => false,
38
- :logger => default_logger,
39
- :allowed_request_methods => [:get, :post],
40
- :mock_auth => {
41
- :default => AuthHash.new(
42
- 'provider' => 'default',
43
- 'uid' => '1234',
44
- 'info' => {
45
- 'name' => 'Bob Example'
46
- }
47
- )
48
- }
49
- }
50
-
51
32
  def self.defaults
52
- @@defaults
33
+ @defaults ||= {
34
+ :camelizations => {},
35
+ :path_prefix => '/auth',
36
+ :on_failure => OmniAuth::FailureEndpoint,
37
+ :failure_raise_out_environments => ['development'],
38
+ :before_request_phase => nil,
39
+ :before_callback_phase => nil,
40
+ :before_options_phase => nil,
41
+ :form_css => Form::DEFAULT_CSS,
42
+ :test_mode => false,
43
+ :logger => default_logger,
44
+ :allowed_request_methods => [:get, :post],
45
+ :mock_auth => {:default => AuthHash.new('provider' => 'default', 'uid' => '1234', 'info' => {'name' => 'Example User'})}
46
+ }
53
47
  end
54
48
 
55
49
  def initialize
56
- @@defaults.each_pair{|k,v| self.send("#{k}=",v)}
50
+ self.class.defaults.each_pair { |k, v| send("#{k}=", v) }
57
51
  end
58
52
 
59
53
  def on_failure(&block)
@@ -64,7 +58,31 @@ module OmniAuth
64
58
  end
65
59
  end
66
60
 
67
- def add_mock(provider, mock={})
61
+ def before_callback_phase(&block)
62
+ if block_given?
63
+ @before_callback_phase = block
64
+ else
65
+ @before_callback_phase
66
+ end
67
+ end
68
+
69
+ def before_options_phase(&block)
70
+ if block_given?
71
+ @before_options_phase = block
72
+ else
73
+ @before_options_phase
74
+ end
75
+ end
76
+
77
+ def before_request_phase(&block)
78
+ if block_given?
79
+ @before_request_phase = block
80
+ else
81
+ @before_request_phase
82
+ end
83
+ end
84
+
85
+ def add_mock(provider, mock = {})
68
86
  # Stringify keys recursively one level.
69
87
  mock.keys.each do |key|
70
88
  mock[key.to_s] = mock.delete(key)
@@ -78,11 +96,11 @@ module OmniAuth
78
96
  end
79
97
 
80
98
  # Merge with the default mock and ensure provider is correct.
81
- mock = self.mock_auth[:default].dup.merge(mock)
82
- mock["provider"] = provider.to_s
99
+ mock = mock_auth[:default].dup.merge(mock)
100
+ mock['provider'] = provider.to_s
83
101
 
84
102
  # Add it to the mocks.
85
- self.mock_auth[provider.to_sym] = mock
103
+ mock_auth[provider.to_sym] = mock
86
104
  end
87
105
 
88
106
  # This is a convenience method to be used by strategy authors
@@ -92,11 +110,11 @@ module OmniAuth
92
110
  # @param name [String] The underscored name, e.g. `oauth`
93
111
  # @param camelized [String] The properly camelized name, e.g. 'OAuth'
94
112
  def add_camelization(name, camelized)
95
- self.camelizations[name.to_s] = camelized.to_s
113
+ camelizations[name.to_s] = camelized.to_s
96
114
  end
97
115
 
98
- attr_writer :on_failure
99
- attr_accessor :path_prefix, :allowed_request_methods, :form_css, :test_mode, :mock_auth, :full_host, :camelizations, :logger
116
+ attr_writer :on_failure, :before_callback_phase, :before_options_phase, :before_request_phase
117
+ attr_accessor :failure_raise_out_environments, :path_prefix, :allowed_request_methods, :form_css, :test_mode, :mock_auth, :full_host, :camelizations, :logger
100
118
  end
101
119
 
102
120
  def self.config
@@ -126,8 +144,8 @@ module OmniAuth
126
144
  target = hash.dup
127
145
 
128
146
  other_hash.keys.each do |key|
129
- if other_hash[key].is_a? ::Hash and hash[key].is_a? ::Hash
130
- target[key] = deep_merge(target[key],other_hash[key])
147
+ if other_hash[key].is_a?(::Hash) && hash[key].is_a?(::Hash)
148
+ target[key] = deep_merge(target[key], other_hash[key])
131
149
  next
132
150
  end
133
151
 
@@ -141,7 +159,7 @@ module OmniAuth
141
159
  return OmniAuth.config.camelizations[word.to_s] if OmniAuth.config.camelizations[word.to_s]
142
160
 
143
161
  if first_letter_in_uppercase
144
- word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
162
+ word.to_s.gsub(/\/(.?)/) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
145
163
  else
146
164
  word.first + camelize(word)[1..-1]
147
165
  end