Skip to content

Commit 4780e89

Browse files
authored
Merge pull request #135 from ostap36/allow_aws-ec2_nonce_be_optional
Allow aws-ec2 nonce be optional
2 parents c35a958 + c142eab commit 4780e89

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/vault/api/auth.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,13 @@ def github(github_token)
173173
# @param [String] role
174174
# @param [String] pkcs7
175175
# pkcs7 returned by the instance identity document (with line breaks removed)
176-
# @param [String] nonce
176+
# @param [String] nonce optional
177177
#
178178
# @return [Secret]
179-
def aws_ec2(role, pkcs7, nonce)
180-
payload = { role: role, pkcs7: pkcs7, nonce: nonce }
179+
def aws_ec2(role, pkcs7, nonce = nil)
180+
payload = { role: role, pkcs7: pkcs7 }
181+
# Set a custom nonce if client is providing one
182+
payload[:nonce] = nonce if nonce
181183
json = client.post('/v1/auth/aws-ec2/login', JSON.fast_generate(payload))
182184
secret = Secret.decode(json)
183185
client.token = secret.auth.client_token

0 commit comments

Comments
 (0)