LDAP: Allow an user to be synchronised against LDAP (#18976)

* LDAP: Allow an user to be synchronised against LDAP
This PR introduces the /ldap/sync/:id endpoint. It allows a user to be synchronized against LDAP on demand.

A few things to note are:

LDAP needs to be enabled for the sync to work
It only works against users that originally authenticated against LDAP
If the user is the Grafana admin and it needs to be disabled - it will not sync the information
Includes a tiny refactor that favours the JSONEq assertion helper instead of manually parsing JSON strings.
This commit is contained in:
gotjosh
2019-09-13 16:26:25 +01:00
committed by GitHub
parent 475673c82f
commit 7b7b95341e
5 changed files with 312 additions and 56 deletions
+1
View File
@@ -395,6 +395,7 @@ func (hs *HTTPServer) registerRoutes() {
adminRoute.Post("/provisioning/datasources/reload", Wrap(hs.AdminProvisioningReloadDatasources))
adminRoute.Post("/provisioning/notifications/reload", Wrap(hs.AdminProvisioningReloadNotifications))
adminRoute.Post("/ldap/reload", Wrap(hs.ReloadLDAPCfg))
adminRoute.Post("/ldap/sync/:id", Wrap(hs.PostSyncUserWithLDAP))
adminRoute.Get("/ldap/:username", Wrap(hs.GetUserFromLDAP))
adminRoute.Get("/ldap/status", Wrap(hs.GetLDAPStatus))
}, reqGrafanaAdmin)