mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-13 02:37:18 +03:00
Add username to request.Context
This commit is contained in:
parent
84413b542e
commit
d42dfafad4
@ -210,6 +210,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