diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7bd2e4c9ae1..bd4d53f8c6a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -562,7 +562,7 @@ cypress.config.js @grafana/grafana-frontend-platform /pkg/services/ldap/ @grafana/grafana-authnz-team /pkg/services/login/ @grafana/grafana-authnz-team /pkg/services/loginattempt/ @grafana/grafana-authnz-team -/pkg/services/oauthserver/ @grafana/grafana-authnz-team +/pkg/services/extsvcauth/ @grafana/grafana-authnz-team /pkg/services/oauthtoken/ @grafana/grafana-authnz-team /pkg/services/serviceaccounts/ @grafana/grafana-authnz-team diff --git a/pkg/server/wire.go b/pkg/server/wire.go index 5ec586d4eca..f38ae1d8467 100644 --- a/pkg/server/wire.go +++ b/pkg/server/wire.go @@ -63,6 +63,8 @@ import ( datasourceservice "github.com/grafana/grafana/pkg/services/datasources/service" "github.com/grafana/grafana/pkg/services/encryption" encryptionservice "github.com/grafana/grafana/pkg/services/encryption/service" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/oasimpl" "github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/folder" "github.com/grafana/grafana/pkg/services/folder/folderimpl" @@ -89,8 +91,6 @@ import ( ngmetrics "github.com/grafana/grafana/pkg/services/ngalert/metrics" ngstore "github.com/grafana/grafana/pkg/services/ngalert/store" "github.com/grafana/grafana/pkg/services/notifications" - "github.com/grafana/grafana/pkg/services/oauthserver" - "github.com/grafana/grafana/pkg/services/oauthserver/oasimpl" "github.com/grafana/grafana/pkg/services/oauthtoken" "github.com/grafana/grafana/pkg/services/oauthtoken/oauthtokentest" "github.com/grafana/grafana/pkg/services/org/orgimpl" diff --git a/pkg/services/authn/authnimpl/service.go b/pkg/services/authn/authnimpl/service.go index bc3ad8cffe8..4f3c5e0c2bf 100644 --- a/pkg/services/authn/authnimpl/service.go +++ b/pkg/services/authn/authnimpl/service.go @@ -22,11 +22,11 @@ import ( "github.com/grafana/grafana/pkg/services/authn" "github.com/grafana/grafana/pkg/services/authn/authnimpl/sync" "github.com/grafana/grafana/pkg/services/authn/clients" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" "github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/ldap/service" "github.com/grafana/grafana/pkg/services/login" "github.com/grafana/grafana/pkg/services/loginattempt" - "github.com/grafana/grafana/pkg/services/oauthserver" "github.com/grafana/grafana/pkg/services/oauthtoken" "github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/quota" diff --git a/pkg/services/authn/clients/ext_jwt.go b/pkg/services/authn/clients/ext_jwt.go index 5e2f7e35b05..4d9b88d0de2 100644 --- a/pkg/services/authn/clients/ext_jwt.go +++ b/pkg/services/authn/clients/ext_jwt.go @@ -14,8 +14,8 @@ import ( "github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/services/authn" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" "github.com/grafana/grafana/pkg/services/login" - "github.com/grafana/grafana/pkg/services/oauthserver" "github.com/grafana/grafana/pkg/services/signingkeys" "github.com/grafana/grafana/pkg/services/user" "github.com/grafana/grafana/pkg/setting" diff --git a/pkg/services/authn/clients/ext_jwt_test.go b/pkg/services/authn/clients/ext_jwt_test.go index 7a29ad6d96a..c3a6a82ab0c 100644 --- a/pkg/services/authn/clients/ext_jwt_test.go +++ b/pkg/services/authn/clients/ext_jwt_test.go @@ -18,9 +18,9 @@ import ( "github.com/grafana/grafana/pkg/models/roletype" "github.com/grafana/grafana/pkg/services/authn" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/oastest" "github.com/grafana/grafana/pkg/services/login" - "github.com/grafana/grafana/pkg/services/oauthserver" - "github.com/grafana/grafana/pkg/services/oauthserver/oastest" "github.com/grafana/grafana/pkg/services/signingkeys" "github.com/grafana/grafana/pkg/services/signingkeys/signingkeystest" "github.com/grafana/grafana/pkg/services/user" diff --git a/pkg/services/extsvcauth/extsvcauth.go b/pkg/services/extsvcauth/extsvcauth.go new file mode 100644 index 00000000000..745c80dbd4d --- /dev/null +++ b/pkg/services/extsvcauth/extsvcauth.go @@ -0,0 +1 @@ +package extsvcauth diff --git a/pkg/services/oauthserver/api/api.go b/pkg/services/extsvcauth/oauthserver/api/api.go similarity index 93% rename from pkg/services/oauthserver/api/api.go rename to pkg/services/extsvcauth/oauthserver/api/api.go index 0875367bec3..921a01cb1d6 100644 --- a/pkg/services/oauthserver/api/api.go +++ b/pkg/services/extsvcauth/oauthserver/api/api.go @@ -3,7 +3,7 @@ package api import ( "github.com/grafana/grafana/pkg/api/routing" contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model" - "github.com/grafana/grafana/pkg/services/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" ) type api struct { diff --git a/pkg/services/oauthserver/errors.go b/pkg/services/extsvcauth/oauthserver/errors.go similarity index 100% rename from pkg/services/oauthserver/errors.go rename to pkg/services/extsvcauth/oauthserver/errors.go diff --git a/pkg/services/oauthserver/external_service.go b/pkg/services/extsvcauth/oauthserver/external_service.go similarity index 100% rename from pkg/services/oauthserver/external_service.go rename to pkg/services/extsvcauth/oauthserver/external_service.go diff --git a/pkg/services/oauthserver/external_service_test.go b/pkg/services/extsvcauth/oauthserver/external_service_test.go similarity index 100% rename from pkg/services/oauthserver/external_service_test.go rename to pkg/services/extsvcauth/oauthserver/external_service_test.go diff --git a/pkg/services/oauthserver/models.go b/pkg/services/extsvcauth/oauthserver/models.go similarity index 100% rename from pkg/services/oauthserver/models.go rename to pkg/services/extsvcauth/oauthserver/models.go diff --git a/pkg/services/oauthserver/oasimpl/aggregate_store.go b/pkg/services/extsvcauth/oauthserver/oasimpl/aggregate_store.go similarity index 99% rename from pkg/services/oauthserver/oasimpl/aggregate_store.go rename to pkg/services/extsvcauth/oauthserver/oasimpl/aggregate_store.go index 1c503fd4ece..bd2bb90371c 100644 --- a/pkg/services/oauthserver/oasimpl/aggregate_store.go +++ b/pkg/services/extsvcauth/oauthserver/oasimpl/aggregate_store.go @@ -9,7 +9,7 @@ import ( "github.com/ory/fosite/handler/rfc7523" "gopkg.in/square/go-jose.v2" - "github.com/grafana/grafana/pkg/services/oauthserver/utils" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/utils" ) var _ fosite.ClientManager = &OAuth2ServiceImpl{} diff --git a/pkg/services/oauthserver/oasimpl/aggregate_store_test.go b/pkg/services/extsvcauth/oauthserver/oasimpl/aggregate_store_test.go similarity index 98% rename from pkg/services/oauthserver/oasimpl/aggregate_store_test.go rename to pkg/services/extsvcauth/oauthserver/oasimpl/aggregate_store_test.go index 955efc402ce..bc49297b9d0 100644 --- a/pkg/services/oauthserver/oasimpl/aggregate_store_test.go +++ b/pkg/services/extsvcauth/oauthserver/oasimpl/aggregate_store_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" ac "github.com/grafana/grafana/pkg/services/accesscontrol" - "github.com/grafana/grafana/pkg/services/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" "github.com/grafana/grafana/pkg/services/user" ) diff --git a/pkg/services/oauthserver/oasimpl/introspection.go b/pkg/services/extsvcauth/oauthserver/oasimpl/introspection.go similarity index 100% rename from pkg/services/oauthserver/oasimpl/introspection.go rename to pkg/services/extsvcauth/oauthserver/oasimpl/introspection.go diff --git a/pkg/services/oauthserver/oasimpl/service.go b/pkg/services/extsvcauth/oauthserver/oasimpl/service.go similarity index 98% rename from pkg/services/oauthserver/oasimpl/service.go rename to pkg/services/extsvcauth/oauthserver/oasimpl/service.go index 4774243e33b..440cddb13ee 100644 --- a/pkg/services/oauthserver/oasimpl/service.go +++ b/pkg/services/extsvcauth/oauthserver/oasimpl/service.go @@ -28,11 +28,11 @@ import ( "github.com/grafana/grafana/pkg/infra/slugify" "github.com/grafana/grafana/pkg/models/roletype" ac "github.com/grafana/grafana/pkg/services/accesscontrol" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/api" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/store" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/utils" "github.com/grafana/grafana/pkg/services/featuremgmt" - "github.com/grafana/grafana/pkg/services/oauthserver" - "github.com/grafana/grafana/pkg/services/oauthserver/api" - "github.com/grafana/grafana/pkg/services/oauthserver/store" - "github.com/grafana/grafana/pkg/services/oauthserver/utils" "github.com/grafana/grafana/pkg/services/org" "github.com/grafana/grafana/pkg/services/serviceaccounts" "github.com/grafana/grafana/pkg/services/signingkeys" diff --git a/pkg/services/oauthserver/oasimpl/service_test.go b/pkg/services/extsvcauth/oauthserver/oasimpl/service_test.go similarity index 99% rename from pkg/services/oauthserver/oasimpl/service_test.go rename to pkg/services/extsvcauth/oauthserver/oasimpl/service_test.go index 325cc612002..1ff9fdce4f7 100644 --- a/pkg/services/oauthserver/oasimpl/service_test.go +++ b/pkg/services/extsvcauth/oauthserver/oasimpl/service_test.go @@ -22,9 +22,9 @@ import ( ac "github.com/grafana/grafana/pkg/services/accesscontrol" "github.com/grafana/grafana/pkg/services/accesscontrol/acimpl" "github.com/grafana/grafana/pkg/services/accesscontrol/actest" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/oastest" "github.com/grafana/grafana/pkg/services/featuremgmt" - "github.com/grafana/grafana/pkg/services/oauthserver" - "github.com/grafana/grafana/pkg/services/oauthserver/oastest" sa "github.com/grafana/grafana/pkg/services/serviceaccounts" satests "github.com/grafana/grafana/pkg/services/serviceaccounts/tests" "github.com/grafana/grafana/pkg/services/signingkeys/signingkeystest" diff --git a/pkg/services/oauthserver/oasimpl/session.go b/pkg/services/extsvcauth/oauthserver/oasimpl/session.go similarity index 100% rename from pkg/services/oauthserver/oasimpl/session.go rename to pkg/services/extsvcauth/oauthserver/oasimpl/session.go diff --git a/pkg/services/oauthserver/oasimpl/token.go b/pkg/services/extsvcauth/oauthserver/oasimpl/token.go similarity index 98% rename from pkg/services/oauthserver/oasimpl/token.go rename to pkg/services/extsvcauth/oauthserver/oasimpl/token.go index e4a5ec238ff..561e4e6089c 100644 --- a/pkg/services/oauthserver/oasimpl/token.go +++ b/pkg/services/extsvcauth/oauthserver/oasimpl/token.go @@ -11,8 +11,8 @@ import ( "github.com/ory/fosite/handler/oauth2" ac "github.com/grafana/grafana/pkg/services/accesscontrol" - "github.com/grafana/grafana/pkg/services/oauthserver" - "github.com/grafana/grafana/pkg/services/oauthserver/utils" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/utils" "github.com/grafana/grafana/pkg/services/team" "github.com/grafana/grafana/pkg/services/user" ) diff --git a/pkg/services/oauthserver/oasimpl/token_test.go b/pkg/services/extsvcauth/oauthserver/oasimpl/token_test.go similarity index 99% rename from pkg/services/oauthserver/oasimpl/token_test.go rename to pkg/services/extsvcauth/oauthserver/oasimpl/token_test.go index 40cdf53b4de..6fb4a42903b 100644 --- a/pkg/services/oauthserver/oasimpl/token_test.go +++ b/pkg/services/extsvcauth/oauthserver/oasimpl/token_test.go @@ -22,7 +22,7 @@ import ( "github.com/grafana/grafana/pkg/models/roletype" ac "github.com/grafana/grafana/pkg/services/accesscontrol" - "github.com/grafana/grafana/pkg/services/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" "github.com/grafana/grafana/pkg/services/serviceaccounts" "github.com/grafana/grafana/pkg/services/team" "github.com/grafana/grafana/pkg/services/user" diff --git a/pkg/services/oauthserver/oastest/fakes.go b/pkg/services/extsvcauth/oauthserver/oastest/fakes.go similarity index 92% rename from pkg/services/oauthserver/oastest/fakes.go rename to pkg/services/extsvcauth/oauthserver/oastest/fakes.go index 95e639d02fb..21b7598d01e 100644 --- a/pkg/services/oauthserver/oastest/fakes.go +++ b/pkg/services/extsvcauth/oauthserver/oastest/fakes.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/grafana/grafana/pkg/services/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" "gopkg.in/square/go-jose.v2" ) diff --git a/pkg/services/oauthserver/oastest/store_mock.go b/pkg/services/extsvcauth/oauthserver/oastest/store_mock.go similarity index 97% rename from pkg/services/oauthserver/oastest/store_mock.go rename to pkg/services/extsvcauth/oauthserver/oastest/store_mock.go index b3107cbe4c5..b4afc43d6ee 100644 --- a/pkg/services/oauthserver/oastest/store_mock.go +++ b/pkg/services/extsvcauth/oauthserver/oastest/store_mock.go @@ -8,7 +8,7 @@ import ( mock "github.com/stretchr/testify/mock" jose "gopkg.in/square/go-jose.v2" - oauthserver "github.com/grafana/grafana/pkg/services/oauthserver" + oauthserver "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" ) // MockStore is an autogenerated mock type for the Store type diff --git a/pkg/services/oauthserver/store/database.go b/pkg/services/extsvcauth/oauthserver/store/database.go similarity index 97% rename from pkg/services/oauthserver/store/database.go rename to pkg/services/extsvcauth/oauthserver/store/database.go index 2a8d19c14bb..7d73cca2508 100644 --- a/pkg/services/oauthserver/store/database.go +++ b/pkg/services/extsvcauth/oauthserver/store/database.go @@ -9,8 +9,8 @@ import ( "gopkg.in/square/go-jose.v2" "github.com/grafana/grafana/pkg/infra/db" - "github.com/grafana/grafana/pkg/services/oauthserver" - "github.com/grafana/grafana/pkg/services/oauthserver/utils" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver/utils" "github.com/grafana/grafana/pkg/util/errutil" ) diff --git a/pkg/services/oauthserver/store/database_test.go b/pkg/services/extsvcauth/oauthserver/store/database_test.go similarity index 99% rename from pkg/services/oauthserver/store/database_test.go rename to pkg/services/extsvcauth/oauthserver/store/database_test.go index 0160c827831..558277b1388 100644 --- a/pkg/services/oauthserver/store/database_test.go +++ b/pkg/services/extsvcauth/oauthserver/store/database_test.go @@ -9,8 +9,8 @@ import ( "github.com/grafana/grafana/pkg/infra/db" "github.com/grafana/grafana/pkg/services/accesscontrol" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" "github.com/grafana/grafana/pkg/services/featuremgmt" - "github.com/grafana/grafana/pkg/services/oauthserver" ) func TestStore_RegisterAndGetClient(t *testing.T) { diff --git a/pkg/services/oauthserver/utils/utils.go b/pkg/services/extsvcauth/oauthserver/utils/utils.go similarity index 100% rename from pkg/services/oauthserver/utils/utils.go rename to pkg/services/extsvcauth/oauthserver/utils/utils.go diff --git a/pkg/services/oauthserver/utils/utils_test.go b/pkg/services/extsvcauth/oauthserver/utils/utils_test.go similarity index 100% rename from pkg/services/oauthserver/utils/utils_test.go rename to pkg/services/extsvcauth/oauthserver/utils/utils_test.go diff --git a/pkg/services/pluginsintegration/serviceregistration/serviceregistration.go b/pkg/services/pluginsintegration/serviceregistration/serviceregistration.go index 6065c1751c2..8c82c2dc0b8 100644 --- a/pkg/services/pluginsintegration/serviceregistration/serviceregistration.go +++ b/pkg/services/pluginsintegration/serviceregistration/serviceregistration.go @@ -6,7 +6,7 @@ import ( "github.com/grafana/grafana/pkg/plugins/auth" "github.com/grafana/grafana/pkg/plugins/plugindef" "github.com/grafana/grafana/pkg/services/accesscontrol" - "github.com/grafana/grafana/pkg/services/oauthserver" + "github.com/grafana/grafana/pkg/services/extsvcauth/oauthserver" ) type Service struct {