From cfd8aec48a7cd991001d6e9e19622b27f48436fb Mon Sep 17 00:00:00 2001 From: Tiago Silva Date: Wed, 6 Nov 2024 10:39:29 +0000 Subject: [PATCH] test --- lib/auth/auth_with_roles.go | 6 ++++-- lib/auth/integration/integrationv1/service.go | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/auth/auth_with_roles.go b/lib/auth/auth_with_roles.go index 931dd4178a1e1..2d93d3ce476ba 100644 --- a/lib/auth/auth_with_roles.go +++ b/lib/auth/auth_with_roles.go @@ -3645,7 +3645,8 @@ func (a *ServerWithRoles) CreateSAMLConnector(ctx context.Context, connector typ return nil, trace.Wrap(err) } - if err := a.context.AuthorizeAdminAction(); err != nil { + // Support reused MFA for bulk tctl create requests. + if err := a.context.AuthorizeAdminActionAllowReusedMFA(); err != nil { return nil, trace.Wrap(err) } @@ -3663,7 +3664,8 @@ func (a *ServerWithRoles) UpdateSAMLConnector(ctx context.Context, connector typ return nil, trace.Wrap(err) } - if err := a.context.AuthorizeAdminAction(); err != nil { + // Support reused MFA for bulk tctl create requests. + if err := a.context.AuthorizeAdminActionAllowReusedMFA(); err != nil { return nil, trace.Wrap(err) } diff --git a/lib/auth/integration/integrationv1/service.go b/lib/auth/integration/integrationv1/service.go index 68831213c0fd5..f5339d7c913f1 100644 --- a/lib/auth/integration/integrationv1/service.go +++ b/lib/auth/integration/integrationv1/service.go @@ -198,6 +198,10 @@ func (s *Service) CreateIntegration(ctx context.Context, req *integrationpb.Crea return nil, trace.Wrap(err) } + if err := authCtx.AuthorizeAdminActionAllowReusedMFA(); err != nil { + return nil, trace.Wrap(err) + } + if err := authCtx.CheckAccessToKind(types.KindIntegration, types.VerbCreate); err != nil { return nil, trace.Wrap(err) } @@ -243,6 +247,10 @@ func (s *Service) UpdateIntegration(ctx context.Context, req *integrationpb.Upda return nil, trace.Wrap(err) } + if err := authCtx.AuthorizeAdminActionAllowReusedMFA(); err != nil { + return nil, trace.Wrap(err) + } + if err := authCtx.CheckAccessToKind(types.KindIntegration, types.VerbUpdate); err != nil { return nil, trace.Wrap(err) }