1111use App \Services \BirthdayService ;
1212use App \Services \IMAPAuth ;
1313use App \Services \LDAPAuth ;
14+ use App \Services \LDAPFallbackAuth ;
1415use Doctrine \ORM \EntityManagerInterface ;
1516use PDO ;
1617use Psr \Log \LoggerInterface ;
@@ -27,6 +28,7 @@ class DAVController extends AbstractController
2728 public const AUTH_BASIC = 'Basic ' ;
2829 public const AUTH_IMAP = 'IMAP ' ;
2930 public const AUTH_LDAP = 'LDAP ' ;
31+ public const AUTH_LDAP_AND_BASIC = 'BasicAndLDAP ' ;
3032
3133 /**
3234 * Is CalDAV enabled?
@@ -135,6 +137,13 @@ class DAVController extends AbstractController
135137 */
136138 protected $ LDAPAuthBackend ;
137139
140+ /**
141+ * LDAP with Fallback Auth Backend class.
142+ *
143+ * @var LDAPFallbackAuth
144+ */
145+ protected $ LDAPFallbackAuthBackend ;
146+
138147 /**
139148 * Logger for exceptions.
140149 *
@@ -149,7 +158,7 @@ class DAVController extends AbstractController
149158 */
150159 protected $ server ;
151160
152- public function __construct (MailerInterface $ mailer , BasicAuth $ basicAuthBackend , IMAPAuth $ IMAPAuthBackend , LDAPAuth $ LDAPAuthBackend , UrlGeneratorInterface $ router , EntityManagerInterface $ entityManager , LoggerInterface $ logger , BirthdayService $ birthdayService , string $ publicDir , bool $ calDAVEnabled = true , bool $ cardDAVEnabled = true , bool $ webDAVEnabled = false , bool $ publicCalendarsEnabled = true , ?string $ inviteAddress = null , ?string $ authMethod = null , ?string $ authRealm = null , ?string $ webdavPublicDir = null , ?string $ webdavHomesDir = null , ?string $ webdavTmpDir = null )
161+ public function __construct (MailerInterface $ mailer , BasicAuth $ basicAuthBackend , IMAPAuth $ IMAPAuthBackend , LDAPAuth $ LDAPAuthBackend , LDAPFallbackAuth $ LDAPFallbackAuthBackend , UrlGeneratorInterface $ router , EntityManagerInterface $ entityManager , LoggerInterface $ logger , BirthdayService $ birthdayService , string $ publicDir , bool $ calDAVEnabled = true , bool $ cardDAVEnabled = true , bool $ webDAVEnabled = false , bool $ publicCalendarsEnabled = true , ?string $ inviteAddress = null , ?string $ authMethod = null , ?string $ authRealm = null , ?string $ webdavPublicDir = null , ?string $ webdavHomesDir = null , ?string $ webdavTmpDir = null )
153162 {
154163 $ this ->publicDir = $ publicDir ;
155164
@@ -172,6 +181,7 @@ public function __construct(MailerInterface $mailer, BasicAuth $basicAuthBackend
172181 $ this ->basicAuthBackend = $ basicAuthBackend ;
173182 $ this ->IMAPAuthBackend = $ IMAPAuthBackend ;
174183 $ this ->LDAPAuthBackend = $ LDAPAuthBackend ;
184+ $ this ->LDAPFallbackAuthBackend = $ LDAPFallbackAuthBackend ;
175185
176186 $ this ->initServer ($ authMethod , $ authRealm );
177187 $ this ->initExceptionListener ();
@@ -200,6 +210,9 @@ private function initServer(string $authMethod, string $authRealm = User::DEFAUL
200210 case self ::AUTH_LDAP :
201211 $ authBackend = $ this ->LDAPAuthBackend ;
202212 break ;
213+ case self ::AUTH_LDAP_AND_BASIC :
214+ $ authBackend = $ this ->LDAPFallbackAuthBackend ;
215+ break ;
203216 case self ::AUTH_BASIC :
204217 default :
205218 $ authBackend = $ this ->basicAuthBackend ;
0 commit comments