nextcloud-oidc-login icon indicating copy to clipboard operation
nextcloud-oidc-login copied to clipboard

Broken Token Handling

Open kriszman opened this issue 3 years ago • 2 comments

https://github.com/pulsejet/nextcloud-oidc-login/blob/cad3f89dc19777c248a168be546641988d930a34/lib/Controller/LoginController.php#L154

It seems like there's an issue during the verification of the user profile after the actual provider login. Obviously there's a token generated for each login within the new version 2.x which in turn is passed to the Nextcloud internal login completion handling, compare: https://github.com/nextcloud/server/blob/c624c7eb5d437adea4a046fe4f66b0a700e59e3e/lib/private/User/Session.php#L391

This leads to unexpected results, as internally the corresponding user is never seen for the first time and the last login timestamp isn't persisted as well. As a result the user skeleton directory for instance is never copied in place during the first login.

kriszman avatar Nov 30 '21 14:11 kriszman

Hi,

I can't reproduce the issue, that the skeleton directory is not created. When I log in the first time using OIDC, the user's folder is populated correctly.

If a user does not exist, we create a new one with a randomly chosen password. This password is returned to the LoginController.

https://github.com/pulsejet/nextcloud-oidc-login/blob/cad3f89dc19777c248a168be546641988d930a34/lib/Service/LoginService.php#L152-L163

If the user was created and thus the password is set, the token handed Nextcloud's completeLogin is null. Then, this triggers setting the firstTimeLogin variable (see Nextcloud Session).

https://github.com/pulsejet/nextcloud-oidc-login/blob/eb364f08c923bccfafe130dd51b25787b8fcb451/lib/Controller/LoginController.php#L147-L151

sirkrypt0 avatar Jan 22 '22 17:01 sirkrypt0

I just tested a first time login, and I can confirm that the skeleton directory was not correctly copied. I have not investigated why though.

azmeuk avatar Feb 13 '22 15:02 azmeuk

I have been using this plugin for over a year, and it has been copying the skeleton files properly until recently. Are there any workarounds for the issue/knowledge on why it happens/updates on potential solutions?

Thanks!

tizzir avatar Jan 20 '23 16:01 tizzir