mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AuthN: Refactor basic auth client to support multiple password auth (#61153)
* AuthN: add interface for password clients * AuthN: Extract grafana password client * AuthN: Rewrite basic client tests * AuthN: Add Ldap client and rename method of PasswordClient * AuthN: Configure multiple password clients * AuthN: create ldap service and add tests
This commit is contained in:
@@ -53,9 +53,19 @@ func ProvideService(
|
||||
s.clients[authn.ClientAnonymous] = clients.ProvideAnonymous(cfg, orgService)
|
||||
}
|
||||
|
||||
// FIXME (kalleep): handle cfg.DisableLogin as well?
|
||||
if s.cfg.BasicAuthEnabled && !s.cfg.DisableLogin {
|
||||
s.clients[authn.ClientBasic] = clients.ProvideBasic(userService, loginAttempts)
|
||||
var passwordClients []authn.PasswordClient
|
||||
|
||||
if !s.cfg.DisableLogin {
|
||||
passwordClients = append(passwordClients, clients.ProvideGrafana(userService))
|
||||
}
|
||||
|
||||
if s.cfg.LDAPEnabled {
|
||||
passwordClients = append(passwordClients, clients.ProvideLDAP(cfg))
|
||||
}
|
||||
|
||||
// only configure basic auth client if it is enabled, and we have at least one password client enabled
|
||||
if s.cfg.BasicAuthEnabled && len(passwordClients) > 0 {
|
||||
s.clients[authn.ClientBasic] = clients.ProvideBasic(loginAttempts, passwordClients...)
|
||||
}
|
||||
|
||||
// FIXME (jguer): move to User package
|
||||
|
||||
Reference in New Issue
Block a user