Add auth.user.name to logging context
							parent
							
								
									e5eddbc762
								
							
						
					
					
						commit
						9898552656
					
				| 
						 | 
					@ -66,7 +66,7 @@ func (ac *accessController) Authorized(ctx context.Context, accessRecords ...aut
 | 
				
			||||||
		return nil, &challenge
 | 
							return nil, &challenge
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return context.WithValue(ctx, "auth.user", auth.UserInfo{Name: "silly"}), nil
 | 
						return auth.WithUser(ctx, auth.UserInfo{Name: "silly"}), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type challenge struct {
 | 
					type challenge struct {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -324,6 +324,9 @@ func (app *App) dispatcher(dispatch dispatchFunc) http.Handler {
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Add username to request logging
 | 
				
			||||||
 | 
							context.Context = ctxu.WithLogger(context.Context, ctxu.GetLogger(context.Context, "auth.user.name"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if app.nameRequired(r) {
 | 
							if app.nameRequired(r) {
 | 
				
			||||||
			repository, err := app.registry.Repository(context, getName(context))
 | 
								repository, err := app.registry.Repository(context, getName(context))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -456,7 +459,6 @@ func (app *App) authorized(w http.ResponseWriter, r *http.Request, context *Cont
 | 
				
			||||||
	// should be replaced by another, rather than replacing the context on a
 | 
						// should be replaced by another, rather than replacing the context on a
 | 
				
			||||||
	// mutable object.
 | 
						// mutable object.
 | 
				
			||||||
	context.Context = ctx
 | 
						context.Context = ctx
 | 
				
			||||||
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue