googleauth 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.kokoro/build.bat +9 -1
- data/.kokoro/continuous/windows.cfg +17 -1
- data/.kokoro/presubmit/windows.cfg +17 -1
- data/.kokoro/trampoline.bat +10 -0
- data/.rubocop.yml +37 -6
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/README.md +1 -2
- data/googleauth.gemspec +1 -1
- data/lib/googleauth/application_default.rb +7 -7
- data/lib/googleauth/compute_engine.rb +10 -10
- data/lib/googleauth/credentials.rb +231 -46
- data/lib/googleauth/credentials_loader.rb +10 -7
- data/lib/googleauth/signet.rb +5 -4
- data/lib/googleauth/user_authorizer.rb +2 -2
- data/lib/googleauth/user_refresh.rb +1 -1
- data/lib/googleauth/version.rb +1 -1
- data/lib/googleauth/web_user_authorizer.rb +13 -8
- data/spec/googleauth/credentials_spec.rb +341 -155
- data/spec/googleauth/signet_spec.rb +31 -0
- data/spec/googleauth/web_user_authorizer_spec.rb +6 -0
- metadata +5 -4
- data/.kokoro/windows.sh +0 -4
@@ -100,4 +100,35 @@ describe Signet::OAuth2::Client do
|
|
100
100
|
expect(stub).to have_been_requested
|
101
101
|
end
|
102
102
|
end
|
103
|
+
|
104
|
+
describe "#fetch_access_token!" do
|
105
|
+
it "retries when orig_fetch_access_token! raises Signet::RemoteServerError" do
|
106
|
+
mocked_responses = [:raise, :raise, "success"]
|
107
|
+
allow(@client).to receive(:orig_fetch_access_token!).exactly(3).times do
|
108
|
+
response = mocked_responses.shift
|
109
|
+
response == :raise ? raise(Signet::RemoteServerError) : response
|
110
|
+
end
|
111
|
+
expect(@client.fetch_access_token!).to eq("success")
|
112
|
+
end
|
113
|
+
|
114
|
+
it "raises when the max retry count is exceeded" do
|
115
|
+
mocked_responses = [:raise, :raise, :raise, :raise, :raise, :raise, "success"]
|
116
|
+
allow(@client).to receive(:orig_fetch_access_token!).exactly(6).times do
|
117
|
+
response = mocked_responses.shift
|
118
|
+
response == :raise ? raise(Signet::RemoteServerError) : response
|
119
|
+
end
|
120
|
+
expect { @client.fetch_access_token! }.to raise_error Signet::AuthorizationError
|
121
|
+
end
|
122
|
+
|
123
|
+
it "does not retry and raises right away if it encounters a Signet::AuthorizationError" do
|
124
|
+
allow(@client).to receive(:orig_fetch_access_token!).at_most(:once)
|
125
|
+
.and_raise(Signet::AuthorizationError.new("Some Message"))
|
126
|
+
expect { @client.fetch_access_token! }.to raise_error Signet::AuthorizationError
|
127
|
+
end
|
128
|
+
|
129
|
+
it "does not retry and raises right away if it encounters a Signet::ParseError" do
|
130
|
+
allow(@client).to receive(:orig_fetch_access_token!).at_most(:once).and_raise(Signet::ParseError)
|
131
|
+
expect { @client.fetch_access_token! }.to raise_error Signet::ParseError
|
132
|
+
end
|
133
|
+
end
|
103
134
|
end
|
@@ -63,6 +63,12 @@ describe Google::Auth::WebUserAuthorizer do
|
|
63
63
|
)
|
64
64
|
end
|
65
65
|
|
66
|
+
it "should allow adding custom state key-value pairs" do
|
67
|
+
url = authorizer.get_authorization_url request: request, state: { james: "bond", kind: 1 }
|
68
|
+
expect(url).to match(%r{%22james%22:%22bond%22})
|
69
|
+
expect(url).to match(%r{%22kind%22:1})
|
70
|
+
end
|
71
|
+
|
66
72
|
it "should include request forgery token in state" do
|
67
73
|
expect(SecureRandom).to receive(:base64).and_return("aGVsbG8=")
|
68
74
|
url = authorizer.get_authorization_url request: request
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googleauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Emiola
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -132,8 +132,8 @@ files:
|
|
132
132
|
- ".kokoro/presubmit/osx.cfg"
|
133
133
|
- ".kokoro/presubmit/windows.cfg"
|
134
134
|
- ".kokoro/release.cfg"
|
135
|
+
- ".kokoro/trampoline.bat"
|
135
136
|
- ".kokoro/trampoline.sh"
|
136
|
-
- ".kokoro/windows.sh"
|
137
137
|
- ".rspec"
|
138
138
|
- ".rubocop.yml"
|
139
139
|
- CHANGELOG.md
|
@@ -197,7 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
|
-
|
200
|
+
rubyforge_project:
|
201
|
+
rubygems_version: 2.7.6.2
|
201
202
|
signing_key:
|
202
203
|
specification_version: 4
|
203
204
|
summary: Google Auth Library for Ruby
|
data/.kokoro/windows.sh
DELETED