joshp23 / YOURLS-OIDC

OpenID Connect Authentication for YOURLS
GNU General Public License v3.0
7 stars 6 forks source link

Cookies not behaving correctly for OIDC users when using "Option 2" #12

Open fservida opened 2 years ago

fservida commented 2 years ago

When logging users directly using "Option 2" it seems that the cookies are not checked and authentication is performed for every request to the OIDC provider.

Don't know if this is the expected behaviour, but it does create problems with for example XHR requests. I think this is due to https://github.com/YOURLS/YOURLS/blob/a2d0d2f626c7ee8fcd280eb91d08c61354578d04/includes/functions-auth.php#L324-L333 not checking cookies is the user is not in the local database.

fservida commented 2 years ago

Note for me As the cookie is encrypted, the user is not available unless we poll the OIDC provider (and thus have the same problem). One solution might be to store the users logged in through oidc in the options table and fetch that list to iterate over just as yourls does with the $yourls_user_passwords array.

fservida commented 2 years ago

Alternatively store the username in a cookie too

fservida commented 2 years ago

Implemented in #11 To be closed on merge :)