RANGER-5753: LDAP/Active Directory authentication does not validate local Ranger account status - #1174
RANGER-5753: LDAP/Active Directory authentication does not validate local Ranger account status#1174vyommani wants to merge 2 commits into
Conversation
…ocal Ranger account status
| return roleList; | ||
| } | ||
|
|
||
| public boolean isUserDisabled(String loginId) { |
There was a problem hiding this comment.
isUserDisabled() method checks if the user status is "not active", which is different from disabled status. I suggest naming the method to isUserActive() and update all its references to handle the return value.
There was a problem hiding this comment.
@vyommani - I take back this comment. I will update here after further review.
There was a problem hiding this comment.
The method implementation checks if user is not active i.e., not explicitly if the user is disabled - note an user can be in one of other statuses like deactivated. So, I suggest:
- renaming
isUserDisabled()toisUserNotActive() - renaming
checkAccountNotDisabled() toblockNotActiveUser()`
| return authentication; | ||
| } | ||
|
|
||
| private void checkAccountNotDisabled(String userName) { |
There was a problem hiding this comment.
I suggest renaming method checkAccountNotDisabled() to ensureUserIsActive(). Also, update the messages to replace "disabled" with "not active".
What changes were proposed in this pull request?
When Ranger Admin is configured for LDAP or Active Directory authentication
(
ranger.authentication.method=LDAPorACTIVE_DIRECTORY),RangerAuthenticationProviderdid not check the local Ranger account's status after a successful directory bind. This meant
a user's local account status could be out of sync with their actual ability to sign in when
directory-based authentication was used, unlike local/JDBC authentication, which already
respects account status via the
STATUScolumn read by the JDBC user-details query.This change adds a status check,
UserMgr#isUserDisabled, and calls it fromRangerAuthenticationProvider#authenticateright after each successful LDAP, LDAP-bind,AD-bind, AD, PAM, and UNIX authentication branch, before the method returns — so a disabled
local account is rejected consistently across all supported authentication methods.
How was this patch tested?
added new unit tests.