diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2023-08-11 07:56:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-11 07:56:16 +0200 |
commit | c239d69bb786773ed9f3bbc6508062b459a04859 (patch) | |
tree | a663a7d0795101d15242c00691b5e3479791e820 | |
parent | 9df163c65621f62d428a9e81d1c642d61ca89dd6 (diff) | |
parent | c2a8280743d6361339fc8c6188de4063f9ef9268 (diff) | |
download | nextcloud-server-c239d69bb786773ed9f3bbc6508062b459a04859.tar.gz nextcloud-server-c239d69bb786773ed9f3bbc6508062b459a04859.zip |
Merge pull request #39799 from nextcloud/appecosystem-auth-stable27
-rw-r--r-- | build/stubs/app_ecosystem_v2.php | 15 | ||||
-rw-r--r-- | lib/base.php | 19 | ||||
-rw-r--r-- | psalm.xml | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/build/stubs/app_ecosystem_v2.php b/build/stubs/app_ecosystem_v2.php new file mode 100644 index 00000000000..d2b07c9c616 --- /dev/null +++ b/build/stubs/app_ecosystem_v2.php @@ -0,0 +1,15 @@ +<?php + +namespace OCA\AppEcosystemV2\Service; + +use OCP\IRequest; + +class AppEcosystemV2Service { + /** + * @param IRequest $request + * @param bool $isDav + * + * @return bool + */ + public function validateExAppRequestToNC(IRequest $request, bool $isDav = false): bool {} +} diff --git a/lib/base.php b/lib/base.php index ed62494ab30..e201ca29dcf 100644 --- a/lib/base.php +++ b/lib/base.php @@ -1138,6 +1138,9 @@ class OC { if (OC_User::handleApacheAuth()) { return true; } + if (self::tryAppEcosystemV2Login($request)) { + return true; + } if ($userSession->tryTokenLogin($request)) { return true; } @@ -1175,6 +1178,22 @@ class OC { } } } + + protected static function tryAppEcosystemV2Login(OCP\IRequest $request): bool { + $appManager = Server::get(OCP\App\IAppManager::class); + if (!$request->getHeader('AE-SIGNATURE')) { + return false; + } + if (!$appManager->isInstalled('app_ecosystem_v2')) { + return false; + } + try { + $appEcosystemV2Service = Server::get(OCA\AppEcosystemV2\Service\AppEcosystemV2Service::class); + return $appEcosystemV2Service->validateExAppRequestToNC($request); + } catch (\Psr\Container\NotFoundExceptionInterface|\Psr\Container\ContainerExceptionInterface $e) { + return false; + } + } } OC::init(); diff --git a/psalm.xml b/psalm.xml index 831b875d5a0..52eb9841aec 100644 --- a/psalm.xml +++ b/psalm.xml @@ -81,6 +81,7 @@ <file name="build/stubs/zip.php"/> <file name="build/stubs/psr_container.php"/> <file name="3rdparty/sabre/uri/lib/functions.php" /> + <file name="build/stubs/app_ecosystem_v2.php" /> </stubs> <issueHandlers> <UndefinedClass> |