Skip to content

Commit 03bb723

Browse files
authored
Merge pull request #166 from briancain/provide-custom-aws_ec2-route
(#164) Allow for custom aws_ec2 route
2 parents ed2c063 + a7a2a99 commit 03bb723

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/vault/api/auth.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,15 @@ def github(github_token)
174174
# @param [String] pkcs7
175175
# pkcs7 returned by the instance identity document (with line breaks removed)
176176
# @param [String] nonce optional
177+
# @param [String] route optional
177178
#
178179
# @return [Secret]
179-
def aws_ec2(role, pkcs7, nonce = nil)
180+
def aws_ec2(role, pkcs7, nonce = nil, route = nil)
181+
route ||= '/v1/auth/aws-ec2/login'
180182
payload = { role: role, pkcs7: pkcs7 }
181183
# Set a custom nonce if client is providing one
182184
payload[:nonce] = nonce if nonce
183-
json = client.post('/v1/auth/aws-ec2/login', JSON.fast_generate(payload))
185+
json = client.post(route, JSON.fast_generate(payload))
184186
secret = Secret.decode(json)
185187
client.token = secret.auth.client_token
186188
return secret

0 commit comments

Comments
 (0)