1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/agendav_ynh.git synced 2024-09-03 20:36:12 +02:00
agendav_ynh/sources/patches/add-http-auth_new_try.patch
2018-07-20 15:06:49 +02:00

35 lines
1.1 KiB
Diff

--- a/web/src/Controller/Authentication.php
+++ b/web/src/Controller/Authentication.php
@@ -83,7 +83,7 @@
* @param Application $app
* @return bool false if authentication failed, true otherwise
*/
- protected function processLogin($user, $password, Application $app)
+ public function processLogin($user, $password, Application $app)
{
$app['http.client']->setAuthentication($user, $password, $app['caldav.authmethod']);
--- a/web/app/controllers.php
+++ b/web/app/controllers.php
@@ -7,6 +7,7 @@
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Silex\Application;
+use AgenDAV\Controller\Authentication;
use AgenDAV\DateHelper;
// Authentication
@@ -68,6 +69,13 @@
return;
}
+ if ($request->headers->get('authorization') != null) {
+ $authController = new Authentication();
+ if ($authController->processLogin($request->headers->get('PHP_AUTH_USER'), $request->headers->get('PHP_AUTH_PW'), $app)) {
+ return;
+ }
+ }
+
if ($request->isXmlHttpRequest()) {
return new JsonResponse([], 401);
} else {