refactor: use is configured check in ldap service

This commit is contained in:
Stavros
2026-02-01 19:05:42 +02:00
parent 671343f677
commit eff5fc8b71
3 changed files with 17 additions and 9 deletions

View File

@@ -36,7 +36,16 @@ func NewLdapService(config LdapServiceConfig) *LdapService {
}
}
// If you have an ldap address then you must need ldap
func (ldap *LdapService) IsConfigured() bool {
return ldap.config.Address != ""
}
func (ldap *LdapService) Init() error {
if !ldap.IsConfigured() {
return nil
}
// Check whether authentication with client certificate is possible
if ldap.config.AuthCert != "" && ldap.config.AuthKey != "" {
cert, err := tls.LoadX509KeyPair(ldap.config.AuthCert, ldap.config.AuthKey)