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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
472a6621
Commit
472a6621
authored
Oct 23, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix LDAP config lookup for provider 'ldap'
parent
1c1d9f78
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
12 deletions
+32
-12
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab/ldap/config.rb
lib/gitlab/ldap/config.rb
+16
-11
spec/lib/gitlab/ldap/config_spec.rb
spec/lib/gitlab/ldap/config_spec.rb
+15
-1
No files found.
CHANGELOG
View file @
472a6621
...
...
@@ -2,6 +2,7 @@ v 7.5.0
- API: Add support for Hipchat (Kevin Houdebert)
- Add time zone configuration on gitlab.yml (Sullivan Senechal)
- Fix LDAP authentication for Git HTTP access
- Fix LDAP config lookup for provider 'ldap'
v 7.4.0
- Refactored membership logic
...
...
lib/gitlab/ldap/config.rb
View file @
472a6621
...
...
@@ -16,10 +16,23 @@ module Gitlab
servers
.
map
{
|
server
|
server
[
'provider_name'
]
}
end
def
self
.
valid_provider?
(
provider
)
providers
.
include?
(
provider
)
end
def
self
.
invalid_provider
(
provider
)
raise
"Unknown provider (
#{
provider
}
). Available providers:
#{
providers
}
"
end
def
initialize
(
provider
)
if
self
.
class
.
valid_provider?
(
provider
)
@provider
=
provider
invalid_provider
unless
valid_provider?
@options
=
config_for
(
provider
)
elsif
provider
==
'ldap'
@provider
=
self
.
class
.
providers
.
first
else
self
.
class
.
invalid_provider
(
provider
)
end
@options
=
config_for
(
@provider
)
# Use @provider, not provider
end
def
enabled?
...
...
@@ -89,14 +102,6 @@ module Gitlab
end
end
def
valid_provider?
self
.
class
.
providers
.
include?
(
provider
)
end
def
invalid_provider
raise
"Unknown provider (
#{
provider
}
). Available providers:
#{
self
.
class
.
providers
}
"
end
def
auth_options
{
auth:
{
...
...
spec/lib/gitlab/ldap/config_spec.rb
View file @
472a6621
...
...
@@ -16,5 +16,19 @@ describe Gitlab::LDAP::Config do
it
"raises an error if a unknow provider is used"
do
expect
{
Gitlab
::
LDAP
::
Config
.
new
'unknown'
}.
to
raise_error
end
context
"if 'ldap' is the provider name"
do
let
(
:provider
)
{
'ldap'
}
context
"and 'ldap' is not in defined as a provider"
do
before
{
Gitlab
::
LDAP
::
Config
.
stub
(
providers:
%w{ldapmain}
)
}
it
"uses the first provider"
do
# Fetch the provider_name attribute from 'options' so that we know
# that the 'options' Hash is not empty/nil.
expect
(
config
.
options
[
'provider_name'
]).
to
eq
(
'ldapmain'
)
end
end
end
end
end
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