fix: set authenticated user on request context in bearer token auth
tryBearerAuth validated the bearer token but never looked up the associated user or set it on the request context. This meant downstream handlers calling GetCurrentUser would get nil even with a valid token. Changes: - Add ContextWithUser/UserFromContext helpers in auth package - tryBearerAuth now looks up the user by token's UserID and sets it on the request context via auth.ContextWithUser - GetCurrentUser checks context first before falling back to session cookie - Add integration tests for bearer auth user context
This commit is contained in:
@@ -82,7 +82,7 @@ type deploymentLogWriter struct {
|
||||
lineBuffer bytes.Buffer // buffer for incomplete lines
|
||||
mu sync.Mutex
|
||||
done chan struct{}
|
||||
flushed sync.WaitGroup // waits for flush goroutine to finish
|
||||
flushed sync.WaitGroup // waits for flush goroutine to finish
|
||||
flushCtx context.Context //nolint:containedctx // needed for async flush goroutine
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user