-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IAM EC2 auth #161
Add IAM EC2 auth #161
Changes from 6 commits
4432283
b70de61
78c05e9
60f70e2
7602166
75fd1b0
cc1365b
128fdef
e598ffc
98ddc19
11a5cde
6217a9f
370d7e0
d23372a
d8357d4
1321c11
1a57422
9f4ff2f
ca17bac
43e211d
63a54f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -216,6 +216,7 @@ module Vault | |
describe "#aws_iam" do | ||
before(:context) do | ||
vault_test_client.sys.enable_auth("aws", "aws", nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be good to also configure the header value here and then insert it, just to ensure it gets processed properly. |
||
vault_test_client.sys.put_auth_tune("aws", "iam_server_id_header_value" => "iam_header_canary") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the |
||
end | ||
|
||
after(:context) do | ||
|
@@ -243,7 +244,7 @@ module Vault | |
service: 'sts', region: 'cn-north-1', credentials_provider: credentials_provider | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this expectation could obviate the need for the comment in e598ffc |
||
).and_call_original | ||
) | ||
subject.auth.aws_iam('yabba', credentials_provider, 'canary_header', 'https://sts.cn-north-1.amazonaws.com.cn') | ||
subject.auth.aws_iam('yabba', credentials_provider, 'iam_header_canary', 'https://sts.cn-north-1.amazonaws.com.cn') | ||
end | ||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require "spec_helper" | ||
|
||
module Vault | ||
describe Authenticate do | ||
let(:auth) { Authenticate.new(client: nil) } | ||
describe "#region_from_sts_endpoint" do | ||
subject { auth.send(:region_from_sts_endpoint, sts_endpoint) } | ||
|
||
context 'with a china endpoint' do | ||
let(:sts_endpoint) { "https://sts.cn-north-1.amazonaws.com.cn" } | ||
it { is_expected.to eq 'cn-north-1' } | ||
end | ||
|
||
context 'with a GovCloud endpoint' do | ||
let(:sts_endpoint) { "https://sts.us-gov-west-1.amazonaws.com" } | ||
it { is_expected.to eq 'us-gov-west-1' } | ||
end | ||
|
||
context 'with no regional endpoint' do | ||
let(:sts_endpoint) { "https://sts.amazonaws.com" } | ||
it { is_expected.to eq 'us-east-1' } | ||
end | ||
|
||
context 'with a malformed url' do | ||
let(:sts_endpoint) { "https:sts.amazonaws.com" } | ||
it { expect { subject }.to raise_exception(StandardError, "Unable to parse STS endpoint https:sts.amazonaws.com") } | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like something left over from copy/pasting?