*/ class SabrePluginAuthInitListener implements IEventListener { private PublicAlbumAuthBackend $publicAlbumAuthBackend; public function __construct(PublicAlbumAuthBackend $publicAlbumAuthBackend) { $this->publicAlbumAuthBackend = $publicAlbumAuthBackend; } public function handle(Event $event): void { if (!($event instanceof SabrePluginAuthInitEvent)) { return; } $server = $event->getServer(); if (!str_starts_with($server->getRequestUri(), 'photospublic/')) { return; } $authPlugin = $server->getPlugin('auth'); $authPlugin->addBackend($this->publicAlbumAuthBackend); } }