Open vyskoczilova opened 3 years ago
Now I had formulated a very thought through response why we need to do the LDAP authentication first. And then I reread your post and completely deleted it as you could be right. When `get_user_meta($uid, 'authLDAP') returns 'null', we should not need to do the LDAP authentication you could think.
I'm just thinking about whether there can be cases where someone logs in with name
but the username retrieved from LDAP would be different and so they might be using a different account then.
As currently it is i.e. possible to authenticate via the LDAP field wordpressUid
which contains "me". That ldapuser has a uid of userA
so for wordpress that user will have the uid userA
. I'm not 100% sure whether that might open a loophole that can be exploited.
Nevertheless: After searching the ldap for that user I can either see that there is no user with that identifier so I take the literal one of I find a user with that identifier, then I take the converted one and check that against the users meta-data. If the user has no ldap-flag set, I can skip the rest of the authentication process.
I might implement that later...
@heiglandreas You're right with the rest of the user login process, no troubles on that side.
I haven't tested any other case than logging in with the email and there could be something going wrong. And it's probably better to be safe than sorry and I definitely don't want to open a loophole for an exploit (that's why I asked first not tried to fix it). Thanks for your feedback
Hi Andreas,
we've spotted that when I log in as admin who has only WP account, I get the following message in the error log:
That means it tries to log me in LDAP even when
get_user_meta($uid, 'authLDAP')
returnsnull
since it's not set. Maybe I'm seeing wrong, but there is no check for this parameter before the connection to LDAP?The login itself goes as expected and I log in, but this is weird since I would expect to skip the authLdap process entiery.