Auth: Add tracing to auth clients and AuthToken service (#107878)

* Add tracing to auth clients + authtoken svc

* Fix span names

* Fix ext_jwt.go

* Fix idimpl/service

* Update wire_gen.go

* Add tracing to JWT client

* Lint
This commit is contained in:
Misi
2025-07-10 15:41:00 +02:00
committed by GitHub
parent 01269c5dd1
commit 1f3dc0533c
23 changed files with 205 additions and 63 deletions
+9 -9
View File
@@ -48,10 +48,10 @@ func ProvideRegistration(
logger := log.New("authn.registration")
authnSvc.RegisterClient(clients.ProvideRender(renderService))
authnSvc.RegisterClient(clients.ProvideAPIKey(apikeyService))
authnSvc.RegisterClient(clients.ProvideAPIKey(apikeyService, tracer))
if cfg.LoginCookieName != "" {
authnSvc.RegisterClient(clients.ProvideSession(cfg, sessionService, authInfoService))
authnSvc.RegisterClient(clients.ProvideSession(cfg, sessionService, authInfoService, tracer))
}
var proxyClients []authn.ProxyClient
@@ -59,20 +59,20 @@ func ProvideRegistration(
// always register LDAP if LDAP is enabled in SSO settings
if cfg.LDAPAuthEnabled || features.IsEnabledGlobally(featuremgmt.FlagSsoSettingsLDAP) {
ldap := clients.ProvideLDAP(cfg, ldapService, userService, authInfoService)
ldap := clients.ProvideLDAP(cfg, ldapService, userService, authInfoService, tracer)
proxyClients = append(proxyClients, ldap)
passwordClients = append(passwordClients, ldap)
}
if !cfg.DisableLogin {
grafana := clients.ProvideGrafana(cfg, userService)
grafana := clients.ProvideGrafana(cfg, userService, tracer)
proxyClients = append(proxyClients, grafana)
passwordClients = append(passwordClients, grafana)
}
// if we have password clients configure check if basic auth or form auth is enabled
if len(passwordClients) > 0 {
passwordClient := clients.ProvidePassword(loginAttempts, passwordClients...)
passwordClient := clients.ProvidePassword(loginAttempts, tracer, passwordClients...)
if cfg.BasicAuthEnabled {
authnSvc.RegisterClient(clients.ProvideBasic(passwordClient))
}
@@ -103,7 +103,7 @@ func ProvideRegistration(
}
if cfg.AuthProxy.Enabled && len(proxyClients) > 0 {
proxy, err := clients.ProvideProxy(cfg, cache, proxyClients...)
proxy, err := clients.ProvideProxy(cfg, cache, tracer, proxyClients...)
if err != nil {
logger.Error("Failed to configure auth proxy", "err", err)
} else {
@@ -113,16 +113,16 @@ func ProvideRegistration(
if cfg.JWTAuth.Enabled {
orgRoleMapper := connectors.ProvideOrgRoleMapper(cfg, orgService)
authnSvc.RegisterClient(clients.ProvideJWT(jwtService, orgRoleMapper, cfg))
authnSvc.RegisterClient(clients.ProvideJWT(jwtService, orgRoleMapper, cfg, tracer))
}
if cfg.ExtJWTAuth.Enabled {
authnSvc.RegisterClient(clients.ProvideExtendedJWT(cfg))
authnSvc.RegisterClient(clients.ProvideExtendedJWT(cfg, tracer))
}
for name := range socialService.GetOAuthProviders() {
clientName := authn.ClientWithPrefix(name)
authnSvc.RegisterClient(clients.ProvideOAuth(clientName, cfg, oauthTokenService, socialService, settingsProviderService, features))
authnSvc.RegisterClient(clients.ProvideOAuth(clientName, cfg, oauthTokenService, socialService, settingsProviderService, features, tracer))
}
if features.IsEnabledGlobally(featuremgmt.FlagProvisioning) {