From ecb9a4301579cf33cc32f6435222618f68c18102 Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Wed, 22 May 2024 11:32:04 +0300 Subject: [PATCH] Test --- pkg/auth/authenticator.go | 12 +----------- pkg/auth/service.go | 20 +------------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/pkg/auth/authenticator.go b/pkg/auth/authenticator.go index 881d0312c01..de9e0f6015a 100644 --- a/pkg/auth/authenticator.go +++ b/pkg/auth/authenticator.go @@ -53,17 +53,7 @@ func NewBuiltinAuthenticator(service Service) *BuiltinAuthenticator { return &BuiltinAuthenticator{creds: service} } -func (ba *BuiltinAuthenticator) AuthenticateUser(ctx context.Context, username, password string) (string, error) { - //// Look user up in DB. username is really the access key ID. - //cred, err := ba.creds.GetCredentials(ctx, username) - //if err != nil { - // return InvalidUserID, err - //} - //if subtle.ConstantTimeCompare([]byte(password), []byte(cred.SecretAccessKey)) != 1 { - // return InvalidUserID, ErrInvalidSecretAccessKey - //} - //return cred.Username, nil - +func (ba *BuiltinAuthenticator) AuthenticateUser(_ context.Context, _, _ string) (string, error) { return "test-user", nil } diff --git a/pkg/auth/service.go b/pkg/auth/service.go index 5d27fde6093..7ea85be3ee6 100644 --- a/pkg/auth/service.go +++ b/pkg/auth/service.go @@ -1913,25 +1913,7 @@ func (a *APIAuthService) ListGroupPolicies(ctx context.Context, groupID string, return policies, toPagination(resp.JSON200.Pagination), nil } -func (a *APIAuthService) Authorize(ctx context.Context, req *AuthorizationRequest) (*AuthorizationResponse, error) { - //policies, _, err := a.ListEffectivePolicies(ctx, req.Username, &model.PaginationParams{ - // After: "", // all - // Amount: -1, // all - //}) - //if err != nil { - // return nil, err - //} - // - //allowed := checkPermissions(ctx, req.RequiredPermissions, req.Username, policies) - // - //if allowed != CheckAllow { - // return &AuthorizationResponse{ - // Allowed: false, - // Error: ErrInsufficientPermissions, - // }, nil - //} - - // we're allowed! +func (a *APIAuthService) Authorize(_ context.Context, _ *AuthorizationRequest) (*AuthorizationResponse, error) { return &AuthorizationResponse{Allowed: true}, nil }