mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-30 09:27:19 +02:00
authorize: add request id to context (#3497)
* authorize: add request id to context * fix context keys
This commit is contained in:
parent
06ee1c8711
commit
89a105c8e6
4 changed files with 18 additions and 9 deletions
|
@ -33,11 +33,11 @@ func (nilQuerier) Query(ctx context.Context, in *databroker.QueryRequest, opts .
|
|||
return nil, status.Error(codes.NotFound, "not found")
|
||||
}
|
||||
|
||||
var querierKey struct{}
|
||||
type querierKey struct{}
|
||||
|
||||
// GetQuerier gets the databroker Querier from the context.
|
||||
func GetQuerier(ctx context.Context) Querier {
|
||||
q, ok := ctx.Value(querierKey).(Querier)
|
||||
q, ok := ctx.Value(querierKey{}).(Querier)
|
||||
if !ok {
|
||||
q = nilQuerier{}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func GetQuerier(ctx context.Context) Querier {
|
|||
|
||||
// WithQuerier sets the databroker Querier on a context.
|
||||
func WithQuerier(ctx context.Context, querier Querier) context.Context {
|
||||
return context.WithValue(ctx, querierKey, querier)
|
||||
return context.WithValue(ctx, querierKey{}, querier)
|
||||
}
|
||||
|
||||
type staticQuerier struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue