omniauth-oauth 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniauth/strategies/oauth.rb +1 -1
- data/lib/omniauth-oauth/version.rb +1 -1
- data/omniauth-oauth.gemspec +1 -0
- data/spec/omniauth/strategies/oauth_spec.rb +39 -0
- metadata +26 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
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
|
@@ -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
@@ -10,6 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
|
11
11
|
gem.add_dependency "omniauth", ">= 1.0", "< 3"
|
12
12
|
gem.add_dependency "oauth"
|
13
|
+
gem.add_dependency "rack", ">= 1.6.2", "< 4"
|
13
14
|
|
14
15
|
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
15
16
|
gem.files = `git ls-files`.split("\n")
|
@@ -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,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
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
|
@@ -45,6 +45,26 @@ dependencies:
|
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rack
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.2
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '4'
|
58
|
+
type: :runtime
|
59
|
+
prerelease: false
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.6.2
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '4'
|
48
68
|
description: A generic OAuth (1.0/1.0a) strategy for OmniAuth.
|
49
69
|
email:
|
50
70
|
- michael@intridea.com
|
@@ -71,7 +91,7 @@ homepage: https://github.com/intridea/omniauth-oauth
|
|
71
91
|
licenses:
|
72
92
|
- MIT
|
73
93
|
metadata: {}
|
74
|
-
post_install_message:
|
94
|
+
post_install_message:
|
75
95
|
rdoc_options: []
|
76
96
|
require_paths:
|
77
97
|
- lib
|
@@ -86,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
106
|
- !ruby/object:Gem::Version
|
87
107
|
version: '0'
|
88
108
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
90
|
-
signing_key:
|
109
|
+
rubygems_version: 3.3.26
|
110
|
+
signing_key:
|
91
111
|
specification_version: 4
|
92
112
|
summary: A generic OAuth (1.0/1.0a) strategy for OmniAuth.
|
93
113
|
test_files:
|