-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add whitelist_headers to client config
- Loading branch information
Showing
8 changed files
with
61 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
aws-sdk-core/lib/aws-sdk-core/plugins/sigv4_whitelist_headers.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Aws | ||
module Plugins | ||
|
||
# @seahorse.client.option [Array] :whitelist_headers ([]) | ||
# headers value provided in :whitelist_option will escape | ||
# blacklis_header check in v4 signer | ||
class WhitelistHeaders < Seahorse::Client::Plugin | ||
|
||
option(:whitelist_headers, []) | ||
|
||
class Handler < Seahorse::Client::Handler | ||
|
||
def add_handlers(handlers, config) | ||
handlers.add(Handler, step: :sign) | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
aws-sdk-core/spec/aws/plugins/sigv4_whitelist_headers_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
|
||
module Aws | ||
module Plugins | ||
describe WhitelistHeaders do | ||
|
||
let(:plugin) { WhitelistHeaders.new } | ||
|
||
let(:config) { Seahorse::Client::Configuration.new } | ||
|
||
describe 'sigv4 whitelist headers' do | ||
|
||
it 'accepts a sigv4 whitelist headers configuration option' do | ||
plugin.add_options(config) | ||
expect( | ||
config.build!(whitelist_headers: ['foo', 'bar']).whitelist_headers | ||
).to eq(['foo', 'bar']) | ||
end | ||
|
||
it 'defaults the sig4 whitelist headers to an empty array' do | ||
plugin.add_options(config) | ||
expect(config.build!.whitelist_headers).to eq([]) | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |