rails_kms_credentials 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1722bd0996c3a1be492c2bfa72531791a1ac30ed88cb159102a6661e60e3270
|
4
|
+
data.tar.gz: 0d9f6bcd5bcddc442e1712b2dfb247c5c71c85fb6636b7777be345e05bb1e2df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c443e4a5aa075dcf08c675bcfccbc1d49e781b17451370f0bb26f7803dc636df09c4644b4e85a4c6e20675787e97bfa959a19eef045d831f8c2a81f9112663ed
|
7
|
+
data.tar.gz: 8db14c441562ee1438df718fd7700f57f86d0967ff364471cfb60e8b770e0a6c47b8d258b24a3aafeeb9a0ab722ab8bca79eb8de0990c2098401f03c7389fbb5
|
@@ -6,13 +6,37 @@ module RailsKmsCredentials
|
|
6
6
|
module Client
|
7
7
|
class ManagedIdentity < Base
|
8
8
|
def get_secrets_list(url)
|
9
|
-
HTTParty.get
|
9
|
+
HTTParty.get(
|
10
|
+
url,
|
11
|
+
headers: {
|
12
|
+
Authorization: "Bearer #{access_token}",
|
13
|
+
},
|
14
|
+
)
|
10
15
|
end
|
11
16
|
|
12
17
|
def get_secret(url)
|
13
|
-
HTTParty.get
|
18
|
+
HTTParty.get(
|
19
|
+
url,
|
20
|
+
headers: {
|
21
|
+
Authorization: "Bearer #{access_token}",
|
22
|
+
},
|
23
|
+
)
|
14
24
|
end
|
15
25
|
|
26
|
+
private
|
27
|
+
|
28
|
+
def access_token
|
29
|
+
return @access_token if instance_variable_defined?(:@access_token)
|
30
|
+
@_access_token_response = HTTParty.get(
|
31
|
+
'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net',
|
32
|
+
{
|
33
|
+
headers: { Metadata: 'true' },
|
34
|
+
}
|
35
|
+
)
|
36
|
+
raise 'KmsCredentials AzureKeyVault ClientCredentials unable to get access token' unless @_access_token_response.ok?
|
37
|
+
@access_token = @_access_token_response['access_token']
|
38
|
+
end
|
39
|
+
|
16
40
|
end
|
17
41
|
|
18
42
|
add(:managed_identity, ManagedIdentity)
|