diff --git a/internal/pkg/imports/imports_linux.go b/internal/pkg/imports/imports_linux.go index a7b039e..7cf2a59 100644 --- a/internal/pkg/imports/imports_linux.go +++ b/internal/pkg/imports/imports_linux.go @@ -25,6 +25,7 @@ import ( _ "github.com/networkservicemesh/sdk/pkg/networkservice/core/chain" _ "github.com/networkservicemesh/sdk/pkg/networkservice/ipam/point2pointipam" _ "github.com/networkservicemesh/sdk/pkg/registry/chains/client" + _ "github.com/networkservicemesh/sdk/pkg/registry/common/authorize" _ "github.com/networkservicemesh/sdk/pkg/registry/common/sendfd" _ "github.com/networkservicemesh/sdk/pkg/tools/clientinfo" _ "github.com/networkservicemesh/sdk/pkg/tools/debug" @@ -34,6 +35,7 @@ import ( _ "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" _ "github.com/networkservicemesh/sdk/pkg/tools/opentelemetry" _ "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt" + _ "github.com/networkservicemesh/sdk/pkg/tools/token" _ "github.com/networkservicemesh/sdk/pkg/tools/tracing" _ "github.com/pkg/errors" _ "github.com/sirupsen/logrus" diff --git a/main.go b/main.go index b1ed9c1..ff3ab95 100644 --- a/main.go +++ b/main.go @@ -60,6 +60,7 @@ import ( "github.com/networkservicemesh/sdk/pkg/networkservice/core/chain" "github.com/networkservicemesh/sdk/pkg/networkservice/ipam/point2pointipam" registryclient "github.com/networkservicemesh/sdk/pkg/registry/chains/client" + registryauthorize "github.com/networkservicemesh/sdk/pkg/registry/common/authorize" registrysendfd "github.com/networkservicemesh/sdk/pkg/registry/common/sendfd" "github.com/networkservicemesh/sdk/pkg/tools/clientinfo" "github.com/networkservicemesh/sdk/pkg/tools/debug" @@ -69,6 +70,7 @@ import ( "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" "github.com/networkservicemesh/sdk/pkg/tools/opentelemetry" "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt" + "github.com/networkservicemesh/sdk/pkg/tools/token" "github.com/networkservicemesh/sdk/pkg/tools/tracing" ) @@ -259,7 +261,9 @@ func main() { clientOptions := append( tracing.WithTracingDial(), grpc.WithBlock(), - grpc.WithDefaultCallOptions(grpc.WaitForReady(true)), + grpc.WithDefaultCallOptions( + grpc.WaitForReady(true), + grpc.PerRPCCredentials(token.NewPerRPCCredentials(spiffejwt.TokenGeneratorFunc(source, config.MaxTokenLifetime)))), grpc.WithTransportCredentials( grpcfd.TransportCredentials( credentials.NewTLS( @@ -267,6 +271,8 @@ func main() { ), ), ), + grpcfd.WithChainStreamInterceptor(), + grpcfd.WithChainUnaryInterceptor(), ) nseRegistryClient := registryclient.NewNetworkServiceEndpointRegistryClient( @@ -274,8 +280,8 @@ func main() { registryclient.WithClientURL(&config.ConnectTo), registryclient.WithDialOptions(clientOptions...), registryclient.WithNSEAdditionalFunctionality( - registrysendfd.NewNetworkServiceEndpointRegistryClient(), - ), + registrysendfd.NewNetworkServiceEndpointRegistryClient()), + registryclient.WithAuthorizeNSERegistryClient(registryauthorize.NewNetworkServiceEndpointRegistryClient()), ) nse := getNseEndpoint(config, listenOn) nse, err = nseRegistryClient.Register(ctx, nse)