From b18b586ec8e598f123ff437e3c7ad33a6a2211f0 Mon Sep 17 00:00:00 2001 From: April Ayres <127258092+ajayreshc@users.noreply.github.com> Date: Thu, 23 Jan 2025 11:55:11 -0800 Subject: [PATCH] add noOp license validator function (#5468) --- .../daemon/controller/handlers/targets/target_service.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/daemon/controller/handlers/targets/target_service.go b/internal/daemon/controller/handlers/targets/target_service.go index ea1c8128da..d934d21758 100644 --- a/internal/daemon/controller/handlers/targets/target_service.go +++ b/internal/daemon/controller/handlers/targets/target_service.go @@ -106,6 +106,7 @@ var ( SessionRecordingFn = NoSessionRecording WorkerFilterDeprecationMessage = fmt.Sprintf("This field is deprecated. Use %s instead.", globals.EgressWorkerFilterField) StorageBucketFilterCredIdFn = noStorageBucket + ValidateLicenseFn = noOpValidateLicense ) func init() { @@ -751,6 +752,10 @@ func NoSessionRecording(context.Context, intglobals.ControllerExtension, *kms.Km func (s Service) AuthorizeSession(ctx context.Context, req *pbs.AuthorizeSessionRequest) (_ *pbs.AuthorizeSessionResponse, retErr error) { const op = "targets.(Service).AuthorizeSession" + if err := ValidateLicenseFn(ctx); err != nil { + return nil, err + } + if ctxAlias := alias.FromContext(ctx); ctxAlias != nil { a, err := s.resolveAlias(ctx, ctxAlias.PublicId) if err != nil { @@ -2212,3 +2217,7 @@ func validateAuthorizeSessionRequest(req *pbs.AuthorizeSessionRequest) error { func noStorageBucket(_ context.Context, _ intglobals.ControllerExtension, _ string) (string, string, error) { return "", "", fmt.Errorf("not supported") } + +func noOpValidateLicense(ctx context.Context) error { + return nil +}