Commit 2d7d1fa6 authored by Michael Kozono's avatar Michael Kozono

Pass configured `ssl_version` to `omniauth-ldap`

parent c8dd77de
...@@ -74,6 +74,8 @@ module Gitlab ...@@ -74,6 +74,8 @@ module Gitlab
end end
opts[:ca_file] = options['ca_file'] if options['ca_file'].present? opts[:ca_file] = options['ca_file'] if options['ca_file'].present?
opts[:ssl_version] = options['ssl_version'] if options['ssl_version'].present?
opts opts
end end
......
...@@ -301,6 +301,37 @@ describe Gitlab::LDAP::Config, lib: true do ...@@ -301,6 +301,37 @@ describe Gitlab::LDAP::Config, lib: true do
end end
end end
context 'when ssl_version is present' do
it 'passes it through' do
stub_ldap_config(
options: {
'host' => 'ldap.example.com',
'port' => 686,
'encryption' => 'simple_tls',
'verify_certificates' => true,
'ssl_version' => 'TLSv1_2'
}
)
expect(config.omniauth_options).to include({ ssl_version: 'TLSv1_2' })
end
end
context 'when ssl_version is blank' do
it 'does not include the ssl_version option' do
stub_ldap_config(
options: {
'host' => 'ldap.example.com',
'port' => 686,
'encryption' => 'simple_tls',
'verify_certificates' => true,
'ssl_version' => ' '
}
)
expect(config.omniauth_options).not_to have_key(:ssl_version)
end
end
end end
describe '#has_auth?' do describe '#has_auth?' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment