Commit 1350e3ae authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'if-7693-smartcard_ldap_integration-ee_backport' into 'master'

Backport of ee/9235: Add LDAP integration to smartcard authentication

See merge request gitlab-org/gitlab-ce!24704
parents 49f9502d b57cf4ae
- server = local_assigns.fetch(:server)
= form_tag(omniauth_callback_path(:user, server['provider_name']), id: 'new_ldap_user', class: "gl-show-field-errors") do = form_tag(omniauth_callback_path(:user, server['provider_name']), id: 'new_ldap_user', class: "gl-show-field-errors") do
.form-group .form-group
= label_tag :username, "#{server['label']} Username" = label_tag :username, "#{server['label']} Username"
......
...@@ -30,14 +30,7 @@ module Gitlab ...@@ -30,14 +30,7 @@ module Gitlab
def users(fields, value, limit = nil) def users(fields, value, limit = nil)
options = user_options(Array(fields), value, limit) options = user_options(Array(fields), value, limit)
users_search(options)
entries = ldap_search(options).select do |entry|
entry.respond_to? config.uid
end
entries.map do |entry|
Gitlab::Auth::LDAP::Person.new(entry, provider)
end
end end
def user(*args) def user(*args)
...@@ -90,6 +83,16 @@ module Gitlab ...@@ -90,6 +83,16 @@ module Gitlab
SEARCH_RETRY_FACTOR[retry_number] * config.timeout SEARCH_RETRY_FACTOR[retry_number] * config.timeout
end end
def users_search(options)
entries = ldap_search(options).select do |entry|
entry.respond_to? config.uid
end
entries.map do |entry|
Gitlab::Auth::LDAP::Person.new(entry, provider)
end
end
def user_options(fields, value, limit) def user_options(fields, value, limit)
options = { options = {
attributes: Gitlab::Auth::LDAP::Person.ldap_attributes(config), attributes: Gitlab::Auth::LDAP::Person.ldap_attributes(config),
......
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