Skip to content

Commit

Permalink
Use proper logging for ldap auth requests
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Jul 27, 2020
1 parent b46288b commit 605b2cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/sane-ldap-auth-logging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Use proper logging for ldap auth requests

Instead of logging to stdout we now log using debug level logging or an error.

https://github.com/cs3org/reva/pull/1008
6 changes: 3 additions & 3 deletions pkg/auth/manager/ldap/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, clientSecret string)
// First bind with a read only user
err = l.Bind(am.c.BindUsername, am.c.BindPassword)
if err != nil {
log.Error().Err(err).Msg("bind with system user failed")
return nil, err
}

Expand All @@ -142,13 +143,12 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, clientSecret string)
return nil, errtypes.NotFound(clientID)
}

log.Debug().Interface("entries", sr.Entries).Msg("entries")

userdn := sr.Entries[0].DN

// Bind as the user to verify their password
err = l.Bind(userdn, clientSecret)
if err != nil {
log.Debug().Err(err).Interface("userdn", userdn).Msg("bind with user credentials failed")
return nil, err
}

Expand All @@ -164,7 +164,7 @@ func (am *mgr) Authenticate(ctx context.Context, clientID, clientSecret string)
Mail: sr.Entries[0].GetEqualFoldAttributeValue(am.c.Schema.Mail),
DisplayName: sr.Entries[0].GetEqualFoldAttributeValue(am.c.Schema.DisplayName),
}
fmt.Printf("\n\n\n%+v\n\n\n", u)
log.Debug().Interface("entry", sr.Entries[0]).Interface("user", u).Msg("authenticated user")

return u, nil

Expand Down

0 comments on commit 605b2cd

Please sign in to comment.