From cdbc04ab2be22d01285971c920251a5f0e486262 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Thu, 26 Sep 2024 10:58:59 +0300 Subject: [PATCH] GRPC/Authn: Remove org name header (#93780) --- pkg/storage/unified/resource/grpc/authenticator.go | 8 +++----- pkg/storage/unified/resource/grpc/authenticator_test.go | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/storage/unified/resource/grpc/authenticator.go b/pkg/storage/unified/resource/grpc/authenticator.go index f1f9aea5bec..29184097935 100644 --- a/pkg/storage/unified/resource/grpc/authenticator.go +++ b/pkg/storage/unified/resource/grpc/authenticator.go @@ -5,11 +5,12 @@ import ( "fmt" "strconv" - "github.com/grafana/authlib/authn" - authClaims "github.com/grafana/authlib/claims" "google.golang.org/grpc" "google.golang.org/grpc/metadata" + "github.com/grafana/authlib/authn" + authClaims "github.com/grafana/authlib/claims" + "github.com/grafana/grafana/pkg/apimachinery/identity" ) @@ -18,7 +19,6 @@ const ( mdLogin = "grafana-login" mdUserID = "grafana-user-id" mdUserUID = "grafana-user-uid" - mdOrgName = "grafana-org-name" mdOrgID = "grafana-org-id" mdOrgRole = "grafana-org-role" ) @@ -105,7 +105,6 @@ func (f *Authenticator) decodeMetadata(ctx context.Context, meta metadata.MD) (i } user.UserUID = id - user.OrgName = getter(mdOrgName) user.OrgID, err = strconv.ParseInt(getter(mdOrgID), 10, 64) if err != nil { return nil, fmt.Errorf("invalid org id: %w", err) @@ -154,7 +153,6 @@ func encodeIdentityInMetadata(user identity.Requester) metadata.MD { // Or we can create it directly mdUserID, user.GetID(), mdUserUID, user.GetUID(), - mdOrgName, user.GetOrgName(), mdOrgID, strconv.FormatInt(user.GetOrgID(), 10), mdOrgRole, string(user.GetOrgRole()), mdLogin, user.GetLogin(), diff --git a/pkg/storage/unified/resource/grpc/authenticator_test.go b/pkg/storage/unified/resource/grpc/authenticator_test.go index d44268a0232..674d846c486 100644 --- a/pkg/storage/unified/resource/grpc/authenticator_test.go +++ b/pkg/storage/unified/resource/grpc/authenticator_test.go @@ -17,7 +17,6 @@ func TestBasicEncodeDecode(t *testing.T) { Login: "test", Type: claims.TypeUser, OrgID: 456, - OrgName: "org", OrgRole: identity.RoleAdmin, }