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.

@@ -1,3 +1,3 @@
1
1
  module OmniAuth
2
- VERSION = '1.2.2'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -5,18 +5,17 @@ require 'omniauth/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.add_dependency 'hashie', ['>= 1.2', '< 4']
8
- spec.add_dependency 'rack', '~> 1.0'
8
+ spec.add_dependency 'rack', ['>= 1.0', '< 2.0']
9
9
  spec.add_development_dependency 'bundler', '~> 1.0'
10
10
  spec.authors = ['Michael Bleigh', 'Erik Michaels-Ober', 'Tom Milewski']
11
11
  spec.description = 'A generalized Rack framework for multiple-provider authentication.'
12
12
  spec.email = ['michael@intridea.com', 'sferik@gmail.com', 'tmilewski@gmail.com']
13
- spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
13
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?('spec/') }
14
14
  spec.homepage = 'http://github.com/intridea/omniauth'
15
15
  spec.licenses = %w(MIT)
16
16
  spec.name = 'omniauth'
17
17
  spec.require_paths = %w(lib)
18
18
  spec.required_rubygems_version = '>= 1.3.5'
19
19
  spec.summary = spec.description
20
- spec.test_files = spec.files.grep(/^spec\//)
21
20
  spec.version = OmniAuth::VERSION
22
21
  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.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-09 00:00:00.000000000 Z
13
+ date: 2015-12-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hashie
@@ -36,16 +36,22 @@ dependencies:
36
36
  name: rack
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1.0'
42
+ - - "<"
43
+ - !ruby/object:Gem::Version
44
+ version: '2.0'
42
45
  type: :runtime
43
46
  prerelease: false
44
47
  version_requirements: !ruby/object:Gem::Requirement
45
48
  requirements:
46
- - - "~>"
49
+ - - ">="
47
50
  - !ruby/object:Gem::Version
48
51
  version: '1.0'
52
+ - - "<"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
49
55
  - !ruby/object:Gem::Dependency
50
56
  name: bundler
51
57
  requirement: !ruby/object:Gem::Requirement
@@ -69,7 +75,6 @@ executables: []
69
75
  extensions: []
70
76
  extra_rdoc_files: []
71
77
  files:
72
- - ".gemtest"
73
78
  - ".gitignore"
74
79
  - ".rspec"
75
80
  - ".rubocop.yml"
@@ -77,7 +82,7 @@ files:
77
82
  - ".yardopts"
78
83
  - Gemfile
79
84
  - Gemfile.rack-1.3.x
80
- - Guardfile
85
+ - Gemfile.rack-master
81
86
  - LICENSE.md
82
87
  - README.md
83
88
  - Rakefile
@@ -95,14 +100,6 @@ files:
95
100
  - lib/omniauth/test/strategy_test_case.rb
96
101
  - lib/omniauth/version.rb
97
102
  - omniauth.gemspec
98
- - spec/helper.rb
99
- - spec/omniauth/auth_hash_spec.rb
100
- - spec/omniauth/builder_spec.rb
101
- - spec/omniauth/failure_endpoint_spec.rb
102
- - spec/omniauth/form_spec.rb
103
- - spec/omniauth/strategies/developer_spec.rb
104
- - spec/omniauth/strategy_spec.rb
105
- - spec/omniauth_spec.rb
106
103
  homepage: http://github.com/intridea/omniauth
107
104
  licenses:
108
105
  - MIT
@@ -123,17 +120,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
120
  version: 1.3.5
124
121
  requirements: []
125
122
  rubyforge_project:
126
- rubygems_version: 2.2.2
123
+ rubygems_version: 2.4.5.1
127
124
  signing_key:
128
125
  specification_version: 4
129
126
  summary: A generalized Rack framework for multiple-provider authentication.
130
- test_files:
131
- - spec/helper.rb
132
- - spec/omniauth/auth_hash_spec.rb
133
- - spec/omniauth/builder_spec.rb
134
- - spec/omniauth/failure_endpoint_spec.rb
135
- - spec/omniauth/form_spec.rb
136
- - spec/omniauth/strategies/developer_spec.rb
137
- - spec/omniauth/strategy_spec.rb
138
- - spec/omniauth_spec.rb
127
+ test_files: []
139
128
  has_rdoc:
data/.gemtest DELETED
File without changes
data/Guardfile DELETED
@@ -1,10 +0,0 @@
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
@@ -1,55 +0,0 @@
1
- require 'simplecov'
2
- require 'coveralls'
3
-
4
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
- SimpleCov::Formatter::HTMLFormatter,
6
- Coveralls::SimpleCov::Formatter
7
- ]
8
- SimpleCov.start do
9
- add_filter '/spec/'
10
- minimum_coverage(93.05)
11
- end
12
-
13
- require 'rspec'
14
- require 'rack/test'
15
- require 'omniauth'
16
- require 'omniauth/test'
17
-
18
- OmniAuth.config.logger = Logger.new('/dev/null')
19
-
20
- RSpec.configure do |config|
21
- config.include Rack::Test::Methods
22
- config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
23
- config.expect_with :rspec do |c|
24
- c.syntax = :expect
25
- end
26
- end
27
-
28
- class ExampleStrategy
29
- include OmniAuth::Strategy
30
- attr_reader :last_env
31
- option :name, 'test'
32
-
33
- def call(env)
34
- self.call!(env)
35
- end
36
-
37
- def initialize(*args, &block)
38
- super
39
- @fail = nil
40
- end
41
-
42
- def request_phase
43
- @fail = fail!(options[:failure]) if options[:failure]
44
- @last_env = env
45
- return @fail if @fail
46
- fail('Request Phase')
47
- end
48
-
49
- def callback_phase
50
- @fail = fail!(options[:failure]) if options[:failure]
51
- @last_env = env
52
- return @fail if @fail
53
- fail('Callback Phase')
54
- end
55
- end
@@ -1,111 +0,0 @@
1
- require 'helper'
2
-
3
- describe OmniAuth::AuthHash do
4
- subject { OmniAuth::AuthHash.new }
5
- it 'converts a supplied info key into an InfoHash object' do
6
- subject.info = {:first_name => 'Awesome'}
7
- expect(subject.info).to be_kind_of(OmniAuth::AuthHash::InfoHash)
8
- expect(subject.info.first_name).to eq('Awesome')
9
- end
10
-
11
- describe '#valid?' do
12
- subject { OmniAuth::AuthHash.new(:uid => '123', :provider => 'example', :info => {:name => 'Steven'}) }
13
-
14
- it 'is valid with the right parameters' do
15
- expect(subject).to be_valid
16
- end
17
-
18
- it 'requires a uid' do
19
- subject.uid = nil
20
- expect(subject).not_to be_valid
21
- end
22
-
23
- it 'requires a provider' do
24
- subject.provider = nil
25
- expect(subject).not_to be_valid
26
- end
27
-
28
- it 'requires a name in the user info hash' do
29
- subject.info.name = nil
30
- expect(subject).not_to be_valid
31
- end
32
- end
33
-
34
- describe '#name' do
35
- subject do
36
- OmniAuth::AuthHash.new(
37
- :info => {
38
- :name => 'Phillip J. Fry',
39
- :first_name => 'Phillip',
40
- :last_name => 'Fry',
41
- :nickname => 'meatbag',
42
- :email => 'fry@planetexpress.com',
43
- }
44
- )
45
- end
46
-
47
- it 'defaults to the name key' do
48
- expect(subject.info.name).to eq('Phillip J. Fry')
49
- end
50
-
51
- it 'falls back to go to first_name last_name concatenation' do
52
- subject.info.name = nil
53
- expect(subject.info.name).to eq('Phillip Fry')
54
- end
55
-
56
- it 'displays only a first or last name if only that is available' do
57
- subject.info.name = nil
58
- subject.info.first_name = nil
59
- expect(subject.info.name).to eq('Fry')
60
- end
61
-
62
- it 'displays the nickname if no name, first, or last is available' do
63
- subject.info.name = nil
64
- %w(first_name last_name).each { |k| subject.info[k] = nil }
65
- expect(subject.info.name).to eq('meatbag')
66
- end
67
-
68
- it 'displays the email if no name, first, last, or nick is available' do
69
- subject.info.name = nil
70
- %w(first_name last_name nickname).each { |k| subject.info[k] = nil }
71
- expect(subject.info.name).to eq('fry@planetexpress.com')
72
- end
73
- end
74
-
75
- describe '#to_hash' do
76
- subject { OmniAuth::AuthHash.new(:uid => '123', :provider => 'test', :name => 'Example User') }
77
- let(:hash) { subject.to_hash }
78
-
79
- it 'is a plain old hash' do
80
- expect(hash.class).to eq(::Hash)
81
- end
82
-
83
- it 'has string keys' do
84
- expect(hash.keys).to be_include('uid')
85
- end
86
-
87
- it 'converts an info hash as well' do
88
- subject.info = {:first_name => 'Example', :last_name => 'User'}
89
- expect(subject.info.class).to eq(OmniAuth::AuthHash::InfoHash)
90
- expect(subject.to_hash['info'].class).to eq(::Hash)
91
- end
92
-
93
- it 'supplies the calculated name in the converted hash' do
94
- subject.info = {:first_name => 'Examplar', :last_name => 'User'}
95
- expect(hash['info']['name']).to eq('Examplar User')
96
- end
97
-
98
- it "does not pollute the URL hash with 'name' etc" do
99
- subject.info = {'urls' => {'Homepage' => 'http://homepage.com'}}
100
- expect(subject.to_hash['info']['urls']).to eq('Homepage' => 'http://homepage.com')
101
- end
102
- end
103
-
104
- describe OmniAuth::AuthHash::InfoHash do
105
- describe '#valid?' do
106
- it 'is valid if there is a name' do
107
- expect(OmniAuth::AuthHash::InfoHash.new(:name => 'Awesome')).to be_valid
108
- end
109
- end
110
- end
111
- end
@@ -1,50 +0,0 @@
1
- require 'helper'
2
-
3
- describe OmniAuth::Builder do
4
- describe '#provider' do
5
- it 'translates a symbol to a constant' do
6
- expect(OmniAuth::Strategies).to receive(:const_get).with('MyStrategy').and_return(Class.new)
7
- OmniAuth::Builder.new(nil) do
8
- provider :my_strategy
9
- end
10
- end
11
-
12
- it 'accepts a class' do
13
- class ExampleClass; end
14
-
15
- expect do
16
- OmniAuth::Builder.new(nil) do
17
- provider ::ExampleClass
18
- end
19
- end.not_to raise_error
20
- end
21
-
22
- it "raises a helpful LoadError message if it can't find the class" do
23
- expect do
24
- OmniAuth::Builder.new(nil) do
25
- provider :lorax
26
- end
27
- end.to raise_error(LoadError, 'Could not find matching strategy for :lorax. You may need to install an additional gem (such as omniauth-lorax).')
28
- end
29
- end
30
-
31
- describe '#options' do
32
- it 'merges provided options in' do
33
- k = Class.new
34
- b = OmniAuth::Builder.new(nil)
35
- expect(b).to receive(:use).with(k, :foo => 'bar', :baz => 'tik')
36
-
37
- b.options :foo => 'bar'
38
- b.provider k, :baz => 'tik'
39
- end
40
-
41
- it 'adds an argument if no options are provided' do
42
- k = Class.new
43
- b = OmniAuth::Builder.new(nil)
44
- expect(b).to receive(:use).with(k, :foo => 'bar')
45
-
46
- b.options :foo => 'bar'
47
- b.provider k
48
- end
49
- end
50
- end
@@ -1,58 +0,0 @@
1
- require 'helper'
2
-
3
- describe OmniAuth::FailureEndpoint do
4
- subject { OmniAuth::FailureEndpoint }
5
-
6
- context 'raise-out environment' do
7
- before do
8
- @rack_env = ENV['RACK_ENV']
9
- ENV['RACK_ENV'] = 'test'
10
-
11
- @default = OmniAuth.config.failure_raise_out_environments
12
- OmniAuth.config.failure_raise_out_environments = ['test']
13
- end
14
-
15
- it 'raises out the error' do
16
- expect do
17
- subject.call('omniauth.error' => StandardError.new('Blah'))
18
- end.to raise_error(StandardError, 'Blah')
19
- end
20
-
21
- it 'raises out an OmniAuth::Error if no omniauth.error is set' do
22
- expect { subject.call('omniauth.error.type' => 'example') }.to raise_error(OmniAuth::Error, 'example')
23
- end
24
-
25
- after do
26
- ENV['RACK_ENV'] = @rack_env
27
- OmniAuth.config.failure_raise_out_environments = @default
28
- end
29
- end
30
-
31
- context 'non-raise-out environment' do
32
- let(:env) do
33
- {'omniauth.error.type' => 'invalid_request', 'omniauth.error.strategy' => ExampleStrategy.new({})}
34
- end
35
-
36
- it 'is a redirect' do
37
- status, _, _ = *subject.call(env)
38
- expect(status).to eq(302)
39
- end
40
-
41
- it 'includes the SCRIPT_NAME' do
42
- _, head, _ = *subject.call(env.merge('SCRIPT_NAME' => '/random'))
43
- expect(head['Location']).to eq('/random/auth/failure?message=invalid_request&strategy=test')
44
- end
45
-
46
- it 'respects the configured path prefix' do
47
- allow(OmniAuth.config).to receive(:path_prefix).and_return('/boo')
48
- _, head, _ = *subject.call(env)
49
- expect(head['Location']).to eq('/boo/failure?message=invalid_request&strategy=test')
50
- end
51
-
52
- it 'includes the origin (escaped) if one is provided' do
53
- env.merge! 'omniauth.origin' => '/origin-example'
54
- _, head, _ = *subject.call(env)
55
- expect(head['Location']).to be_include('&origin=%2Forigin-example')
56
- end
57
- end
58
- end
@@ -1,23 +0,0 @@
1
- require 'helper'
2
-
3
- describe OmniAuth::Form do
4
- describe '.build' do
5
- it 'yields the instance when called with a block and argument' do
6
- OmniAuth::Form.build { |f| expect(f).to be_kind_of(OmniAuth::Form) }
7
- end
8
-
9
- it 'evaluates in the instance when called with a block and no argument' do
10
- OmniAuth::Form.build { |f| expect(f.class).to eq(OmniAuth::Form) }
11
- end
12
- end
13
-
14
- describe '#initialize' do
15
- it 'sets the form action to the passed :url option' do
16
- expect(OmniAuth::Form.new(:url => '/awesome').to_html).to be_include("action='/awesome'")
17
- end
18
-
19
- it 'sets an H1 tag from the passed :title option' do
20
- expect(OmniAuth::Form.new(:title => 'Something Cool').to_html).to be_include('<h1>Something Cool</h1>')
21
- end
22
- end
23
- end
@@ -1,73 +0,0 @@
1
- require 'helper'
2
-
3
- describe OmniAuth::Strategies::Developer do
4
- let(:app) do
5
- Rack::Builder.new do |b|
6
- b.use Rack::Session::Cookie, :secret => 'abc123'
7
- b.use OmniAuth::Strategies::Developer
8
- b.run lambda { |_env| [200, {}, ['Not Found']] }
9
- end.to_app
10
- end
11
-
12
- context 'request phase' do
13
- before(:each) { get '/auth/developer' }
14
-
15
- it 'displays a form' do
16
- expect(last_response.status).to eq(200)
17
- expect(last_response.body).to be_include('<form')
18
- end
19
-
20
- it 'has the callback as the action for the form' do
21
- expect(last_response.body).to be_include("action='/auth/developer/callback'")
22
- end
23
-
24
- it 'has a text field for each of the fields' do
25
- expect(last_response.body.scan('<input').size).to eq(2)
26
- end
27
- end
28
-
29
- context 'callback phase' do
30
- let(:auth_hash) { last_request.env['omniauth.auth'] }
31
-
32
- context 'with default options' do
33
- before do
34
- post '/auth/developer/callback', :name => 'Example User', :email => 'user@example.com'
35
- end
36
-
37
- it 'sets the name in the auth hash' do
38
- expect(auth_hash.info.name).to eq('Example User')
39
- end
40
-
41
- it 'sets the email in the auth hash' do
42
- expect(auth_hash.info.email).to eq('user@example.com')
43
- end
44
-
45
- it 'sets the uid to the email' do
46
- expect(auth_hash.uid).to eq('user@example.com')
47
- end
48
- end
49
-
50
- context 'with custom options' do
51
- let(:app) do
52
- Rack::Builder.new do |b|
53
- b.use Rack::Session::Cookie, :secret => 'abc123'
54
- b.use OmniAuth::Strategies::Developer, :fields => [:first_name, :last_name], :uid_field => :last_name
55
- b.run lambda { |_env| [200, {}, ['Not Found']] }
56
- end.to_app
57
- end
58
-
59
- before do
60
- @options = {:uid_field => :last_name, :fields => [:first_name, :last_name]}
61
- post '/auth/developer/callback', :first_name => 'Example', :last_name => 'User'
62
- end
63
-
64
- it 'sets info fields properly' do
65
- expect(auth_hash.info.name).to eq('Example User')
66
- end
67
-
68
- it 'sets the uid properly' do
69
- expect(auth_hash.uid).to eq('User')
70
- end
71
- end
72
- end
73
- end