diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-06-09 10:30:38 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-07-26 02:43:36 -0700 |
commit | 2d7d1fa69db2b5e0056d5ab8884684886229f852 (patch) | |
tree | 0cb7cb14dc30701f34325b27671684b897a9582c | |
parent | c8dd77de81f42c593dcbf0b373afd0ab33f18071 (diff) | |
download | gitlab-ce-2d7d1fa69db2b5e0056d5ab8884684886229f852.tar.gz |
Pass configured `ssl_version` to `omniauth-ldap`
-rw-r--r-- | lib/gitlab/ldap/config.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ldap/config_spec.rb | 31 |
2 files changed, 33 insertions, 0 deletions
diff --git a/lib/gitlab/ldap/config.rb b/lib/gitlab/ldap/config.rb index 3f88e20bbec..efc3c50e038 100644 --- a/lib/gitlab/ldap/config.rb +++ b/lib/gitlab/ldap/config.rb @@ -74,6 +74,8 @@ module Gitlab end opts[:ca_file] = options['ca_file'] if options['ca_file'].present? + opts[:ssl_version] = options['ssl_version'] if options['ssl_version'].present? + opts end diff --git a/spec/lib/gitlab/ldap/config_spec.rb b/spec/lib/gitlab/ldap/config_spec.rb index 107084519f9..7679c9ea913 100644 --- a/spec/lib/gitlab/ldap/config_spec.rb +++ b/spec/lib/gitlab/ldap/config_spec.rb @@ -301,6 +301,37 @@ describe Gitlab::LDAP::Config, lib: true do 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 describe '#has_auth?' do |