Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
b8e54fbc
Unverified
Commit
b8e54fbc
authored
7 years ago
by
Richard van der Hoff
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2607 from matrix-org/rav/cleanup_ldap_hacks
Clean up backwards-compat hacks for ldap
parents
a1f8b0fd
ffc574a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/config/password_auth_providers.py
+19
-20
19 additions, 20 deletions
synapse/config/password_auth_providers.py
with
19 additions
and
20 deletions
synapse/config/password_auth_providers.py
+
19
−
20
View file @
b8e54fbc
...
...
@@ -13,41 +13,40 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
._base
import
Config
,
ConfigError
from
._base
import
Config
from
synapse.util.module_loader
import
load_module
LDAP_PROVIDER
=
'
ldap_auth_provider.LdapAuthProvider
'
class
PasswordAuthProviderConfig
(
Config
):
def
read_config
(
self
,
config
):
self
.
password_providers
=
[]
provider_config
=
None
providers
=
[]
# We want to be backwards compatible with the old `ldap_config`
# param.
ldap_config
=
config
.
get
(
"
ldap_config
"
,
{})
self
.
ldap_enabled
=
ldap_config
.
get
(
"
enabled
"
,
False
)
if
self
.
ld
ap
_
en
abled
:
from
ldap_auth_provider
import
LdapAuthProvider
parsed_config
=
LdapAuthProvider
.
parse_
config
(
ldap_config
)
self
.
password_providers
.
append
((
LdapAuthProvider
,
parsed_config
))
if
ldap_config
.
get
(
"
enabled
"
,
False
)
:
providers
.
ap
p
en
d
[{
'
module
'
:
LDAP_PROVIDER
,
'
config
'
:
ldap_config
,
}]
providers
=
config
.
get
(
"
password_providers
"
,
[])
providers
.
extend
(
config
.
get
(
"
password_providers
"
,
[])
)
for
provider
in
providers
:
mod_name
=
provider
[
'
module
'
]
# This is for backwards compat when the ldap auth provider resided
# in this package.
if
provider
[
'
module
'
]
==
"
synapse.util.ldap_auth_provider.LdapAuthProvider
"
:
from
ldap_auth_provider
import
LdapAuthProvider
provider_class
=
LdapAuthProvider
try
:
provider_config
=
provider_class
.
parse_config
(
provider
[
"
config
"
])
except
Exception
as
e
:
raise
ConfigError
(
"
Failed to parse config for %r: %r
"
%
(
provider
[
'
module
'
],
e
)
)
else
:
(
provider_class
,
provider_config
)
=
load_module
(
provider
)
if
mod_name
==
"
synapse.util.ldap_auth_provider.LdapAuthProvider
"
:
mod_name
=
LDAP_PROVIDER
(
provider_class
,
provider_config
)
=
load_module
({
"
module
"
:
mod_name
,
"
config
"
:
provider
[
'
config
'
],
})
self
.
password_providers
.
append
((
provider_class
,
provider_config
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment