Zanzana: Use authzService audience (#100417)

This commit is contained in:
Alexander Zobnin 2025-02-11 14:25:30 +01:00 committed by GitHub
parent bbe21bb1d2
commit 7234a17d1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,7 @@ import (
authzv1 "github.com/grafana/authlib/authz/proto/v1"
claims "github.com/grafana/authlib/types"
"github.com/grafana/dskit/services"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/infra/tracing"
@ -29,8 +30,6 @@ import (
"github.com/grafana/grafana/pkg/setting"
)
const zanzanaAudience = "zanzana"
// ProvideZanzana used to register ZanzanaClient.
// It will also start an embedded ZanzanaSever if mode is set to "embedded".
func ProvideZanzana(cfg *setting.Cfg, db db.DB, features featuremgmt.FeatureToggles) (zanzana.Client, error) {
@ -179,7 +178,7 @@ func (z *Zanzana) start(ctx context.Context) error {
authenticator := authnlib.NewAccessTokenAuthenticator(
authnlib.NewAccessTokenVerifier(
authnlib.VerifierConfig{
AllowedAudiences: []string{zanzanaAudience},
AllowedAudiences: []string{authzServiceAudience},
},
authnlib.NewKeyRetriever(authnlib.KeyRetrieverConfig{
SigningKeysURL: z.cfg.ZanzanaServer.SigningKeysURL,
@ -255,7 +254,7 @@ type tokenAuth struct {
func (t *tokenAuth) GetRequestMetadata(ctx context.Context, _ ...string) (map[string]string, error) {
token, err := t.tokenClient.Exchange(ctx, authnlib.TokenExchangeRequest{
Namespace: t.namespace,
Audiences: []string{zanzanaAudience},
Audiences: []string{authzServiceAudience},
})
if err != nil {
return nil, err