grafana/pkg/services/accesscontrol
Jeremy Price 6dbb6408d4
Access Control: Add service accounts (#38994)
* Add extra fields to OSS types to support enterprise

* Create a service account at the same time as the API key

* Use service account credentials when accessing API with APIkey

* Add GetRole to service, merge RoleDTO and Role structs

This patch merges the identical OSS and Enterprise data structures, which improves the code for two reasons:

1.  Makes switching between OSS and Enterprise easier
2.  Reduces the chance of incompatibilities developing between the same functions in OSS and Enterprise

* If API key is not linked to a service account, continue login as usual

* Fallback to old auth if no service account linked to key

* Add CloneUserToServiceAccount

* Adding LinkAPIKeyToServiceAccount

* Handle api key link error

* Better error messages for OSS accesscontrol

* Set an invalid user id as default

* Re-arrange field names

* ServiceAccountId is integer

* Better error messages

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2021-10-20 14:36:11 +02:00
..
middleware Chore: replace macaron with web package (#40136) 2021-10-11 14:30:59 +02:00
mock Access Control: Add service accounts (#38994) 2021-10-20 14:36:11 +02:00
ossaccesscontrol Access Control: Add service accounts (#38994) 2021-10-20 14:36:11 +02:00
accesscontrol.go Access Control: Add service accounts (#38994) 2021-10-20 14:36:11 +02:00
errors.go Revert "Revert "AccessControl: Implement a way to register fixed roles (#35641)" (#37397)" (#37535) 2021-08-04 14:44:37 +02:00
evaluator_test.go AccessControl: Extend scope parameters with extra params from context (#39722) 2021-10-06 13:15:09 +02:00
evaluator.go AccessControl: Extend scope parameters with extra params from context (#39722) 2021-10-06 13:15:09 +02:00
models.go feat: fallback for displayname of non-fixed role without displayname (#40277) 2021-10-11 16:00:54 +01:00
roles_test.go Revert "Revert "AccessControl: Implement a way to register fixed roles (#35641)" (#37397)" (#37535) 2021-08-04 14:44:37 +02:00
roles.go Migrate to Wire for dependency injection (#32289) 2021-08-25 15:11:22 +02:00
scope.go AccessControl: Extend scope parameters with extra params from context (#39722) 2021-10-06 13:15:09 +02:00
scoperesolution_test.go AccessControl: keyword scope resolution (#40229) 2021-10-19 14:40:21 +02:00
scoperesolution.go AccessControl: keyword scope resolution (#40229) 2021-10-19 14:40:21 +02:00