summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-06-09 10:30:17 -0700
committerMichael Kozono <mkozono@gmail.com>2017-07-26 02:43:35 -0700
commitc8dd77de81f42c593dcbf0b373afd0ab33f18071 (patch)
tree79b0bd25f9f0cc40a93422fbc44ade3701b71961 /spec
parentcd13e4ae734f6a5ff2d02986138bda54267425ae (diff)
downloadgitlab-ce-c8dd77de81f42c593dcbf0b373afd0ab33f18071.tar.gz
Pass configured `ca_file` to `omniauth-ldap`
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/ldap/config_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ldap/config_spec.rb b/spec/lib/gitlab/ldap/config_spec.rb
index 0cebbab5c24..107084519f9 100644
--- a/spec/lib/gitlab/ldap/config_spec.rb
+++ b/spec/lib/gitlab/ldap/config_spec.rb
@@ -268,6 +268,39 @@ describe Gitlab::LDAP::Config, lib: true do
expect(config.omniauth_options).to include({ disable_verify_certificates: true })
end
end
+
+ context 'when ca_file is present' do
+ it 'passes it through' do
+ stub_ldap_config(
+ options: {
+ 'host' => 'ldap.example.com',
+ 'port' => 686,
+ 'encryption' => 'simple_tls',
+ 'verify_certificates' => true,
+ 'ca_file' => '/etc/ca.pem'
+ }
+ )
+
+ expect(config.omniauth_options).to include({ ca_file: '/etc/ca.pem' })
+ end
+ end
+
+ context 'when ca_file is blank' do
+ it 'does not include the ca_file option' do
+ stub_ldap_config(
+ options: {
+ 'host' => 'ldap.example.com',
+ 'port' => 686,
+ 'encryption' => 'simple_tls',
+ 'verify_certificates' => true,
+ 'ca_file' => ' '
+ }
+ )
+
+ expect(config.omniauth_options).not_to have_key(:ca_file)
+ end
+ end
+
end
describe '#has_auth?' do