cmd/syncthing: Add LDAP authentication for GUI (fixes #5163) (#5169)

This commit is contained in:
Boris Rybalkin
2018-09-11 22:25:24 +01:00
committed by Jakob Borg
parent 50ba0fd079
commit 1b1741de64
37 changed files with 4435 additions and 46 deletions

View File

@@ -119,6 +119,7 @@ type modelIntf interface {
type configIntf interface {
GUI() config.GUIConfiguration
LDAP() config.LDAPConfiguration
RawCopy() config.Configuration
Options() config.OptionsConfiguration
Replace(cfg config.Configuration) (config.Waiter, error)
@@ -343,8 +344,8 @@ func (s *apiService) Serve() {
handler = withDetailsMiddleware(s.id, handler)
// Wrap everything in basic auth, if user/password is set.
if len(guiCfg.User) > 0 && len(guiCfg.Password) > 0 {
handler = basicAuthAndSessionMiddleware("sessionid-"+s.id.String()[:5], guiCfg, handler)
if guiCfg.IsAuthEnabled() {
handler = basicAuthAndSessionMiddleware("sessionid-"+s.id.String()[:5], guiCfg, s.cfg.LDAP(), handler)
}
// Redirect to HTTPS if we are supposed to