omniauth-oauth 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +7 -5
- data/lib/omniauth/strategies/oauth.rb +1 -1
- data/lib/omniauth-oauth/version.rb +1 -1
- data/omniauth-oauth.gemspec +2 -2
- data/spec/helper.rb +3 -1
- data/spec/omniauth/strategies/oauth_spec.rb +44 -5
- metadata +26 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 15f7ae4ba733071a8603faed16da085c9b38663b329ca15ad38e2d02b0180013
|
4
|
+
data.tar.gz: 8d5bcfe9d541dae45fe7e0201c81faaf4944526f6fbaeb8f1a98fc86a5311968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 342a46ffa943a4241cf77a14ef259d186232a332bd75e3cb54b4f0b1ae360d9838c8ed8e21fbe01024cd540d6e450d306cfaa4ed7dd7228071f383193440118b
|
7
|
+
data.tar.gz: 55a5ea9b505cc6b9429c0a12d05b347cda0a69ca937da64cd2e9e2eb6b3cafe4301591d2dba123fde5c06f7c57d896cc3f2342565a43dee2098668b34977f26c
|
data/.travis.yml
CHANGED
@@ -4,11 +4,12 @@ env:
|
|
4
4
|
- JRUBY_OPTS="$JRUBY_OPTS --debug"
|
5
5
|
language: ruby
|
6
6
|
rvm:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
- 2.
|
10
|
-
- 2.
|
11
|
-
- 2.
|
7
|
+
- 2.3
|
8
|
+
- 2.4
|
9
|
+
- 2.5
|
10
|
+
- 2.6
|
11
|
+
- 2.7
|
12
|
+
- 3.0
|
12
13
|
- jruby-18mode
|
13
14
|
- jruby-19mode
|
14
15
|
- jruby-head
|
@@ -18,5 +19,6 @@ matrix:
|
|
18
19
|
allow_failures:
|
19
20
|
- rvm: jruby-head
|
20
21
|
- rvm: ruby-head
|
22
|
+
- rvm: rbx-2 # TODO: Fix
|
21
23
|
fast_finish: true
|
22
24
|
sudo: false
|
@@ -48,7 +48,7 @@ module OmniAuth
|
|
48
48
|
|
49
49
|
opts = {}
|
50
50
|
if session["oauth"][name.to_s]["callback_confirmed"]
|
51
|
-
opts[:oauth_verifier] = request["oauth_verifier"]
|
51
|
+
opts[:oauth_verifier] = request.respond_to?(:params) ? request.params["oauth_verifier"] : request["oauth_verifier"]
|
52
52
|
else
|
53
53
|
opts[:oauth_callback] = callback_url
|
54
54
|
end
|
data/omniauth-oauth.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.homepage = "https://github.com/intridea/omniauth-oauth"
|
9
9
|
gem.license = "MIT"
|
10
10
|
|
11
|
-
gem.add_dependency "omniauth", "
|
11
|
+
gem.add_dependency "omniauth", ">= 1.0", "< 3"
|
12
12
|
gem.add_dependency "oauth"
|
13
|
-
gem.
|
13
|
+
gem.add_dependency "rack", ">= 1.6.2", "< 4"
|
14
14
|
|
15
15
|
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
16
16
|
gem.files = `git ls-files`.split("\n")
|
data/spec/helper.rb
CHANGED
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift File.expand_path("..", __FILE__)
|
|
2
2
|
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
3
3
|
require "simplecov"
|
4
4
|
SimpleCov.start do
|
5
|
-
minimum_coverage(89.
|
5
|
+
minimum_coverage(89.79)
|
6
6
|
end
|
7
7
|
require "rspec"
|
8
8
|
require "rack/test"
|
@@ -10,6 +10,8 @@ require "webmock/rspec"
|
|
10
10
|
require "omniauth"
|
11
11
|
require "omniauth-oauth"
|
12
12
|
|
13
|
+
OmniAuth.config.request_validation_phase = nil
|
14
|
+
|
13
15
|
RSpec.configure do |config|
|
14
16
|
config.include WebMock::API
|
15
17
|
config.include Rack::Test::Methods
|
@@ -34,7 +34,7 @@ describe "OmniAuth::Strategies::OAuth" do
|
|
34
34
|
describe "/auth/{name}" do
|
35
35
|
context "successful" do
|
36
36
|
before do
|
37
|
-
|
37
|
+
post "/auth/example.org"
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should redirect to authorize_url" do
|
@@ -43,7 +43,7 @@ describe "OmniAuth::Strategies::OAuth" do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should redirect to authorize_url with authorize_params when set" do
|
46
|
-
|
46
|
+
post "/auth/example.org_with_authorize_params"
|
47
47
|
expect(last_response).to be_redirect
|
48
48
|
expect([
|
49
49
|
"https://api.example.org/oauth/authorize?abc=def&oauth_token=yourtoken",
|
@@ -56,7 +56,7 @@ describe "OmniAuth::Strategies::OAuth" do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should pass request_params to get_request_token" do
|
59
|
-
|
59
|
+
post "/auth/example.org_with_request_params"
|
60
60
|
expect(WebMock).to have_requested(:post, "https://api.example.org/oauth/request_token").
|
61
61
|
with { |req| req.body == "scope=http%3A%2F%2Ffoobar.example.org" }
|
62
62
|
end
|
@@ -66,7 +66,7 @@ describe "OmniAuth::Strategies::OAuth" do
|
|
66
66
|
before do
|
67
67
|
stub_request(:post, "https://api.example.org/oauth/request_token").
|
68
68
|
to_raise(::Net::HTTPFatalError.new('502 "Bad Gateway"', nil))
|
69
|
-
|
69
|
+
post "/auth/example.org"
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should call fail! with :service_unavailable" do
|
@@ -78,7 +78,7 @@ describe "OmniAuth::Strategies::OAuth" do
|
|
78
78
|
before do
|
79
79
|
stub_request(:post, "https://api.example.org/oauth/request_token").
|
80
80
|
to_raise(::OpenSSL::SSL::SSLError.new("SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed"))
|
81
|
-
|
81
|
+
post "/auth/example.org"
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should call fail! with :service_unavailable" do
|
@@ -132,6 +132,45 @@ describe "OmniAuth::Strategies::OAuth" do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
describe "/auth/{name}/callback with Rack 2.x and 3.x" do
|
136
|
+
before do
|
137
|
+
stub_request(:post, "https://api.example.org/oauth/access_token").
|
138
|
+
to_return(:body => "oauth_token=yourtoken&oauth_token_secret=yoursecret")
|
139
|
+
end
|
140
|
+
|
141
|
+
context "Rack 2.x style request" do
|
142
|
+
before do
|
143
|
+
get "/auth/example.org/callback", {"oauth_verifier" => "dudeman"}, "rack.session" => {"oauth" => {"example.org" => {"callback_confirmed" => true, "request_token" => "yourtoken", "request_secret" => "yoursecret"}}}
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should exchange the request token for an access token" do
|
147
|
+
expect(last_request.env["omniauth.auth"]["provider"]).to eq("example.org")
|
148
|
+
expect(last_request.env["omniauth.auth"]["extra"]["access_token"]).to be_kind_of(OAuth::AccessToken)
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should call through to the master app" do
|
152
|
+
expect(last_response.body).to eq("true")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context "Rack 3.x style request" do
|
157
|
+
before do
|
158
|
+
# Simulate Rack 3.x behavior by putting oauth_verifier in the params
|
159
|
+
allow_any_instance_of(Rack::Request).to receive(:params).and_return({"oauth_verifier" => "dudeman"})
|
160
|
+
get "/auth/example.org/callback", {}, "rack.session" => {"oauth" => {"example.org" => {"callback_confirmed" => true, "request_token" => "yourtoken", "request_secret" => "yoursecret"}}}
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should exchange the request token for an access token" do
|
164
|
+
expect(last_request.env["omniauth.auth"]["provider"]).to eq("example.org")
|
165
|
+
expect(last_request.env["omniauth.auth"]["extra"]["access_token"]).to be_kind_of(OAuth::AccessToken)
|
166
|
+
end
|
167
|
+
|
168
|
+
it "should call through to the master app" do
|
169
|
+
expect(last_response.body).to eq("true")
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
135
174
|
describe "/auth/{name}/callback with expired session" do
|
136
175
|
before do
|
137
176
|
stub_request(:post, "https://api.example.org/oauth/access_token").
|
metadata
CHANGED
@@ -1,30 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
8
8
|
- Erik Michaels-Ober
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.0'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '3'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- - "
|
28
|
+
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: '1.0'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: oauth
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,19 +46,25 @@ dependencies:
|
|
40
46
|
- !ruby/object:Gem::Version
|
41
47
|
version: '0'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
49
|
+
name: rack
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
45
51
|
requirements:
|
46
|
-
- - "
|
52
|
+
- - ">="
|
47
53
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
49
|
-
|
54
|
+
version: 1.6.2
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '4'
|
58
|
+
type: :runtime
|
50
59
|
prerelease: false
|
51
60
|
version_requirements: !ruby/object:Gem::Requirement
|
52
61
|
requirements:
|
53
|
-
- - "
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.6.2
|
65
|
+
- - "<"
|
54
66
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
67
|
+
version: '4'
|
56
68
|
description: A generic OAuth (1.0/1.0a) strategy for OmniAuth.
|
57
69
|
email:
|
58
70
|
- michael@intridea.com
|
@@ -79,7 +91,7 @@ homepage: https://github.com/intridea/omniauth-oauth
|
|
79
91
|
licenses:
|
80
92
|
- MIT
|
81
93
|
metadata: {}
|
82
|
-
post_install_message:
|
94
|
+
post_install_message:
|
83
95
|
rdoc_options: []
|
84
96
|
require_paths:
|
85
97
|
- lib
|
@@ -94,9 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
106
|
- !ruby/object:Gem::Version
|
95
107
|
version: '0'
|
96
108
|
requirements: []
|
97
|
-
|
98
|
-
|
99
|
-
signing_key:
|
109
|
+
rubygems_version: 3.3.26
|
110
|
+
signing_key:
|
100
111
|
specification_version: 4
|
101
112
|
summary: A generic OAuth (1.0/1.0a) strategy for OmniAuth.
|
102
113
|
test_files:
|