d66333f7ac
* Fix handling of username_as_alias during LDAP authentication There is a bug that was introduced in the LDAP authentication method by https://github.com/hashicorp/vault/pull/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 https://github.com/hashicorp/vault/pull/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. * Add changelog * Add tests * Format code * Update builtin/credential/ldap/backend.go Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com> * Format and fix declaration * Reword changelog Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
9 lines
494 B
Plaintext
9 lines
494 B
Plaintext
```release-note:bug
|
|
auth/ldap: The logic for setting the entity alias when `username_as_alias` is set
|
|
has been fixed. The previous behavior would make a request to the LDAP server to
|
|
get `user_attr` before discarding it and using the username instead. This would
|
|
make it impossible for a user to connect if this attribute was missing or had
|
|
multiple values, even though it would not be used anyway. This has been fixed
|
|
and the username is now used without making superfluous LDAP searches.
|
|
```
|