Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
e2be655d
Commit
e2be655d
authored
Nov 22, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update LDAP, fix Windows AD login (#1697)
parent
2cd653c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
11 deletions
+4
-11
simpleldap.py
cps/services/simpleldap.py
+4
-11
No files found.
cps/services/simpleldap.py
View file @
e2be655d
...
@@ -38,6 +38,7 @@ def init_app(app, config):
...
@@ -38,6 +38,7 @@ def init_app(app, config):
app
.
config
[
'LDAP_HOST'
]
=
config
.
config_ldap_provider_url
app
.
config
[
'LDAP_HOST'
]
=
config
.
config_ldap_provider_url
app
.
config
[
'LDAP_PORT'
]
=
config
.
config_ldap_port
app
.
config
[
'LDAP_PORT'
]
=
config
.
config_ldap_port
app
.
config
[
'LDAP_CUSTOM_OPTIONS'
]
=
{
pyLDAP
.
OPT_REFERRALS
,
0
}
if
config
.
config_ldap_encryption
==
2
:
if
config
.
config_ldap_encryption
==
2
:
app
.
config
[
'LDAP_SCHEMA'
]
=
'ldaps'
app
.
config
[
'LDAP_SCHEMA'
]
=
'ldaps'
else
:
else
:
...
@@ -54,15 +55,13 @@ def init_app(app, config):
...
@@ -54,15 +55,13 @@ def init_app(app, config):
app
.
config
[
'LDAP_USERNAME'
]
=
""
app
.
config
[
'LDAP_USERNAME'
]
=
""
app
.
config
[
'LDAP_PASSWORD'
]
=
base64
.
b64decode
(
""
)
app
.
config
[
'LDAP_PASSWORD'
]
=
base64
.
b64decode
(
""
)
if
bool
(
config
.
config_ldap_cert_path
):
if
bool
(
config
.
config_ldap_cert_path
):
# app.config['LDAP_REQUIRE_CERT'] = True
app
.
config
[
'LDAP_CUSTOM_OPTIONS'
]
.
update
({
# app.config['LDAP_CERT_PATH'] = config.config_ldap_cert_path
app
.
config
[
'LDAP_CUSTOM_OPTIONS'
]
=
{
pyLDAP
.
OPT_X_TLS_REQUIRE_CERT
:
pyLDAP
.
OPT_X_TLS_DEMAND
,
pyLDAP
.
OPT_X_TLS_REQUIRE_CERT
:
pyLDAP
.
OPT_X_TLS_DEMAND
,
pyLDAP
.
OPT_X_TLS_CACERTFILE
:
config
.
config_ldap_cacert_path
,
pyLDAP
.
OPT_X_TLS_CACERTFILE
:
config
.
config_ldap_cacert_path
,
pyLDAP
.
OPT_X_TLS_CERTFILE
:
config
.
config_ldap_cert_path
,
pyLDAP
.
OPT_X_TLS_CERTFILE
:
config
.
config_ldap_cert_path
,
pyLDAP
.
OPT_X_TLS_KEYFILE
:
config
.
config_ldap_key_path
,
pyLDAP
.
OPT_X_TLS_KEYFILE
:
config
.
config_ldap_key_path
,
pyLDAP
.
OPT_X_TLS_NEWCTX
:
0
pyLDAP
.
OPT_X_TLS_NEWCTX
:
0
}
}
)
app
.
config
[
'LDAP_BASE_DN'
]
=
config
.
config_ldap_dn
app
.
config
[
'LDAP_BASE_DN'
]
=
config
.
config_ldap_dn
app
.
config
[
'LDAP_USER_OBJECT_FILTER'
]
=
config
.
config_ldap_user_object
app
.
config
[
'LDAP_USER_OBJECT_FILTER'
]
=
config
.
config_ldap_user_object
...
@@ -73,17 +72,11 @@ def init_app(app, config):
...
@@ -73,17 +72,11 @@ def init_app(app, config):
app
.
config
[
'LDAP_GROUP_OBJECT_FILTER'
]
=
config
.
config_ldap_group_object_filter
app
.
config
[
'LDAP_GROUP_OBJECT_FILTER'
]
=
config
.
config_ldap_group_object_filter
app
.
config
[
'LDAP_GROUP_MEMBERS_FIELD'
]
=
config
.
config_ldap_group_members_field
app
.
config
[
'LDAP_GROUP_MEMBERS_FIELD'
]
=
config
.
config_ldap_group_members_field
try
:
try
:
_ldap
.
init_app
(
app
)
_ldap
.
init_app
(
app
)
except
ValueError
:
except
ValueError
:
if
bool
(
config
.
config_ldap_cert_path
):
if
bool
(
config
.
config_ldap_cert_path
):
app
.
config
[
'LDAP_CUSTOM_OPTIONS'
]
=
{
app
.
config
[
'LDAP_CUSTOM_OPTIONS'
]
.
pop
(
pyLDAP
.
OPT_X_TLS_NEWCTX
)
pyLDAP
.
OPT_X_TLS_REQUIRE_CERT
:
pyLDAP
.
OPT_X_TLS_DEMAND
,
pyLDAP
.
OPT_X_TLS_CACERTFILE
:
config
.
config_ldap_cacert_path
,
pyLDAP
.
OPT_X_TLS_CERTFILE
:
config
.
config_ldap_cert_path
,
pyLDAP
.
OPT_X_TLS_KEYFILE
:
config
.
config_ldap_key_path
,
}
try
:
try
:
_ldap
.
init_app
(
app
)
_ldap
.
init_app
(
app
)
except
RuntimeError
as
e
:
except
RuntimeError
as
e
:
...
...
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