diff --git a/Gemfile b/Gemfile
index 276893d0ff486ff9be2b2aa61cf868ce9d0f73ff..7bb912571f4905dcdd0cb71bf2798f5718bd197d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -61,7 +61,7 @@ gem 'browser', '~> 2.2'
 # LDAP Auth
 # GitLab fork with several improvements to original library. For full list of changes
 # see https://github.com/intridea/omniauth-ldap/compare/master...gitlabhq:master
-gem 'gitlab_omniauth-ldap', '~> 2.0.1', require: 'omniauth-ldap'
+gem 'gitlab_omniauth-ldap', '~> 2.0.2', require: 'omniauth-ldap'
 
 # Git Wiki
 # Required manually in config/initializers/gollum.rb to control load order
diff --git a/Gemfile.lock b/Gemfile.lock
index 2b2df1b6bcc5bae731cb0f5e0d3a6a6aef713d2c..661f029464655fca081346134f2d4e0280306a91 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -288,7 +288,7 @@ GEM
       mime-types (>= 1.16, < 3)
       posix-spawn (~> 0.3)
     gitlab-markup (1.5.1)
-    gitlab_omniauth-ldap (2.0.1)
+    gitlab_omniauth-ldap (2.0.2)
       net-ldap (~> 0.16)
       omniauth (~> 1.3)
       pyu-ruby-sasl (>= 0.0.3.3, < 0.1)
@@ -978,7 +978,7 @@ DEPENDENCIES
   github-linguist (~> 4.7.0)
   gitlab-flowdock-git-hook (~> 1.0.1)
   gitlab-markup (~> 1.5.1)
-  gitlab_omniauth-ldap (~> 2.0.1)
+  gitlab_omniauth-ldap (~> 2.0.2)
   gollum-lib (~> 4.2)
   gollum-rugged_adapter (~> 0.4.4)
   gon (~> 6.1.0)
diff --git a/lib/gitlab/ldap/config.rb b/lib/gitlab/ldap/config.rb
index 163e49ecc1c6f8e8b1f15538e131075b556a9c30..8eda3ea03f9d29c28e46a3d65518321381587262 100644
--- a/lib/gitlab/ldap/config.rb
+++ b/lib/gitlab/ldap/config.rb
@@ -169,9 +169,12 @@ module Gitlab
 
       def encryption_options
         method = translate_method(options['encryption'])
-        options = { method: method }
-        options[:tls_options] = tls_options(method) if method
-        options
+        return nil unless method
+
+        {
+          method: method,
+          tls_options: tls_options(method)
+        }
       end
 
       def translate_method(method_from_config)
diff --git a/spec/lib/gitlab/ldap/config_spec.rb b/spec/lib/gitlab/ldap/config_spec.rb
index e3a9505531ddab97184420e561439bff980bed24..3a56797d68ba6d9e2f5d3f078548d0ab7b8e31ad 100644
--- a/spec/lib/gitlab/ldap/config_spec.rb
+++ b/spec/lib/gitlab/ldap/config_spec.rb
@@ -32,7 +32,7 @@ describe Gitlab::LDAP::Config, lib: true do
       expect(config.adapter_options).to eq(
         host: 'ldap.example.com',
         port: 386,
-        encryption: { method: nil }
+        encryption: nil
       )
     end