`Authorizer`: rename and enforce only once for `NewGrafanaAuthorizer` (#108294)

* renaming of GrafanaAuthorizer to make it less confusing

* enforce only once by runtime

* comment only
pull/108336/head
Eric Leijonmarck 2 days ago committed by GitHub
parent f009c2dcdd
commit aa0f8caa35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      pkg/services/apiserver/auth/authorizer/authorizer.go
  2. 2
      pkg/services/apiserver/service.go

@ -18,7 +18,8 @@ type GrafanaAuthorizer struct {
auth authorizer.Authorizer
}
// NewGrafanaAuthorizer returns an authorizer configured for a grafana instance.
// NewGrafanaBuiltInSTAuthorizer returns an authorizer configured for a grafana instance.
// should not be used anywhere except for ST builtin Grafana
// This authorizer is a chain of smaller authorizers that together form the decision if
// access should be granted.
// 1. We deny all impersonate request.
@ -28,7 +29,7 @@ type GrafanaAuthorizer struct {
// 4. We check authorizer that is configured speficially for an api.
// 5. As a last fallback we check Role, this will only happen if an api have not configured
// an authorizer or return authorizer.DecisionNoOpinion
func NewGrafanaAuthorizer(cfg *setting.Cfg) *GrafanaAuthorizer {
func NewGrafanaBuiltInSTAuthorizer(cfg *setting.Cfg) *GrafanaAuthorizer {
authorizers := []authorizer.Authorizer{
newImpersonationAuthorizer(),
authorizerfactory.NewPrivilegedGroups(k8suser.SystemPrivilegedGroup),

@ -138,7 +138,7 @@ func ProvideService(
rr: rr,
stopCh: make(chan struct{}),
builders: []builder.APIGroupBuilder{},
authorizer: authorizer.NewGrafanaAuthorizer(cfg),
authorizer: authorizer.NewGrafanaBuiltInSTAuthorizer(cfg),
tracing: tracing,
db: db, // For Unified storage
metrics: reg,

Loading…
Cancel
Save