server icon indicating copy to clipboard operation
server copied to clipboard

Not able to authenticate external user backend(specifically Keycloak) using Webdav

Open karankotz opened this issue 8 years ago • 17 comments

I am operating on Ubuntu 17.10.

I have configured the NextCloud with the keycloak and the authentication works fine. Accessing the nextcloud server url re-directs me to the keycloak login page and get the authentication working from the keycloak server.

I want to carry out the same authentication via webdav, but I believe the webdav of nextcloud is not supporting this.

I try to CURL with the username and password it authenticates and gives the result.

curl --user admin:password http://172.17.0.1/remote.php/dav/files/admin/Documents

But, if I try the CURL with the bearer token that I have generated using the keycloak then it is not working and I get the response as indicated.

curl -H "Authorization: Bearer <Token>" http://172.17.0.1/remote.php/dav/files/admin/Documents

Response:

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
  <s:message>No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, Bearer token was incorrect, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured</s:message>
</d:error>

There was already a similar issue at https://github.com/nextcloud/server/issues/5512, although in this issue the user was not using any of the external user backend, as I am using the keycloak server.

I also did hit the webdav url http://172.17.0.1/remote.php/dav/files/admin/Documents, and it gives me the prompt for the basic credentials.

karankotz avatar May 28 '18 18:05 karankotz

We really need an answer here too, I checked #5512 and the trick to use bearer as password with basic auth doesn't work at all. About .htaccess or any configuration it s not clear

amdev74 avatar Jun 13 '18 14:06 amdev74

@Cracky5457 Can you please tell me, which external user backend are you using?

karankotz avatar Jun 14 '18 05:06 karankotz

We also want to use Keycloak but I tried with MitreOpenId and it doesn't work either, but I think whatever the external OIDC provider that you use, nextcloud just seems to not accept bearer token.

amdev74 avatar Jun 14 '18 07:06 amdev74

Same here (token from keycloak, Bearer not working, interactive login via kc works, dav urls show basic cred dialog)

digitalkram avatar Aug 10 '18 14:08 digitalkram

We're seeing the same thing here. Local users are fine, SSO based users are not.

buggtb avatar Feb 07 '19 14:02 buggtb

Hi , Is there any progress. I am stuck on the same point. Looking for urgent help. I am using nextcloud docker image with tag 19.0.0

uzzal2k5 avatar Jul 08 '20 11:07 uzzal2k5

Any update guys ? I am too stuck at the same point, having exactly same issue as OP even though I tried all suggestions solutions here Would very helpful if we can get some clarification on how to fix it ! Thanks guys

kabrana avatar Oct 07 '20 18:10 kabrana

I have the same issue...trying to connect via the OnlyOffice Android App is not working also Windows Webdav is not working. No idea how to fix this ...

schupat avatar Oct 09 '20 19:10 schupat

does #23920 fix this for you?

DanScharon avatar Nov 19 '20 19:11 DanScharon

@DanScharon I just need to update to a new version correct? (using docker)

schupat avatar Nov 20 '20 13:11 schupat

@checkso yes, to any version of either 20.0.2, 19.0.5 or 18.0.11

DanScharon avatar Nov 20 '20 15:11 DanScharon

@DanScharon thanks for your comment but I am actually enable to test the fix in both releases 20.0.2, 19.0.5 due to an issue happening whenever I try to enable the app "OpenID Connect user backend" showing the following error "Column name "oc_user_oidc"."display_name" is NotNull, but has empty string or null as default" Screen Shot 2020-11-24 at 2 20 59 AM

kabrana avatar Nov 24 '20 10:11 kabrana

@kabrana That issue recently has been fixed: nextcloud/user_oidc#90.

muekoeff avatar Feb 03 '21 12:02 muekoeff

Does the OpenID Connect user backend app solve this issue? I'm still getting the error shown in the first message when I pass a Keycloak token. The app seems to be completely ignored. It has no documentation too.

Anyone who succeeded?

Edit: the error I am getting is actually the one below, the bearer is received but is incorrect.

<s:message>No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, Bearer token was incorrect, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured</s:message>

torshid avatar Jun 03 '21 08:06 torshid

Is this Issue still valid in NC21.0.3? If not, please close this issue. Thanks! :)

szaimen avatar Jul 07 '21 12:07 szaimen

Yes it is. I use openid connect login plugin and created users authenticated with openid connect will not be recognized for WebDAV.

djessich avatar Jul 25 '21 20:07 djessich

Authentication with OIDC tokens is not possible with the app as of right now. For API access you will need to use a app password from Nextcloud. Feel free to open a feature request for this in https://github.com/nextcloud/user_oidc in order to add support for authentication for OIDC tokens.

juliusknorr avatar Aug 06 '21 10:08 juliusknorr