Skip to content

Commit

Permalink
grpcproxy: use metadata instead of context withvalue in with client a…
Browse files Browse the repository at this point in the history
…uth token

Signed-off-by: Kristoffer Johansson <[email protected]>
  • Loading branch information
krijohs committed Dec 9, 2024
1 parent 854bdd6 commit b65c4a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/proxy/grpcproxy/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func getAuthTokenFromClient(ctx context.Context) string {
func withClientAuthToken(ctx, ctxWithToken context.Context) context.Context {
token := getAuthTokenFromClient(ctxWithToken)
if token != "" {
ctx = context.WithValue(ctx, rpctypes.TokenFieldNameGRPCKey{}, token)
md := metadata.Pairs(rpctypes.TokenFieldNameGRPC, token)
return metadata.NewOutgoingContext(ctx, md)
}
return ctx
}
Expand Down
1 change: 1 addition & 0 deletions server/proxy/grpcproxy/watch_broadcasts.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (wbs *watchBroadcasts) coalesce(wb *watchBroadcast) {
wbs.watchers[w] = wbswb
}
wb.receivers = nil
watchersCoalescing.Inc()
}
wbswb.mu.Unlock()
wb.mu.Unlock()
Expand Down

0 comments on commit b65c4a6

Please sign in to comment.