0

I started creating my own test server using SabreDav in a local environment and all worked just fine.

Now, I am trying to migrate my config to my production web server and I am experiencing all sorts of trouble with the PDO authentication as described here.

I successfully created my database and, without authentication, I am able to navigate principal nodes (meaning my DB connection is working fine).

When adding the server pdo authentication plugin, it keeps asking for the login/password, although I have used the default values, as if login/pwd were wrong.

I tested many scenarios and cannot figure out why it keeps preventing me from login - as I am quite sure login / pwd are correct!

Test scenario: see the nodes in myServer/server.php/principals/admin/ (admin being the default user created in the mysql scripts as found here).

Attempt 0: SUCCESS disable authentication in my server.php

$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
// -- comment out $authPlugin = new Sabre\DAV\Auth\Plugin($authBackend);
// -- comment out $server->addPlugin($authPlugin);

Attempt 1: FAIL using default configuration in my server.php fails and keeps prompting for password

$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
$authPlugin = new Sabre\DAV\Auth\Plugin($authBackend);
$server->addPlugin($authPlugin);

Attempt 2: FAIL forcing the default realm in server.php keeps prompting for password

$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
$authBackend->setRealm('SabreDAV');
$authPlugin = new Sabre\DAV\Auth\Plugin($authBackend);
$server->addPlugin($authPlugin);

Attempt 3: FAIL alternate method to forcing the default realm in server.php keeps prompting for password

$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
$authPlugin = new Sabre\DAV\Auth\Plugin($authBackend, 'SabreDAV');
$server->addPlugin($authPlugin);

Attempt 4: FAIL keep the same realm 'SabreDAV' and generate a different digest (actually, I made sure to use the exact same login/password as in my local server which works locally, but not on the web production server...)

$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
$authPlugin = new Sabre\DAV\Auth\Plugin($authBackend, 'SabreDAV');
$server->addPlugin($authPlugin);

IMPORTANT NOTE: It appears my production mysql DB stores encripted data - if this is the origin of the problem, is there a way to resolve the issue ?

Login window says ´A username and password are being requested by https://mywebsite.com. The site says: "SabreDAV"´.

Then when hitting escape, here is the error page:

<d:error>
    <s:sabredav-version>3.0.3</s:sabredav-version>
    <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
    <s:message>No 'Authorization: Digest' header found. Either the client didn't send one, or the server is mis-configured</s:message>
</d:error>

I did set-up a digest in my server configuration, as I use the standard way described in tutorials:

$authPlugin = new Sabre\DAV\Auth\Plugin($authBackend, 'SabreDAV');
neggenbe
  • 1,697
  • 2
  • 24
  • 62
  • Try entering a password in your browser, and when the password dialog pops up again, hit escape. What's the error message? – Evert Sep 08 '15 at 23:41
  • Please look at Update in my original post! Cheers! – neggenbe Sep 09 '15 at 14:58
  • Make sure you *first* enter a password, only after the login dialog appears for the second time you hit escape. If you get the exact same error, it basically means that your webserver strips the digest auth header before it can reach PHP. – Evert Sep 09 '15 at 15:06
  • So I did first login attempt, when seeing the second one I hit escape as suggested: I do get the same error indeed. Any recommended fix about that?? – neggenbe Sep 09 '15 at 16:55
  • 1
    There's a lot of typical troubleshooting suggestions here: http://sabre.io/dav/authentication/ – Evert Sep 09 '15 at 16:59
  • Ok I am one step further - but looking at my UPDATE 2, you'll see that my settings don't seem to be taking into account a custom realm...! – neggenbe Sep 10 '15 at 15:17

1 Answers1

5

Credits to Evert for pointing me to the right direction using a .htaccess file at the server root that contains following code:

RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
Community
  • 1
  • 1
neggenbe
  • 1,697
  • 2
  • 24
  • 62