Skip to content

Commit

Permalink
Make Vault header optional
Browse files Browse the repository at this point in the history
  • Loading branch information
maschwenk committed Dec 20, 2017
1 parent b70de61 commit 78c05e9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/vault/api/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ def aws_ec2(role, pkcs7, nonce = nil)
# Vault.auth.aws_ec2_iam("dev-role-iam", "vault.example.com") #=> #<Vault::Secret lease_id="">
#
# @param [String] role
# @param [String] iam_auth_header_vaule
# @param [String] iam_auth_header_value optional
#
# @return [Secret]
def aws_ec2_iam(role, iam_auth_header_value)
def aws_ec2_iam(role, iam_auth_header_value = IAM_SERVER_ID_HEADER)
aws_meta_data_host = 'http://169.254.169.254'
document_uri = URI.join(aws_meta_data_host, '/latest/dynamic/instance-identity/document')
document_api_response = Net::HTTP.get(document_uri)
Expand All @@ -219,7 +219,6 @@ def aws_ec2_iam(role, iam_auth_header_value)
request_body = 'Action=GetCallerIdentity&Version=2011-06-15'
request_url = 'https://sts.amazonaws.com/'
request_method = 'POST'
iam_auth_header_value ||= IAM_SERVER_ID_HEADER

vault_headers = {
'User-Agent' => Vault::Client::USER_AGENT,
Expand Down

0 comments on commit 78c05e9

Please sign in to comment.