Zanzana: Setup GRPC authentication in client/server mode (#98680)

* Zanzana: Setup GRPC authentication in client/server mode

* don't use grpcutils

* refactor

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

* Add a namespace stub for in-proc mode

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

* Read parameters from config

* authorize server requests

* add namespace to the tests context

* use stack id from config

* simplify authorize func

* properly format namespace

* return Unauthenticated if namespace is empty

* use insecure cred only in dev env

* check request namespace

* Use CallCredentials API for client auth

* provide config

* fail if stack id is missing

* improve error message

* use insecure connection by default

---------

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
Alexander Zobnin
2025-01-13 10:02:15 +01:00
committed by GitHub
co-authored by Karl Persson
parent 8f79a59e1f
commit 5922015fec
13 changed files with 210 additions and 58 deletions
@@ -21,6 +21,12 @@ type Authenticator interface {
Authenticate(ctx context.Context) (context.Context, error)
}
type AuthenticatorFunc func(context.Context) (context.Context, error)
func (fn AuthenticatorFunc) Authenticate(ctx context.Context) (context.Context, error) {
return fn(ctx)
}
// authenticator can authenticate GRPC requests.
type authenticator struct {
contextHandler grpccontext.ContextHandler