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
ddb46f48
Commit
ddb46f48
authored
Oct 08, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain auth logic some more
parent
c0229e46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+3
-1
spec/lib/gitlab/auth_spec.rb
spec/lib/gitlab/auth_spec.rb
+1
-2
No files found.
lib/gitlab/auth.rb
View file @
ddb46f48
...
...
@@ -3,9 +3,11 @@ module Gitlab
def
find
(
login
,
password
)
user
=
User
.
find_by
(
email:
login
)
||
User
.
find_by
(
username:
login
)
# If no user is found, or it's an LDAP server, try LDAP.
# LDAP users are only authenticated via LDAP
if
user
.
nil?
||
user
.
ldap_user?
# Second chance - try LDAP authentication
return
nil
unless
ldap_conf
.
enabled
return
nil
unless
Gitlab
::
LDAP
::
Config
.
enabled?
Gitlab
::
LDAP
::
User
.
authenticate
(
login
,
password
)
else
...
...
spec/lib/gitlab/auth_spec.rb
View file @
ddb46f48
...
...
@@ -28,8 +28,7 @@ describe Gitlab::Auth do
end
context
"with ldap enabled"
do
before
{
Gitlab
.
config
.
ldap
[
'enabled'
]
=
true
}
after
{
Gitlab
.
config
.
ldap
[
'enabled'
]
=
false
}
before
{
Gitlab
::
LDAP
::
Config
.
enabled
.
stub
(
enabled?:
true
)
}
it
"tries to autheticate with db before ldap"
do
expect
(
Gitlab
::
LDAP
::
User
).
not_to
receive
(
:authenticate
)
...
...
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