diff options
| author | James Elliott <james-d-elliott@users.noreply.github.com> | 2021-07-02 09:16:16 +1000 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-02 09:16:16 +1000 | 
| commit | cb71df5d9b541888b0edf56e006340c84e1266c0 (patch) | |
| tree | 522d56b9bbd6462daa6c311f3727837a2892965c /cmd/authelia | |
| parent | f759b27bb054d2e2766ca720123b27e4efea347b (diff) | |
feat(authentiation): check ldap support for extended operations on startup (#2133)
* feat(authentiation): check ldap server on startup
This PR adds a startup check to the LDAP authentication backend. It additionally adds support for checking supportedExtension OIDs, currently only checking passwdModifyOID (1.3.6.1.4.1.4203.1.11.3). This can relatively easily be enhanced to add detection for other rootDSE capabilities like supportedControl and supportedCapabilities as necessary.
* test(authentication): add unit tests for new feature
* refactor(authentication): factorize ldap user provider newup
* refactor: minor adjustments
Diffstat (limited to 'cmd/authelia')
| -rw-r--r-- | cmd/authelia/main.go | 12 | 
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/authelia/main.go b/cmd/authelia/main.go index 05af593e9..7ca809108 100644 --- a/cmd/authelia/main.go +++ b/cmd/authelia/main.go @@ -94,13 +94,19 @@ func startServer() {  		logger.Fatalf("Unrecognized storage backend")  	} -	var userProvider authentication.UserProvider +	var ( +		userProvider authentication.UserProvider +		err          error +	)  	switch {  	case config.AuthenticationBackend.File != nil:  		userProvider = authentication.NewFileUserProvider(config.AuthenticationBackend.File)  	case config.AuthenticationBackend.LDAP != nil: -		userProvider = authentication.NewLDAPUserProvider(*config.AuthenticationBackend.LDAP, autheliaCertPool) +		userProvider, err = authentication.NewLDAPUserProvider(*config.AuthenticationBackend.LDAP, autheliaCertPool) +		if err != nil { +			logger.Fatalf("Failed to Check LDAP Authentication Backend: %v", err) +		}  	default:  		logger.Fatalf("Unrecognized authentication backend")  	} @@ -117,7 +123,7 @@ func startServer() {  	}  	if !config.Notifier.DisableStartupCheck { -		_, err := notifier.StartupCheck() +		_, err = notifier.StartupCheck()  		if err != nil {  			logger.Fatalf("Error during notifier startup check: %s", err)  		}  | 
