Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of Fix handling of username_as_alias during LDAP authentication into release/1.9.x #15556

Commits on May 20, 2022

  1. Fix handling of username_as_alias during LDAP authentication (#15525)

    * Fix handling of username_as_alias during LDAP authentication
    
    There is a bug that was introduced in the LDAP authentication method by #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 #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>
    # Conflicts:
    #	builtin/credential/ldap/backend_test.go
    remilapeyre authored and calvn committed May 20, 2022
    Copy the full SHA
    70fe3e0 View commit details
    Browse the repository at this point in the history