mirror of
https://github.com/zitadel/zitadel
synced 2024-11-22 00:39:36 +00:00
fix(ldap): add more logs (#8197)
# Which Problems Are Solved In case the user bind (user password check for LDAP IdP) fails, there's no information about what went wrong. This makes it hard to even impossible to find the cause. # How the Problems Are Solved Added logging of the error. # Additional Changes Additionally added a log in case no single user (none / multiple) are found. # Additional Context - reported internally
This commit is contained in:
parent
3af825a6f7
commit
1b0e773ceb
@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
"github.com/zitadel/logging"
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
@ -172,12 +173,14 @@ func trySearchAndUserBind(
|
||||
return nil, err
|
||||
}
|
||||
if len(sr.Entries) != 1 {
|
||||
logging.WithFields("entries", len(sr.Entries)).Info("ldap: no single user found")
|
||||
return nil, ErrNoSingleUser
|
||||
}
|
||||
|
||||
user := sr.Entries[0]
|
||||
// Bind as the user to verify their password
|
||||
if err = conn.Bind(user.DN, password); err != nil {
|
||||
logging.WithFields("userDN", user.DN).WithError(err).Info("ldap user bind failed")
|
||||
return nil, ErrFailedLogin
|
||||
}
|
||||
return user, nil
|
||||
|
Loading…
Reference in New Issue
Block a user