BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a64e3d08
Commit
a64e3d08
authored
Jul 26, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-24' into 'master'
Use LDAP-attributes configured in gitlab.yml in lookup instead of just hard-coded attributes. See merge request !13054
parents
0c563225
a5d2ce8e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
adapter.rb
lib/gitlab/ldap/adapter.rb
+1
-1
adapter_spec.rb
spec/lib/gitlab/ldap/adapter_spec.rb
+3
-3
No files found.
lib/gitlab/ldap/adapter.rb
View file @
a64e3d08
...
...
@@ -101,7 +101,7 @@ module Gitlab
end
def
user_attributes
%W(
#{
config
.
uid
}
cn
mail dn)
%W(
#{
config
.
uid
}
cn
dn)
+
config
.
attributes
[
'username'
]
+
config
.
attributes
[
'email'
]
end
end
end
...
...
spec/lib/gitlab/ldap/adapter_spec.rb
View file @
a64e3d08
...
...
@@ -16,7 +16,7 @@ describe Gitlab::LDAP::Adapter, lib: true do
expect
(
adapter
).
to
receive
(
:ldap_search
)
do
|
arg
|
expect
(
arg
[
:filter
].
to_s
).
to
eq
(
'(uid=johndoe)'
)
expect
(
arg
[
:base
]).
to
eq
(
'dc=example,dc=com'
)
expect
(
arg
[
:attributes
]).
to
match
(
%w{uid cn
mail dn
}
)
expect
(
arg
[
:attributes
]).
to
match
(
%w{uid cn
dn uid userid sAMAccountName mail email userPrincipalName
}
)
end
.
and_return
({})
adapter
.
users
(
'uid'
,
'johndoe'
)
...
...
@@ -26,7 +26,7 @@ describe Gitlab::LDAP::Adapter, lib: true do
expect
(
adapter
).
to
receive
(
:ldap_search
).
with
(
base:
'uid=johndoe,ou=users,dc=example,dc=com'
,
scope:
Net
::
LDAP
::
SearchScope_BaseObject
,
attributes:
%w{uid cn
mail dn
}
,
attributes:
%w{uid cn
dn uid userid sAMAccountName mail email userPrincipalName
}
,
filter:
nil
).
and_return
({})
...
...
@@ -63,7 +63,7 @@ describe Gitlab::LDAP::Adapter, lib: true do
it
'uses the right uid attribute when non-default'
do
stub_ldap_config
(
uid:
'sAMAccountName'
)
expect
(
adapter
).
to
receive
(
:ldap_search
).
with
(
hash_including
(
attributes:
%w{sAMAccountName cn
mail dn
}
)
hash_including
(
attributes:
%w{sAMAccountName cn
dn uid userid sAMAccountName mail email userPrincipalName
}
)
).
and_return
({})
adapter
.
users
(
'sAMAccountName'
,
'johndoe'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment