Skip to content

Commit 6eda48b

Browse files
committed
httpmw: set authzquery context as well
1 parent 9b55337 commit 6eda48b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

coderd/httpmw/apikey.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,13 @@ func ExtractAPIKey(cfg ExtractAPIKeyConfig) func(http.Handler) http.Handler {
351351
Scope: key.Scope,
352352
Groups: roles.Groups,
353353
})
354+
// Set the auth context for the authzquerier as well.
355+
ctx = authzquery.WithAuthorizeContext(ctx,
356+
key.UserID,
357+
rbac.RoleNames(roles.Roles),
358+
roles.Groups,
359+
rbac.ScopeName(key.Scope),
360+
)
354361

355362
next.ServeHTTP(rw, r.WithContext(ctx))
356363
})

0 commit comments

Comments
 (0)