mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
Add username to request.Context
This commit is contained in:
parent
7b1030ec41
commit
f59efb6b0a
@ -295,6 +295,7 @@ func UsernameFromReverseProxyHeader(r *http.Request) string {
|
||||
func contextWithUser(ctx context.Context, ds model.DataStore, username string) (context.Context, error) {
|
||||
user, err := ds.User(ctx).FindByUsername(username)
|
||||
if err == nil {
|
||||
ctx = request.WithUsername(ctx, user.UserName)
|
||||
return request.WithUser(ctx, *user), nil
|
||||
}
|
||||
log.Error(ctx, "Authenticated username not found in DB", "username", username)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user