Custom user backend: auth successful but redirects to login

user_management
apps

#1

Hello everyone,

I am currently developping an app that involves a custom user backend to perform authentication. I need to call a REST api from this backend.

I have registered my backend using the container's UserManager like so...

$container->query(IUserManager::class)->registerBackend($container->query(MyBackend::class));

...and things seem to work fine, communication with my REST api is successful.

However, when I attempt to login with correct credentials (I can see it is succesfull as my backend user is created in Owncloud's own storage), I am redirected to the login page with both username and password fields empty.

More precisely, here is what the inspector shows:

.../index.php/login?redirect_url=%252Findex.php%252Fapps%252Ffiles%252F -> 303
.../index.php/apps/files/ -> 303 (why??)
.../index.php/login?redirect_url=%252Findex.php%252Fapps%252Ffiles%252F -> 200 (back to square one...)

My backend currently implements the following methods : checkPassword, getDisplayName, userExists. It extends OC\User\Backend. My checkPassword implementation returns a uid in case of success and false otherwise, which I believe is the expected behavior.

I am testing using OC 10.0.0.12 setup with the ocdev tool.

Thank you very much for your help!