GRPC/Authn: Remove org name header (#93780)

This commit is contained in:
Ryan McKinley 2024-09-26 10:58:59 +03:00 committed by GitHub
parent 536edee7bf
commit cdbc04ab2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 6 deletions

View File

@ -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(),

View File

@ -17,7 +17,6 @@ func TestBasicEncodeDecode(t *testing.T) {
Login: "test",
Type: claims.TypeUser,
OrgID: 456,
OrgName: "org",
OrgRole: identity.RoleAdmin,
}