Merge "[oslo.middleware] Add support for basic auth middleware options"

This commit is contained in:
Zuul 2021-08-24 09:13:42 +00:00 committed by Gerrit Code Review
commit b05244e2a1
3 changed files with 19 additions and 1 deletions

View File

@ -17,13 +17,23 @@
# (boolean value)
# Defaults to $::os_service_default.
#
# [*http_basic_auth_user_file*]
# (Optional) HTTP basic auth password file.
# (string value)
# Defaults to $::os_service_default.
#
define oslo::middleware(
# sizelimit
$max_request_body_size = $::os_service_default,
# http_proxy_to_wsgi
$enable_proxy_headers_parsing = $::os_service_default,
# basic_auth
$http_basic_auth_user_file = $::os_service_default,
) {
$middleware_options = {
'oslo_middleware/max_request_body_size' => { value => $max_request_body_size },
'oslo_middleware/enable_proxy_headers_parsing' => { value => $enable_proxy_headers_parsing },
'oslo_middleware/http_basic_auth_user_file' => { value => $http_basic_auth_user_file },
}
create_resources($name, $middleware_options)
}

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``oslo::middleware::http_basic_auth_userfile`` parameter has been
added.

View File

@ -10,6 +10,7 @@ describe 'oslo::middleware' do
it 'configure oslo_middleware default params' do
is_expected.to contain_keystone_config('oslo_middleware/max_request_body_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_middleware/enable_proxy_headers_parsing').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_middleware/http_basic_auth_user_file').with_value('<SERVICE DEFAULT>')
end
end
@ -17,13 +18,15 @@ describe 'oslo::middleware' do
context 'with overridden parameters' do
let :params do
{
:max_request_body_size => 114600,
:max_request_body_size => 114600,
:enable_proxy_headers_parsing => true,
:http_basic_auth_user_file => '/etc/htpasswd',
}
end
it 'configure oslo_middleware with overridden values' do
is_expected.to contain_keystone_config('oslo_middleware/max_request_body_size').with_value(114600)
is_expected.to contain_keystone_config('oslo_middleware/enable_proxy_headers_parsing').with_value(true)
is_expected.to contain_keystone_config('oslo_middleware/http_basic_auth_user_file').with_value('/etc/htpasswd')
end
end