Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
07de7bca
Commit
07de7bca
authored
Jul 29, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add group base to config. Join auth options only if provided
parent
f9f1649f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
config/gitlab.yml.example
config/gitlab.yml.example
+13
-1
lib/gitlab/ldap.rb
lib/gitlab/ldap.rb
+12
-3
No files found.
config/gitlab.yml.example
View file @
07de7bca
...
@@ -91,7 +91,6 @@ production: &base
...
@@ -91,7 +91,6 @@ production: &base
ldap:
ldap:
enabled: false
enabled: false
host: '_your_ldap_server'
host: '_your_ldap_server'
base: '_the_base_where_you_search_for_users'
port: 636
port: 636
uid: 'sAMAccountName'
uid: 'sAMAccountName'
method: 'ssl' # "ssl" or "plain"
method: 'ssl' # "ssl" or "plain"
...
@@ -99,6 +98,19 @@ production: &base
...
@@ -99,6 +98,19 @@ production: &base
password: '_the_password_of_the_bind_user'
password: '_the_password_of_the_bind_user'
allow_username_or_email_login: true
allow_username_or_email_login: true
# Base where we can search for users
#
# Ex. ou=People,dc=gitlab,dc=example
#
base: ''
# Base where we can search for groups
#
# Ex. ou=Groups,dc=gitlab,dc=example
#
group_base: ''
## OmniAuth settings
## OmniAuth settings
omniauth:
omniauth:
# Allow login via Twitter, Google, etc. using OmniAuth providers
# Allow login via Twitter, Google, etc. using OmniAuth providers
...
...
lib/gitlab/ldap.rb
View file @
07de7bca
...
@@ -3,15 +3,24 @@ module Gitlab
...
@@ -3,15 +3,24 @@ module Gitlab
attr_reader
:ldap
attr_reader
:ldap
def
initialize
def
initialize
@ldap
=
Net
::
LDAP
.
new
(
options
=
{
host:
config
[
'host'
],
host:
config
[
'host'
],
port:
config
[
'port'
],
port:
config
[
'port'
],
}
auth_options
=
{
auth:
{
auth:
{
method:
config
[
'method'
],
method:
config
[
'method'
],
username:
config
[
'bind_dn'
],
username:
config
[
'bind_dn'
],
password:
config
[
'password'
]
password:
config
[
'password'
]
}
}
)
}
if
config
[
'password'
]
||
config
[
'bind_dn'
]
options
.
merge!
(
auth_options
)
end
@ldap
=
Net
::
LDAP
.
new
(
options
)
end
end
# Get LDAP groups from ou=Groups
# Get LDAP groups from ou=Groups
...
@@ -23,7 +32,7 @@ module Gitlab
...
@@ -23,7 +32,7 @@ module Gitlab
#
#
def
groups
(
cn
=
"*"
)
def
groups
(
cn
=
"*"
)
options
=
{
options
=
{
base:
"ou=Groups,
#{
config
[
'base'
]
}
"
,
base:
config
[
'group_base'
]
,
filter:
Net
::
LDAP
::
Filter
.
eq
(
"cn"
,
cn
)
filter:
Net
::
LDAP
::
Filter
.
eq
(
"cn"
,
cn
)
}
}
...
...
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