omniauth 1.1.3 → 1.1.4
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +4 -0
- data/lib/omniauth/builder.rb +1 -0
- data/lib/omniauth/form.rb +3 -2
- data/lib/omniauth/strategy.rb +14 -7
- data/lib/omniauth/version.rb +1 -1
- data/omniauth.gemspec +1 -1
- data/spec/{spec_helper.rb → helper.rb} +12 -6
- data/spec/omniauth/auth_hash_spec.rb +1 -1
- data/spec/omniauth/builder_spec.rb +1 -1
- data/spec/omniauth/failure_endpoint_spec.rb +5 -5
- data/spec/omniauth/form_spec.rb +1 -1
- data/spec/omniauth/strategies/developer_spec.rb +3 -3
- data/spec/omniauth/strategy_spec.rb +20 -5
- data/spec/omniauth_spec.rb +1 -1
- metadata +40 -48
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e2de96580841043efbf6ce867bbe6b574482e1e3
|
4
|
+
data.tar.gz: df751e517e48515d401fc11b2552cf87d75b278a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 459fee400c08cffb08c4518bb70d323ff6705bb434a085a3a9ea74097437275d58d61cd631055573c66d8e973d764513f4d783ce4eb2d95e88c93c8babe29774
|
7
|
+
data.tar.gz: 4bff6e3d866ccc5dcb62ecaaf2d878378b9618978f3cc7c8100b40f70258ed99f955e6f0533512304cbd2b0646fd2ba71e2c87f903f475ea8a23a85268edee6b
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
# OmniAuth: Standardized Multi-Provider Authentication
|
2
|
+
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/omniauth.png)][gem]
|
3
4
|
[![CI Build Status](https://secure.travis-ci.org/intridea/omniauth.png?branch=master)][travis]
|
4
5
|
[![Dependency Status](https://gemnasium.com/intridea/omniauth.png?travis)][gemnasium]
|
5
6
|
[![Code Climate](https://codeclimate.com/github/intridea/omniauth.png)][codeclimate]
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/intridea/omniauth/badge.png?branch=master)][coveralls]
|
8
|
+
|
6
9
|
|
7
10
|
[gem]: https://rubygems.org/gems/omniauth
|
8
11
|
[travis]: http://travis-ci.org/intridea/omniauth
|
9
12
|
[gemnasium]: https://gemnasium.com/intridea/omniauth
|
10
13
|
[codeclimate]: https://codeclimate.com/github/intridea/omniauth
|
14
|
+
[coveralls]: https://coveralls.io/r/intridea/omniauth
|
11
15
|
|
12
16
|
**OmniAuth 1.0 has several breaking changes from version 0.x. You can set
|
13
17
|
the dependency to `~> 0.3.2` if you do not wish to make the more difficult
|
data/lib/omniauth/builder.rb
CHANGED
data/lib/omniauth/form.rb
CHANGED
@@ -95,6 +95,7 @@ module OmniAuth
|
|
95
95
|
|
96
96
|
@html = ""
|
97
97
|
@with_custom_button = false
|
98
|
+
@footer = nil
|
98
99
|
header(options[:title],options[:header_info])
|
99
100
|
end
|
100
101
|
|
@@ -141,7 +142,7 @@ module OmniAuth
|
|
141
142
|
|
142
143
|
def fieldset(legend, options = {}, &block)
|
143
144
|
@html << "\n<fieldset#{" style='#{options[:style]}'" if options[:style]}#{" id='#{options[:id]}'" if options[:id]}>\n <legend>#{legend}</legend>\n"
|
144
|
-
self.instance_eval
|
145
|
+
self.instance_eval(&block)
|
145
146
|
@html << "\n</fieldset>"
|
146
147
|
self
|
147
148
|
end
|
@@ -182,7 +183,7 @@ module OmniAuth
|
|
182
183
|
|
183
184
|
def to_response
|
184
185
|
footer
|
185
|
-
Rack::Response.new(@html).finish
|
186
|
+
Rack::Response.new(@html, 200, {"content-type" => "text/html"}).finish
|
186
187
|
end
|
187
188
|
|
188
189
|
protected
|
data/lib/omniauth/strategy.rb
CHANGED
@@ -13,8 +13,6 @@ module OmniAuth
|
|
13
13
|
|
14
14
|
base.extend ClassMethods
|
15
15
|
base.class_eval do
|
16
|
-
attr_reader :app, :env, :options, :response
|
17
|
-
|
18
16
|
option :setup, false
|
19
17
|
option :skip_info, false
|
20
18
|
end
|
@@ -24,7 +22,7 @@ module OmniAuth
|
|
24
22
|
# Returns an inherited set of default options set at the class-level
|
25
23
|
# for each strategy.
|
26
24
|
def default_options
|
27
|
-
return @default_options if @default_options
|
25
|
+
return @default_options if instance_variable_defined?(:@default_options) && @default_options
|
28
26
|
existing = superclass.respond_to?(:default_options) ? superclass.default_options : {}
|
29
27
|
@default_options = OmniAuth::Strategy::Options.new(existing)
|
30
28
|
end
|
@@ -52,8 +50,11 @@ module OmniAuth
|
|
52
50
|
# configure foo: 'bar'
|
53
51
|
# end
|
54
52
|
def configure(options = nil)
|
55
|
-
|
56
|
-
|
53
|
+
if block_given?
|
54
|
+
yield default_options
|
55
|
+
else
|
56
|
+
default_options.deep_merge!(options)
|
57
|
+
end
|
57
58
|
end
|
58
59
|
|
59
60
|
# Directly declare a default option for your class. This is a useful from
|
@@ -79,9 +80,12 @@ module OmniAuth
|
|
79
80
|
# recorded as. This takes care of 90% of the use cases for overriding
|
80
81
|
# the initializer in OmniAuth Strategies.
|
81
82
|
def args(args = nil)
|
82
|
-
|
83
|
+
if args
|
84
|
+
@args = Array(args)
|
85
|
+
return
|
86
|
+
end
|
83
87
|
existing = superclass.respond_to?(:args) ? superclass.args : []
|
84
|
-
return @args || existing
|
88
|
+
return (instance_variable_defined?(:@args) && @args) || existing
|
85
89
|
end
|
86
90
|
|
87
91
|
%w(uid info extra credentials).each do |fetcher|
|
@@ -106,6 +110,8 @@ module OmniAuth
|
|
106
110
|
end
|
107
111
|
end
|
108
112
|
|
113
|
+
attr_reader :app, :env, :options, :response
|
114
|
+
|
109
115
|
# Initializes the strategy by passing in the Rack endpoint,
|
110
116
|
# the unique URL segment name for this strategy, and any
|
111
117
|
# additional arguments. An `options` hash is automatically
|
@@ -123,6 +129,7 @@ module OmniAuth
|
|
123
129
|
# @yield [Options] Yields options to block for further configuration.
|
124
130
|
def initialize(app, *args, &block)
|
125
131
|
@app = app
|
132
|
+
@env = nil
|
126
133
|
@options = self.class.default_options.dup
|
127
134
|
|
128
135
|
options.deep_merge!(args.pop) if args.last.is_a?(Hash)
|
data/lib/omniauth/version.rb
CHANGED
data/omniauth.gemspec
CHANGED
@@ -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', '
|
7
|
+
spec.add_dependency 'hashie', ['>= 1.2', '< 3']
|
8
8
|
spec.add_dependency 'rack'
|
9
9
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
10
10
|
spec.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
7
9
|
|
8
10
|
require 'rspec'
|
9
11
|
require 'rack/test'
|
@@ -25,6 +27,10 @@ class ExampleStrategy
|
|
25
27
|
option :name, 'test'
|
26
28
|
def call(env); self.call!(env) end
|
27
29
|
attr_reader :last_env
|
30
|
+
def initialize(*args, &block)
|
31
|
+
super
|
32
|
+
@fail = nil
|
33
|
+
end
|
28
34
|
def request_phase
|
29
35
|
@fail = fail!(options[:failure]) if options[:failure]
|
30
36
|
@last_env = env
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
describe OmniAuth::FailureEndpoint do
|
4
4
|
subject{ OmniAuth::FailureEndpoint }
|
@@ -29,24 +29,24 @@ describe OmniAuth::FailureEndpoint do
|
|
29
29
|
'omniauth.error.strategy' => ExampleStrategy.new({}) } }
|
30
30
|
|
31
31
|
it "is a redirect" do
|
32
|
-
status,
|
32
|
+
status, _, _ = *subject.call(env)
|
33
33
|
expect(status).to eq(302)
|
34
34
|
end
|
35
35
|
|
36
36
|
it "includes the SCRIPT_NAME" do
|
37
|
-
|
37
|
+
_, head, _ = *subject.call(env.merge('SCRIPT_NAME' => '/random'))
|
38
38
|
expect(head['Location']).to eq('/random/auth/failure?message=invalid_request&strategy=test')
|
39
39
|
end
|
40
40
|
|
41
41
|
it "respects the configured path prefix" do
|
42
42
|
OmniAuth.config.stub(:path_prefix => '/boo')
|
43
|
-
|
43
|
+
_, head, _ = *subject.call(env)
|
44
44
|
expect(head["Location"]).to eq('/boo/failure?message=invalid_request&strategy=test')
|
45
45
|
end
|
46
46
|
|
47
47
|
it "includes the origin (escaped) if one is provided" do
|
48
48
|
env.merge! 'omniauth.origin' => '/origin-example'
|
49
|
-
|
49
|
+
_, head, _ = *subject.call(env)
|
50
50
|
expect(head['Location']).to be_include('&origin=%2Forigin-example')
|
51
51
|
end
|
52
52
|
end
|
data/spec/omniauth/form_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
describe OmniAuth::Strategies::Developer do
|
4
4
|
let(:app){ Rack::Builder.new do |b|
|
5
|
-
b.use Rack::Session::Cookie
|
5
|
+
b.use Rack::Session::Cookie, {:secret => "abc123"}
|
6
6
|
b.use OmniAuth::Strategies::Developer
|
7
7
|
b.run lambda{|env| [200, {}, ['Not Found']]}
|
8
8
|
end.to_app }
|
@@ -47,7 +47,7 @@ describe OmniAuth::Strategies::Developer do
|
|
47
47
|
|
48
48
|
context "with custom options" do
|
49
49
|
let(:app){ Rack::Builder.new do |b|
|
50
|
-
b.use Rack::Session::Cookie
|
50
|
+
b.use Rack::Session::Cookie, {:secret => "abc123"}
|
51
51
|
b.use OmniAuth::Strategies::Developer, :fields => [:first_name, :last_name], :uid_field => :last_name
|
52
52
|
b.run lambda{|env| [200, {}, ['Not Found']]}
|
53
53
|
end.to_app }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'helper'
|
2
2
|
|
3
3
|
def make_env(path = '/auth/test', props = {})
|
4
4
|
{
|
@@ -28,11 +28,22 @@ describe OmniAuth::Strategy do
|
|
28
28
|
|
29
29
|
describe ".configure" do
|
30
30
|
subject { klass = Class.new; klass.send :include, OmniAuth::Strategy; klass }
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
context "when block is passed" do
|
32
|
+
it "allows for default options setting" do
|
33
|
+
subject.configure do |c|
|
34
|
+
c.wakka = 'doo'
|
35
|
+
end
|
36
|
+
expect(subject.default_options["wakka"]).to eq("doo")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "works when block doesn't evaluate to true" do
|
40
|
+
environment_variable = nil
|
41
|
+
subject.configure do |c|
|
42
|
+
c.abc = '123'
|
43
|
+
c.hgi = environment_variable
|
44
|
+
end
|
45
|
+
expect(subject.default_options["abc"]).to eq("123")
|
34
46
|
end
|
35
|
-
expect(subject.default_options["wakka"]).to eq("doo")
|
36
47
|
end
|
37
48
|
|
38
49
|
it "takes a hash and deep merge it" do
|
@@ -246,6 +257,10 @@ describe OmniAuth::Strategy do
|
|
246
257
|
end
|
247
258
|
|
248
259
|
describe "#call" do
|
260
|
+
before(:all) do
|
261
|
+
@options = nil
|
262
|
+
end
|
263
|
+
|
249
264
|
let(:strategy){ ExampleStrategy.new(app, @options || {}) }
|
250
265
|
|
251
266
|
context "omniauth.origin" do
|
data/spec/omniauth_spec.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Bleigh
|
@@ -10,71 +9,66 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain:
|
13
|
-
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
RURoWmtTY1lla3c0Wk9lMTY0WnRaRzgxNm9BdjV4MHBHaXRTSWt1bVVwN1Y4
|
36
|
-
aUVaLzZlaHI3WTllClhPZzRlZXVuNUwvSmptakFSb1cya05kdmtSRDNjMkVl
|
37
|
-
U0xxV3ZRUnNCbHlwSGZoczZKSnVMbHlaUEdoVTNSL3YKU2YzbFZLcEJDV2dS
|
38
|
-
cEdUdnk0NVhWcEIrNTl5MzNQSm1FdVExUFRFT1l2UXlhbzlVS01BQWFBTi83
|
39
|
-
cVdRdGpsMApobHc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
40
|
-
date: 2013-02-14 00:00:00.000000000 Z
|
12
|
+
- |
|
13
|
+
-----BEGIN CERTIFICATE-----
|
14
|
+
MIIDLjCCAhagAwIBAgIBADANBgkqhkiG9w0BAQUFADA9MQ8wDQYDVQQDDAZzZmVy
|
15
|
+
aWsxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2NvbTAe
|
16
|
+
Fw0xMzAyMDMxMDAyMjdaFw0xNDAyMDMxMDAyMjdaMD0xDzANBgNVBAMMBnNmZXJp
|
17
|
+
azEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29tMIIB
|
18
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl0x5dx8uKxi7TkrIuyBUTJVB
|
19
|
+
v1o93nUB9j/y4M96gV2rYwAci1JPBseNd6Fybzjo3YGuHl7EQHuSHNaf1p2lxew/
|
20
|
+
y60JXIJBBgPcDK/KCP4NUHofm0jfoYD+H5uNJfHCNq7/ZsTxOtE3Ra92s0BCMTpm
|
21
|
+
wBMMlWR5MtdEhIYuBO4XhnejYgH0L/7BL2lymntVnsr/agdQoojQCN1IQmsRJvrR
|
22
|
+
duZRO3tZvoIo1pBc4JEehDuqCeyBgPLOqMoKtQlold1TQs1kWUBK7KWMFEhKC/Kg
|
23
|
+
zyzKRHQo9yDYwOvYngoBLY+T/lwCT4dyssdhzRbfnxAhaKu4SAssIwaC01yVowID
|
24
|
+
AQABozkwNzAJBgNVHRMEAjAAMB0GA1UdDgQWBBS0ruDfRak5ci1OpDNX/ZdDEkIs
|
25
|
+
iTALBgNVHQ8EBAMCBLAwDQYJKoZIhvcNAQEFBQADggEBAHHSMs/MP0sOaLkEv4Jo
|
26
|
+
zvkm3qn5A6t0vaHx774cmejyMU+5wySxRezspL7ULh9NeuK2OhU+Oe3TpqrAg5TK
|
27
|
+
R8GQILnVu2FemGA6sAkPDlcPtgA6ieI19PZOF6HVLmc/ID/dP/NgZWWzEeqQKmcK
|
28
|
+
2+HM+SEEDhZkScYekw4ZOe164ZtZG816oAv5x0pGitSIkumUp7V8iEZ/6ehr7Y9e
|
29
|
+
XOg4eeun5L/JjmjARoW2kNdvkRD3c2EeSLqWvQRsBlypHfhs6JJuLlyZPGhU3R/v
|
30
|
+
Sf3lVKpBCWgRpGTvy45XVpB+59y33PJmEuQ1PTEOYvQyao9UKMAAaAN/7qWQtjl0
|
31
|
+
hlw=
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2013-04-08 00:00:00.000000000 Z
|
41
34
|
dependencies:
|
42
35
|
- !ruby/object:Gem::Dependency
|
43
36
|
name: hashie
|
44
37
|
requirement: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
38
|
requirements:
|
47
|
-
- -
|
39
|
+
- - '>='
|
48
40
|
- !ruby/object:Gem::Version
|
49
41
|
version: '1.2'
|
42
|
+
- - <
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '3'
|
50
45
|
type: :runtime
|
51
46
|
prerelease: false
|
52
47
|
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
48
|
requirements:
|
55
|
-
- -
|
49
|
+
- - '>='
|
56
50
|
- !ruby/object:Gem::Version
|
57
51
|
version: '1.2'
|
52
|
+
- - <
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
58
55
|
- !ruby/object:Gem::Dependency
|
59
56
|
name: rack
|
60
57
|
requirement: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
58
|
requirements:
|
63
|
-
- -
|
59
|
+
- - '>='
|
64
60
|
- !ruby/object:Gem::Version
|
65
61
|
version: '0'
|
66
62
|
type: :runtime
|
67
63
|
prerelease: false
|
68
64
|
version_requirements: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
65
|
requirements:
|
71
|
-
- -
|
66
|
+
- - '>='
|
72
67
|
- !ruby/object:Gem::Version
|
73
68
|
version: '0'
|
74
69
|
- !ruby/object:Gem::Dependency
|
75
70
|
name: bundler
|
76
71
|
requirement: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
72
|
requirements:
|
79
73
|
- - ~>
|
80
74
|
- !ruby/object:Gem::Version
|
@@ -82,7 +76,6 @@ dependencies:
|
|
82
76
|
type: :development
|
83
77
|
prerelease: false
|
84
78
|
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
79
|
requirements:
|
87
80
|
- - ~>
|
88
81
|
- !ruby/object:Gem::Version
|
@@ -112,6 +105,7 @@ files:
|
|
112
105
|
- lib/omniauth/test.rb
|
113
106
|
- lib/omniauth/version.rb
|
114
107
|
- lib/omniauth.rb
|
108
|
+
- spec/helper.rb
|
115
109
|
- spec/omniauth/auth_hash_spec.rb
|
116
110
|
- spec/omniauth/builder_spec.rb
|
117
111
|
- spec/omniauth/failure_endpoint_spec.rb
|
@@ -119,33 +113,32 @@ files:
|
|
119
113
|
- spec/omniauth/strategies/developer_spec.rb
|
120
114
|
- spec/omniauth/strategy_spec.rb
|
121
115
|
- spec/omniauth_spec.rb
|
122
|
-
- spec/spec_helper.rb
|
123
116
|
homepage: http://github.com/intridea/omniauth
|
124
117
|
licenses:
|
125
118
|
- MIT
|
119
|
+
metadata: {}
|
126
120
|
post_install_message:
|
127
121
|
rdoc_options: []
|
128
122
|
require_paths:
|
129
123
|
- lib
|
130
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
125
|
requirements:
|
133
|
-
- -
|
126
|
+
- - '>='
|
134
127
|
- !ruby/object:Gem::Version
|
135
128
|
version: '0'
|
136
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
130
|
requirements:
|
139
|
-
- -
|
131
|
+
- - '>='
|
140
132
|
- !ruby/object:Gem::Version
|
141
133
|
version: 1.3.6
|
142
134
|
requirements: []
|
143
135
|
rubyforge_project:
|
144
|
-
rubygems_version:
|
136
|
+
rubygems_version: 2.0.0
|
145
137
|
signing_key:
|
146
|
-
specification_version:
|
138
|
+
specification_version: 4
|
147
139
|
summary: A generalized Rack framework for multiple-provider authentication.
|
148
140
|
test_files:
|
141
|
+
- spec/helper.rb
|
149
142
|
- spec/omniauth/auth_hash_spec.rb
|
150
143
|
- spec/omniauth/builder_spec.rb
|
151
144
|
- spec/omniauth/failure_endpoint_spec.rb
|
@@ -153,5 +146,4 @@ test_files:
|
|
153
146
|
- spec/omniauth/strategies/developer_spec.rb
|
154
147
|
- spec/omniauth/strategy_spec.rb
|
155
148
|
- spec/omniauth_spec.rb
|
156
|
-
- spec/spec_helper.rb
|
157
149
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|