Commit b57cf4ae authored by Imre Farkas's avatar Imre Farkas

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

parent c2b3f64c
- 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