More informative error message when LDAP messes up
This commit is contained in:
parent
744f12dccf
commit
1fc2a04040
1 changed files with 3 additions and 0 deletions
|
@ -36,7 +36,10 @@ def fetch_cas_account(cas_login):
|
||||||
if not res:
|
if not res:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if len(res) != 1:
|
||||||
|
raise RuntimeError("LDAP returned too many results: {}".format(res))
|
||||||
(res,) = res
|
(res,) = res
|
||||||
|
|
||||||
assert _extract_ldap_info(res, "uid") == cas_login
|
assert _extract_ldap_info(res, "uid") == cas_login
|
||||||
return {
|
return {
|
||||||
"cn": _extract_ldap_info(res, "cn"),
|
"cn": _extract_ldap_info(res, "cn"),
|
||||||
|
|
Loading…
Add table
Reference in a new issue