googleauth 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/googleauth/application_default.rb +1 -1
- data/lib/googleauth/compute_engine.rb +2 -1
- data/lib/googleauth/version.rb +1 -1
- data/spec/googleauth/compute_engine_spec.rb +13 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed0edf45ba52552808e13667185f0277233c77e8d0e377d7b1924dc0fb9c1d1a
|
4
|
+
data.tar.gz: db8eaf43c99d362dae906b0c1c488652201940a8b4f70ca589846a7ecf869dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c088c7997002f68a820b928ae2f1898f6efdd32d5850413d9894995fee3dce0689908427547a971884ab1673f2218e3526b20bdbea3d280995bee3fcdef202
|
7
|
+
data.tar.gz: d45554051877a0cb282db279cf45df0462dcda88562cd54cf640c554d95eb43adb254821366e0b12529dc5768cbe9bf3fbbf1cb612a72b6a400b619b3ed6fbfc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Release History
|
2
|
+
|
3
|
+
### 0.13.1 / 2020-07-30
|
4
|
+
|
5
|
+
* Support scopes when using GCE Metadata Server authentication ([@ball-hayden][])
|
6
|
+
|
1
7
|
### 0.13.0 / 2020-06-17
|
2
8
|
|
3
9
|
* Support for validating ID tokens.
|
@@ -143,3 +149,4 @@ Note: This release now requires Ruby 2.4 or later
|
|
143
149
|
[@tbetbetbe]: https://github.com/tbetbetbe
|
144
150
|
[@murgatroid99]: https://github.com/murgatroid99
|
145
151
|
[@vsubramani]: https://github.com/vsubramani
|
152
|
+
[@ball-hayden]: https://github.com/ball-hayden
|
@@ -85,7 +85,8 @@ module Google
|
|
85
85
|
c = options[:connection] || Faraday.default_connection
|
86
86
|
retry_with_error do
|
87
87
|
uri = target_audience ? COMPUTE_ID_TOKEN_URI : COMPUTE_AUTH_TOKEN_URI
|
88
|
-
query = target_audience ? { "audience" => target_audience, "format" => "full" } :
|
88
|
+
query = target_audience ? { "audience" => target_audience, "format" => "full" } : {}
|
89
|
+
query[:scopes] = Array(scope).join " " if scope
|
89
90
|
headers = { "Metadata-Flavor" => "Google" }
|
90
91
|
resp = c.get uri, query, headers
|
91
92
|
case resp.status
|
data/lib/googleauth/version.rb
CHANGED
@@ -51,7 +51,11 @@ describe Google::Auth::GCECredentials do
|
|
51
51
|
body = MultiJson.dump("access_token" => opts[:access_token],
|
52
52
|
"token_type" => "Bearer",
|
53
53
|
"expires_in" => 3600)
|
54
|
-
|
54
|
+
|
55
|
+
uri = MD_ACCESS_URI
|
56
|
+
uri += "?scopes=#{opts[:scope]}" if opts[:scope]
|
57
|
+
|
58
|
+
stub_request(:get, uri)
|
55
59
|
.with(headers: { "Metadata-Flavor" => "Google" })
|
56
60
|
.to_return(body: body,
|
57
61
|
status: 200,
|
@@ -69,6 +73,14 @@ describe Google::Auth::GCECredentials do
|
|
69
73
|
|
70
74
|
context "metadata is unavailable" do
|
71
75
|
describe "#fetch_access_token" do
|
76
|
+
it "should pass scopes when requesting an access token" do
|
77
|
+
scope = "https://www.googleapis.com/auth/drive"
|
78
|
+
stub = make_auth_stubs access_token: "1/abcdef1234567890", scope: scope
|
79
|
+
@client = GCECredentials.new(scope: [scope])
|
80
|
+
@client.fetch_access_token!
|
81
|
+
expect(stub).to have_been_requested
|
82
|
+
end
|
83
|
+
|
72
84
|
it "should fail if the metadata request returns a 404" do
|
73
85
|
stub = stub_request(:get, MD_ACCESS_URI)
|
74
86
|
.to_return(status: 404,
|
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.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Emiola
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|