rotdrop / nextcloud-app-dokuwiki

NextCloud "app" which embeds an existing DokuWiki instance into NextCloud. Intended for SSO.
GNU Affero General Public License v3.0
7 stars 5 forks source link

DokuWiki inclusion is not operational #9

Open knieselpriem opened 1 year ago

knieselpriem commented 1 year ago

NextCoud Version 25.0.3 Users are authenticated by SAMBA AD (LDAP)

[PHP] Fehler: Error: Undefined array key "path" at /var/www/nextcloud/apps/dokuwiki/lib/Service/AuthDokuWiki.php#139 at <>

  1. /var/www/nextcloud/apps/dokuwiki/lib/Service/AuthDokuWiki.php line 139 OC\Log\ErrorHandler::onError()
  2. <> OCA\DokuWiki\Service\AuthDokuWiki->__construct()
  3. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 108 ReflectionClass->newInstanceArgs()
  4. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 116 OC\AppFramework\Utility\SimpleContainer->buildClass()
  5. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 133 OC\AppFramework\Utility\SimpleContainer->resolve()
  6. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 465 OC\AppFramework\Utility\SimpleContainer->query()
  7. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 437 OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()
  8. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 89 OC\AppFramework\DependencyInjection\DIContainer->query()
  9. <> OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}(" sensitive parameters replaced ")
  10. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 108 array_map()
    1. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 116 OC\AppFramework\Utility\SimpleContainer->buildClass()
    2. /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php line 133 OC\AppFramework\Utility\SimpleContainer->resolve()
    3. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 465 OC\AppFramework\Utility\SimpleContainer->query()
    4. /var/www/nextcloud/lib/private/AppFramework/DependencyInjection/DIContainer.php line 437 OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback()
    5. /var/www/nextcloud/lib/private/AppFramework/App.php line 159 OC\AppFramework\DependencyInjection\DIContainer->query()
    6. /var/www/nextcloud/lib/private/Route/Router.php line 298 OC\AppFramework\App::main()
    7. /var/www/nextcloud/lib/base.php line 1047 OC\Route\Router->match()
    8. /var/www/nextcloud/index.php line 36 OC::handleRequest()

GET /index.php/apps/dokuwiki/page/index

[index] Fehler: Exception: xmlRequest(wiki.getPage) failed (-1) at <>

  1. /var/www/nextcloud/apps/dokuwiki/lib/Service/AuthDokuWiki.php line 274 OCA\DokuWiki\Service\AuthDokuWiki->handleError()
  2. /var/www/nextcloud/apps/dokuwiki/lib/Service/AuthDokuWiki.php line 488 OCA\DokuWiki\Service\AuthDokuWiki->xmlRequest()
  3. /var/www/nextcloud/apps/dokuwiki/lib/Service/AuthDokuWiki.php line 451 OCA\DokuWiki\Service\AuthDokuWiki->getPage()
  4. /var/www/nextcloud/apps/dokuwiki/lib/Controller/PageController.php line 125 OCA\DokuWiki\Service\AuthDokuWiki->refresh()
  5. /var/www/nextcloud/apps/dokuwiki/lib/Controller/PageController.php line 99 OCA\DokuWiki\Controller\PageController->frame()
  6. <> OCA\DokuWiki\Controller\PageController->index()
  7. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 225 call_user_func_array()
  8. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 133 OC\AppFramework\Http\Dispatcher->executeController()
  9. /var/www/nextcloud/lib/private/AppFramework/App.php line 172 OC\AppFramework\Http\Dispatcher->dispatch()
  10. /var/www/nextcloud/lib/private/Route/Router.php line 298 OC\AppFramework\App::main()
    1. /var/www/nextcloud/lib/base.php line 1047 OC\Route\Router->match()
    2. /var/www/nextcloud/index.php line 36 OC::handleRequest()

GET /index.php/apps/dokuwiki/page/index

rotdrop commented 1 year ago

This array key refers to the path component of the DokuWiki URL. E.g. in my test-setup the DokuWiki URL is something like

https://dev1.test.tld/dokuwiki

There are also some restriction caused by a "same site" policy (see https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy) which probably is in use meaning that Nextcloud and Dokuwiki must virtually reside on the same server.

Can you please shine some light on your configuration?

Of course, the error message generated by the app is not really helpful ...

knieselpriem commented 1 year ago

URL's:

This URL is configured in the settings of the app: https://wiki.server.lan

I didn't read about those restrictions in the documentation of the app. If this is the cause of the exception, this app makes no sense for my intention to use.

rotdrop commented 1 year ago

URL's:

* Nextcloud: `cloud.server.lan`

* DokuWIki: `wiki.server.lan`

This URL is configured in the settings of the app: https://wiki.server.lan

I didn't read about those restrictions in the documentation of the app. If this is the cause of the exception, this app makes no sense for my intention to use.

Caution. You are maybe a bit too fast with you conclusion. Some explanations and hints for the web-server setup can be found here:

https://github.com/rotdrop/nextcloud-roundcube#adminstration-web-server-setup

In short: if you have access to the web-server configuration of the server running you Nextcloud instance then you can map the Dokuwiki instance into the Nextcloud site by means of a proxy configuration. There are some more possibilities depending on you setup.

For the code quality of this app, there are two points:

  1. Of course, the undefined array key bug should be fixed
  2. The app should try to detect configurations which are known to be problematic. However, also the same-site policy depends on your web-server setup (the CSP policy configured in Nextcloud)
  3. The documentation should be updated. I will probably simply copy over the sections from that nextcloud-roundcube app as the embedding technique and problems are similar.
rotdrop commented 1 year ago

For the moment, you could try to change line 139 in that file

https://github.com/rotdrop/nextcloud-app-dokuwiki/blob/f44d9a4e4ecb23786a385517fd68cbdf465caa0d/lib/Service/AuthDokuWiki.php#L139

to look like this

      $this->dwPath  = $urlParts['path'] ?? '';

This will not change the CSP policy but fix the undefined array key bug.