diff --git a/pkg/services/authn/grpcutils/namespace_checker.go b/pkg/services/authn/grpcutils/namespace_checker.go index 5c18b08f4da..915cc67b52f 100644 --- a/pkg/services/authn/grpcutils/namespace_checker.go +++ b/pkg/services/authn/grpcutils/namespace_checker.go @@ -15,14 +15,14 @@ func NewNamespaceAuthorizer(cfg *setting.Cfg) authzlib.AuthorizeFunc { claims.CloudNamespaceFormatter, authzlib.WithIDTokenNamespaceAccessCheckerOption(true), ) + } else { + na = authzlib.NewNamespaceAccessChecker( + claims.OrgNamespaceFormatter, + authzlib.WithDisableAccessTokenNamespaceAccessCheckerOption(), + authzlib.WithIDTokenNamespaceAccessCheckerOption(true), + ) } - na = authzlib.NewNamespaceAccessChecker( - claims.OrgNamespaceFormatter, - authzlib.WithDisableAccessTokenNamespaceAccessCheckerOption(), - authzlib.WithIDTokenNamespaceAccessCheckerOption(true), - ) - return authzlib.NamespaceAuthorizationFunc( na, authzlib.MetadataStackIDExtractor(authzlib.DefaultStackIDMetadataKey),