mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-03 15:19:44 -06:00
* (wip) encryption * feat: api tokens * chore: add api token generation command * fix: e2e tests * chore: set timeout for e2e job * fix: e2e tests, remove client-side certs * chore: address PR review comments * fix: token tests * chore: address review comments and fix tests
27 lines
459 B
Go
27 lines
459 B
Go
package client
|
|
|
|
import (
|
|
grpcMetadata "google.golang.org/grpc/metadata"
|
|
|
|
"context"
|
|
)
|
|
|
|
type contextLoader struct {
|
|
// The token
|
|
Token string
|
|
}
|
|
|
|
func newContextLoader(token string) *contextLoader {
|
|
return &contextLoader{
|
|
Token: token,
|
|
}
|
|
}
|
|
|
|
func (c *contextLoader) newContext(ctx context.Context) context.Context {
|
|
md := grpcMetadata.New(map[string]string{
|
|
"authorization": "Bearer " + c.Token,
|
|
})
|
|
|
|
return grpcMetadata.NewOutgoingContext(ctx, md)
|
|
}
|