mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
More work on ldap auth, got memberOf working in the docker ldap test server, playing with config options and structures, #1450
This commit is contained in:
@@ -13,32 +13,6 @@ var (
|
||||
ErrInvalidCredentials = errors.New("Invalid Username or Password")
|
||||
)
|
||||
|
||||
type LoginSettings struct {
|
||||
LdapEnabled bool
|
||||
}
|
||||
|
||||
type LdapFilterToOrg struct {
|
||||
Filter string
|
||||
OrgId int
|
||||
OrgRole string
|
||||
}
|
||||
|
||||
type LdapSettings struct {
|
||||
Enabled bool
|
||||
Hosts []string
|
||||
UseSSL bool
|
||||
BindDN string
|
||||
AttrUsername string
|
||||
AttrName string
|
||||
AttrSurname string
|
||||
AttrMail string
|
||||
Filters []LdapFilterToOrg
|
||||
}
|
||||
|
||||
type AuthSource interface {
|
||||
AuthenticateUser(username, password string) (*m.User, error)
|
||||
}
|
||||
|
||||
type AuthenticateUserQuery struct {
|
||||
Username string
|
||||
Password string
|
||||
@@ -56,7 +30,13 @@ func AuthenticateUser(query *AuthenticateUserQuery) error {
|
||||
}
|
||||
|
||||
if setting.LdapEnabled {
|
||||
err = loginUsingLdap(query)
|
||||
for _, server := range setting.LdapServers {
|
||||
auther := NewLdapAuthenticator(server)
|
||||
err = auther.login(query)
|
||||
if err == nil || err != ErrInvalidCredentials {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user