Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of username_as_alias during LDAP authentication
There is a bug that was introduced in the LDAP authentication method by hashicorp#11000. It was thought to be backward compatible but has broken a number of users. Later a new parameter `username_as_alias` was introduced in hashicorp#14324 to make it possible for operators to restore the previous behavior. The way it is currently working is not completely backward compatible thought because when username_as_alias is set, a call to GetUserAliasAttributeValue() will first be made, then this value is completely discarded in pathLogin() and replaced by the username as expected. This is an issue because it makes useless calls to the LDAP server and will break backward compatibility if one of the constraints in GetUserAliasAttributeValue() is not respected, even though the resulting value will be discarded anyway. In order to maintain backward compatibility here we have to only call GetUserAliasAttributeValue() if necessary. Since this change of behavior was introduced in 1.9, this fix will need to be backported to the 1.9, 1.10 and 1.11 branches.
- Loading branch information