gitlab-fog-azure-rm 2.5.1 → 2.5.2
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/CHANGELOG.md +5 -0
- data/lib/fog/azurerm/identity/base_client.rb +14 -4
- data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +1 -1
- data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +1 -1
- data/lib/fog/azurerm/requests/storage/commit_blob_blocks.rb +1 -1
- data/lib/fog/azurerm/requests/storage/copy_blob.rb +1 -1
- data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +1 -1
- data/lib/fog/azurerm/requests/storage/create_block_blob.rb +1 -1
- data/lib/fog/azurerm/requests/storage/create_container.rb +1 -1
- data/lib/fog/azurerm/requests/storage/create_page_blob.rb +1 -1
- data/lib/fog/azurerm/requests/storage/delete_blob.rb +1 -1
- data/lib/fog/azurerm/requests/storage/delete_container.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_blob.rb +3 -3
- data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_container_acl.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_container_properties.rb +1 -1
- data/lib/fog/azurerm/requests/storage/list_blobs.rb +1 -1
- data/lib/fog/azurerm/requests/storage/list_containers.rb +1 -1
- data/lib/fog/azurerm/requests/storage/put_blob_block.rb +1 -1
- data/lib/fog/azurerm/requests/storage/put_blob_metadata.rb +1 -1
- data/lib/fog/azurerm/requests/storage/put_blob_pages.rb +1 -1
- data/lib/fog/azurerm/requests/storage/put_blob_properties.rb +1 -1
- data/lib/fog/azurerm/requests/storage/put_container_acl.rb +1 -1
- data/lib/fog/azurerm/requests/storage/put_container_metadata.rb +1 -1
- data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +1 -1
- data/lib/fog/azurerm/requests/storage/release_container_lease.rb +1 -1
- data/lib/fog/azurerm/storage.rb +14 -4
- data/lib/fog/azurerm/version.rb +1 -1
- data/test/requests/storage/test_credential_refresh_on_blob_requests.rb +85 -0
- data/test/unit/test_workflow_identity_client.rb +30 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82912caef21af9f05608fd07eb07dd1c1a5d2693a805562a33448997f7897177
|
|
4
|
+
data.tar.gz: 245ab6fc1a0f8f64d775872c622696debcd1594cb72e75d7a533eef689d19e27
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a28a7bc76b170937760e54e276386b6b555077ad01d5b2e0259841c70d93247904b94ea899ad2ecbde12799bdc4786091879919695b00dbe4d83977678a82172
|
|
7
|
+
data.tar.gz: deb8fdf6983ae0e8ca2350cf35c4ca334e08cfd1779c1fd463fee5f6c338ed1db364ecae5b05f3b4b9816409d466c8115faa1ba6462f737bece557ad7756c0c6
|
data/CHANGELOG.md
CHANGED
|
@@ -43,12 +43,22 @@ module Fog
|
|
|
43
43
|
|
|
44
44
|
return unless access_token
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Credentials.new(access_token, token_expires_at(body))
|
|
47
|
+
rescue ::JSON::ParserError # rubocop:disable Lint/SuppressedException
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# IMDS returns an absolute expires_on (epoch seconds), while the OAuth
|
|
51
|
+
# v2.0 token endpoint used by workload identity returns a relative
|
|
52
|
+
# expires_in. Handle both so refresh_needed? has a real expiry; otherwise
|
|
53
|
+
# it defaults to now and forces a token fetch on every request.
|
|
54
|
+
def token_expires_at(body)
|
|
47
55
|
expires_on = body['expires_on']
|
|
48
|
-
|
|
56
|
+
return ::Time.at(expires_on.to_i) if expires_on
|
|
49
57
|
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
expires_in = body['expires_in']
|
|
59
|
+
return ::Time.now + expires_in.to_i if expires_in
|
|
60
|
+
|
|
61
|
+
::Time.now
|
|
52
62
|
end
|
|
53
63
|
|
|
54
64
|
private
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
lease_id =
|
|
12
|
+
lease_id = blob_client.acquire_blob_lease(container_name, name, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
lease_id =
|
|
12
|
+
lease_id = blob_client.acquire_container_lease(name, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.commit_blob_blocks(container_name, blob_name, blocks, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
copy_id, copy_status =
|
|
12
|
+
copy_id, copy_status = blob_client.copy_blob(destination_container, destination_blob, source_container, source_blob, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
copy_id, copy_status =
|
|
12
|
+
copy_id, copy_status = blob_client.copy_blob_from_uri(destination_container, destination_blob, source_blob_uri, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -8,7 +8,7 @@ module Fog
|
|
|
8
8
|
msg = "create_block_blob #{blob_name} to the container #{container_name}. options: #{options}"
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
blob_client.create_block_blob(container_name, blob_name, body, options)
|
|
12
12
|
rescue Azure::Core::Http::HTTPError => ex
|
|
13
13
|
raise_azure_exception(ex, msg)
|
|
14
14
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.create_page_blob(container_name, blob_name, blob_size, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.delete_blob(container_name, blob_name, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
return true if ex.message.include?('(404)')
|
|
15
15
|
raise_azure_exception(ex, msg)
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.delete_container(name, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
return true if ex.message.include?('(404)')
|
|
15
15
|
raise_azure_exception(ex, msg)
|
|
@@ -11,7 +11,7 @@ module Fog
|
|
|
11
11
|
Fog::Logger.debug msg
|
|
12
12
|
|
|
13
13
|
begin
|
|
14
|
-
blob =
|
|
14
|
+
blob = blob_client.get_blob_properties(container_name, blob_name, options)
|
|
15
15
|
rescue Azure::Core::Http::HTTPError => ex
|
|
16
16
|
raise 'NotFound' if ex.message.include?('(404)')
|
|
17
17
|
raise_azure_exception(ex, msg)
|
|
@@ -49,7 +49,7 @@ module Fog
|
|
|
49
49
|
begin
|
|
50
50
|
msg = "get_blob_with_block_given: blob #{blob_name} in the container #{container_name}. options: #{params}"
|
|
51
51
|
Fog::Logger.debug msg
|
|
52
|
-
_, content =
|
|
52
|
+
_, content = blob_client.get_blob(container_name, blob_name, params)
|
|
53
53
|
rescue Azure::Core::Http::HTTPError => ex
|
|
54
54
|
raise 'NotFound' if ex.message.include?('(404)')
|
|
55
55
|
raise_azure_exception(ex, msg)
|
|
@@ -71,7 +71,7 @@ module Fog
|
|
|
71
71
|
Fog::Logger.debug msg
|
|
72
72
|
|
|
73
73
|
begin
|
|
74
|
-
blob, content =
|
|
74
|
+
blob, content = blob_client.get_blob(container_name, blob_name, options)
|
|
75
75
|
Fog::Logger.debug "Get blob #{blob_name} successfully."
|
|
76
76
|
[blob, content]
|
|
77
77
|
rescue Azure::Core::Http::HTTPError => ex
|
|
@@ -8,7 +8,7 @@ module Fog
|
|
|
8
8
|
msg = "Get Blob #{name} properties in container #{container_name}, options: #{options}."
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
begin
|
|
11
|
-
blob =
|
|
11
|
+
blob = blob_client.get_blob_properties(container_name, name, options)
|
|
12
12
|
rescue Azure::Core::Http::HTTPError => ex
|
|
13
13
|
raise 'NotFound' if ex.message.include?('(404)')
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
container, signed_identifiers =
|
|
12
|
+
container, signed_identifiers = blob_client.get_container_acl(container_name, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
container =
|
|
12
|
+
container = blob_client.get_container_properties(name, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise 'NotFound' if ex.message.include?('(404)')
|
|
15
15
|
raise_azure_exception(ex, msg)
|
|
@@ -19,7 +19,7 @@ module Fog
|
|
|
19
19
|
options[:request_id] = SecureRandom.uuid
|
|
20
20
|
msg = "Listing blobs in container: #{container_name}, options: #{options}"
|
|
21
21
|
Fog::Logger.debug msg
|
|
22
|
-
temp =
|
|
22
|
+
temp = blob_client.list_blobs(container_name, options)
|
|
23
23
|
# Workaround for the issue https://github.com/Azure/azure-storage-ruby/issues/37
|
|
24
24
|
raise temp unless temp.instance_of?(Azure::Storage::Common::Service::EnumerationResults)
|
|
25
25
|
|
|
@@ -14,7 +14,7 @@ module Fog
|
|
|
14
14
|
options[:request_id] = SecureRandom.uuid
|
|
15
15
|
msg = "Listing containers. options: #{options}"
|
|
16
16
|
Fog::Logger.debug msg
|
|
17
|
-
temp =
|
|
17
|
+
temp = blob_client.list_containers(options)
|
|
18
18
|
# Workaround for the issue https://github.com/Azure/azure-storage-ruby/issues/37
|
|
19
19
|
raise temp unless temp.instance_of?(Azure::Storage::Common::Service::EnumerationResults)
|
|
20
20
|
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.put_blob_block(container_name, blob_name, block_id, data, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.set_blob_metadata(container_name, name, metadata, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.put_blob_pages(container_name, blob_name, start_range, end_range, data, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.set_blob_properties(container_name, name, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
|
@@ -9,7 +9,7 @@ module Fog
|
|
|
9
9
|
Fog::Logger.debug msg
|
|
10
10
|
|
|
11
11
|
begin
|
|
12
|
-
|
|
12
|
+
blob_client.release_blob_lease(container_name, name, lease_id, options)
|
|
13
13
|
rescue Azure::Core::Http::HTTPError => ex
|
|
14
14
|
raise_azure_exception(ex, msg)
|
|
15
15
|
end
|
data/lib/fog/azurerm/storage.rb
CHANGED
|
@@ -202,10 +202,10 @@ module Fog
|
|
|
202
202
|
end
|
|
203
203
|
|
|
204
204
|
# Refreshes the credential-derived state (@credentials, the token signer
|
|
205
|
-
# and the blob client) when the access token is near expiry.
|
|
206
|
-
#
|
|
207
|
-
#
|
|
208
|
-
#
|
|
205
|
+
# and the blob client) when the access token is near expiry. The SAS URL
|
|
206
|
+
# requests reach this through signature_client, and the data-plane
|
|
207
|
+
# requests reach it through the blob_client reader, so both keep their
|
|
208
|
+
# token fresh across rotation.
|
|
209
209
|
#
|
|
210
210
|
# The refresh is best-effort and non-blocking: a token fetch can be slow
|
|
211
211
|
# (or hang), so only one thread performs it at a time via a try-lock, and
|
|
@@ -241,6 +241,16 @@ module Fog
|
|
|
241
241
|
end
|
|
242
242
|
end
|
|
243
243
|
|
|
244
|
+
# Reader for the data-plane blob client. It refreshes an expiring access
|
|
245
|
+
# token first, so operations that read the client directly (blob
|
|
246
|
+
# properties, downloads, uploads, deletes) stay authenticated across
|
|
247
|
+
# token rotation, not only the SAS URL path. See
|
|
248
|
+
# https://gitlab.com/gitlab-org/ruby/gems/gitlab-fog-azure-rm/-/issues/11
|
|
249
|
+
def blob_client
|
|
250
|
+
maybe_refresh_credentials
|
|
251
|
+
@blob_client
|
|
252
|
+
end
|
|
253
|
+
|
|
244
254
|
# Returns the cached user delegation key, fetching a new one when the
|
|
245
255
|
# cache is empty or no longer covers requested_expiry. Must be called
|
|
246
256
|
# while holding @signature_mutex. Returns nil for shared-key auth, where
|
data/lib/fog/azurerm/version.rb
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
require File.expand_path '../../test_helper', __dir__
|
|
2
|
+
require 'azure/storage/common'
|
|
3
|
+
require 'azure/storage/blob'
|
|
4
|
+
require 'azure/core/auth/signer'
|
|
5
|
+
|
|
6
|
+
# Regression tests for
|
|
7
|
+
# https://gitlab.com/gitlab-org/ruby/gems/gitlab-fog-azure-rm/-/issues/11
|
|
8
|
+
#
|
|
9
|
+
# Data-plane requests (get_blob_properties, downloads, uploads, ...) read the
|
|
10
|
+
# blob client directly. They must refresh an expiring access token the same way
|
|
11
|
+
# the SAS URL path does, otherwise a long-lived process keeps signing with a
|
|
12
|
+
# stale token and Azure starts returning 401 after the token lifetime.
|
|
13
|
+
class TestCredentialRefreshOnBlobRequests < Minitest::Test
|
|
14
|
+
CONTAINER = 'test_container'.freeze
|
|
15
|
+
BLOB = 'test_blob'.freeze
|
|
16
|
+
|
|
17
|
+
# A blob client stand-in that needs no network and records the token it was
|
|
18
|
+
# built with, so a test can tell the refreshed client from the stale one.
|
|
19
|
+
class FakeBlobClient
|
|
20
|
+
attr_reader :token
|
|
21
|
+
|
|
22
|
+
def initialize(token)
|
|
23
|
+
@token = token
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def with_filter(*)
|
|
27
|
+
self
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def get_blob_properties(*)
|
|
31
|
+
MockBlob.new { |b| b.name = @token }
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def setup
|
|
36
|
+
@service = Fog::AzureRM::Storage.new(storage_account_credentials_with_token_signer)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def credentials(token, expires_at)
|
|
40
|
+
Fog::AzureRM::Identity::Credentials.new(token, expires_at)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def credential_client(&fetch)
|
|
44
|
+
client = Object.new
|
|
45
|
+
client.define_singleton_method(:fetch_credentials_if_needed, &fetch)
|
|
46
|
+
client
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# An expiring token is refreshed before the request runs, and the request uses
|
|
50
|
+
# the rebuilt client rather than the stale one.
|
|
51
|
+
def test_get_blob_properties_refreshes_an_expiring_token
|
|
52
|
+
stale = FakeBlobClient.new('stale-token')
|
|
53
|
+
fresh = FakeBlobClient.new('fresh-token')
|
|
54
|
+
fresh_credentials = credentials('fresh-token', Time.now + 3600)
|
|
55
|
+
|
|
56
|
+
@service.instance_variable_set(:@blob_client, stale)
|
|
57
|
+
@service.instance_variable_set(:@credentials, credentials('stale-token', Time.now - 1))
|
|
58
|
+
@service.instance_variable_set(:@credential_client, credential_client { fresh_credentials })
|
|
59
|
+
|
|
60
|
+
Azure::Storage::Blob::BlobService.stub(:new, ->(*, **) { fresh }) do
|
|
61
|
+
blob = @service.get_blob_properties(CONTAINER, BLOB)
|
|
62
|
+
assert_equal 'fresh-token', blob.name
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
assert_same fresh, @service.instance_variable_get(:@blob_client)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# A token that is still valid is not rebuilt, so a healthy request does not pay
|
|
69
|
+
# for a token fetch or a client rebuild on every call.
|
|
70
|
+
def test_get_blob_properties_does_not_rebuild_a_valid_token
|
|
71
|
+
current = FakeBlobClient.new('current-token')
|
|
72
|
+
|
|
73
|
+
@service.instance_variable_set(:@blob_client, current)
|
|
74
|
+
@service.instance_variable_set(:@credentials, credentials('current-token', Time.now + 3600))
|
|
75
|
+
@service.instance_variable_set(:@credential_client,
|
|
76
|
+
credential_client { raise 'should not refresh a valid token' })
|
|
77
|
+
|
|
78
|
+
Azure::Storage::Blob::BlobService.stub(:new, ->(*, **) { raise 'should not rebuild the client' }) do
|
|
79
|
+
blob = @service.get_blob_properties(CONTAINER, BLOB)
|
|
80
|
+
assert_equal 'current-token', blob.name
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
assert_same current, @service.instance_variable_get(:@blob_client)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -47,6 +47,36 @@ class TestWorkflowIdentityClient < Minitest::Test
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
# The OAuth v2.0 token endpoint returns expires_in, not expires_on. A fresh
|
|
51
|
+
# token must therefore report a real future expiry so refresh_needed? stays
|
|
52
|
+
# false until it is near expiry, rather than forcing a fetch on every request.
|
|
53
|
+
def test_fetch_credentials_uses_expires_in
|
|
54
|
+
ENV['AZURE_TENANT_ID'] = 'fake_tenant_id'
|
|
55
|
+
ENV['AZURE_CLIENT_ID'] = 'fake_client_id'
|
|
56
|
+
ENV['AZURE_FEDERATED_TOKEN_FILE'] = 'fake_token_file'
|
|
57
|
+
|
|
58
|
+
@client = Fog::AzureRM::Identity::WorkflowIdentityClient.new(@options)
|
|
59
|
+
|
|
60
|
+
token_response = {
|
|
61
|
+
'access_token' => 'fake_access_token',
|
|
62
|
+
'expires_in' => 3600
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
File.stub :exist?, true do
|
|
66
|
+
File.stub :readable?, true do
|
|
67
|
+
File.stub :read, 'fake_oidc_token' do
|
|
68
|
+
stub_request(:post, "#{@client.authority}/fake_tenant_id/oauth2/v2.0/token")
|
|
69
|
+
.to_return(status: 200, body: token_response.to_json)
|
|
70
|
+
|
|
71
|
+
credentials = @client.fetch_credentials
|
|
72
|
+
|
|
73
|
+
assert_in_delta (Time.now + 3600).to_f, credentials.expires_at.to_f, 5
|
|
74
|
+
refute credentials.refresh_needed?
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
50
80
|
def test_fetch_credentials_failure
|
|
51
81
|
ENV['AZURE_TENANT_ID'] = 'fake_tenant_id'
|
|
52
82
|
ENV['AZURE_CLIENT_ID'] = 'fake_client_id'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gitlab-fog-azure-rm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.
|
|
4
|
+
version: 2.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shaffan Chaudhry
|
|
@@ -18,7 +18,7 @@ authors:
|
|
|
18
18
|
autorequire:
|
|
19
19
|
bindir: bin
|
|
20
20
|
cert_chain: []
|
|
21
|
-
date: 2026-09-
|
|
21
|
+
date: 2026-09-23 00:00:00.000000000 Z
|
|
22
22
|
dependencies:
|
|
23
23
|
- !ruby/object:Gem::Dependency
|
|
24
24
|
name: codeclimate-test-reporter
|
|
@@ -449,6 +449,7 @@ files:
|
|
|
449
449
|
- test/requests/storage/test_create_block_blob.rb
|
|
450
450
|
- test/requests/storage/test_create_container.rb
|
|
451
451
|
- test/requests/storage/test_create_page_blob.rb
|
|
452
|
+
- test/requests/storage/test_credential_refresh_on_blob_requests.rb
|
|
452
453
|
- test/requests/storage/test_delete_blob.rb
|
|
453
454
|
- test/requests/storage/test_delete_blob_https_url.rb
|
|
454
455
|
- test/requests/storage/test_delete_container.rb
|