simplify agent registration (#3018)

* simplify agent registration

* testutils

* deps

* fix

* gen

* cleanup

* lower job load
This commit is contained in:
Paul Wells
2024-09-19 05:58:30 -07:00
committed by GitHub
parent 94d7b1708f
commit 61179d5624
8 changed files with 430 additions and 418 deletions
+7
View File
@@ -107,6 +107,13 @@ func (m *APIKeyAuthMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request,
next.ServeHTTP(w, r)
}
func WithAPIKey(ctx context.Context, grants *auth.ClaimGrants, apiKey string) context.Context {
return context.WithValue(ctx, grantsKey{}, &grantsValue{
claims: grants,
apiKey: apiKey,
})
}
func GetGrants(ctx context.Context) *auth.ClaimGrants {
val := ctx.Value(grantsKey{})
v, ok := val.(*grantsValue)