From 17ec4089dc75da0e54edf60a754a0fc9291275e3 Mon Sep 17 00:00:00 2001 From: Karl Persson Date: Tue, 29 Nov 2022 10:57:47 +0100 Subject: [PATCH] Features: Add aplha feature toggle for authn service (#59469) * Features: Add aplha feature toggle for authn service * AuthN: Add service boilerplate * Set authnz-team as codeowners of authn service --- .github/CODEOWNERS | 1 + packages/grafana-data/src/types/featureToggles.gen.ts | 1 + pkg/services/authn/authn.go | 4 ++++ pkg/services/authn/authnimpl/service.go | 8 ++++++++ pkg/services/authn/authntest/fake.go | 7 +++++++ pkg/services/featuremgmt/registry.go | 5 +++++ pkg/services/featuremgmt/toggles_gen.go | 4 ++++ 7 files changed, 30 insertions(+) create mode 100644 pkg/services/authn/authn.go create mode 100644 pkg/services/authn/authnimpl/service.go create mode 100644 pkg/services/authn/authntest/fake.go diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e623f30f870..b405e168fe3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -224,6 +224,7 @@ lerna.json @grafana/frontend-ops /pkg/services/teamguardian @grafana/grafana-authnz-team /pkg/services/serviceaccounts @grafana/grafana-authnz-team /pkg/services/loginattempt @grafana/grafana-authnz-team +/pkg/services/authn @grafana/grafana-authnz-team # Grafana Partnerships Team /pkg/infra/httpclient/httpclientprovider/sigv4_middleware.go @grafana/grafana-partnerships-team diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index c80c834dff4..f0f688c5b0e 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -82,4 +82,5 @@ export interface FeatureToggles { nestedFolders?: boolean; accessTokenExpirationCheck?: boolean; elasticsearchBackendMigration?: boolean; + authnService?: boolean; } diff --git a/pkg/services/authn/authn.go b/pkg/services/authn/authn.go new file mode 100644 index 00000000000..ac9b9b64a63 --- /dev/null +++ b/pkg/services/authn/authn.go @@ -0,0 +1,4 @@ +package authn + +type Service interface { +} diff --git a/pkg/services/authn/authnimpl/service.go b/pkg/services/authn/authnimpl/service.go new file mode 100644 index 00000000000..cb6e846aad8 --- /dev/null +++ b/pkg/services/authn/authnimpl/service.go @@ -0,0 +1,8 @@ +package authnimpl + +import "github.com/grafana/grafana/pkg/services/authn" + +var _ authn.Service = new(Service) + +type Service struct { +} diff --git a/pkg/services/authn/authntest/fake.go b/pkg/services/authn/authntest/fake.go new file mode 100644 index 00000000000..c1e306ac15d --- /dev/null +++ b/pkg/services/authn/authntest/fake.go @@ -0,0 +1,7 @@ +package authntest + +import "github.com/grafana/grafana/pkg/services/authn" + +type FakeService struct { + authn.Service +} diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index f015cf5afd5..7176751ccd5 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -367,5 +367,10 @@ var ( Description: "Use Elasticsearch as backend data source", State: FeatureStateAlpha, }, + { + Name: "authnService", + Description: "Use new auth service to perform authentication", + State: FeatureStateAlpha, + }, } ) diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 1e8aaa72ce4..3d95cf8a59e 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -270,4 +270,8 @@ const ( // FlagElasticsearchBackendMigration // Use Elasticsearch as backend data source FlagElasticsearchBackendMigration = "elasticsearchBackendMigration" + + // FlagAuthnService + // Use new auth service to perform authentication + FlagAuthnService = "authnService" )