Skip to content

Commit

Permalink
Fix LDAP+SSO authentication (AUTH_TYPE == 4)
Browse files Browse the repository at this point in the history
Use ldap.php in auth phase to extract user LDAP attributes
Check user existence with search_on_loginnt($login)
Do not check password validity when $affich_method == 'SSO'
  • Loading branch information
matt6697 committed Dec 13, 2023
1 parent 3b49e43 commit 6177e28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion backend/AUTH/methode/ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ function verif_pw_ldap($login, $pw) {
// login doesn't exist
return ("BAD LOGIN OR PASSWORD");
}
return (ldap_test_pw($info[0]["dn"], $pw) ? "OK" : "BAD LOGIN OR PASSWORD");

$affich_method = get_affiche_methode();
if($affich_method == 'SSO') {
return (isset($info[0]["dn"]) ? "OK" : "BAD LOGIN OR PASSWORD");
} else {
return (ldap_test_pw($info[0]["dn"], $pw) ? "OK" : "BAD LOGIN OR PASSWORD");
}
}

function search_on_loginnt($login) {
Expand Down
5 changes: 4 additions & 1 deletion backend/require/auth.manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function get_list_methode($identity = false){
);

case 4:

return array(
0 => "ldap.php"
);
break;
case 5:
if($identity){
return array(
Expand Down

0 comments on commit 6177e28

Please sign in to comment.