Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Implement option for custom redirect URL & Fixes sessions for users not in local database - #11

Open
fservida wants to merge 3 commits into
joshp23:masterfrom
fservida:master
Open

Implement option for custom redirect URL & Fixes sessions for users not in local database#11
fservida wants to merge 3 commits into
joshp23:masterfrom
fservida:master

Conversation

@fservida

@fservida fservida commented May 1, 2022

Copy link
Copy Markdown

When using Yourls behind a reverse proxy apparently jumbojett has trouble detecting the correct URL, as it redirects to /admin and not /admin/ (at least in my setup using yours docker image).
This leads to subsequent broken redirects and http downgrade (probably more of an issue with yourls itself). (see screenshots). Because of the http downgrade, apart from the obvious problem of insecure traffic, this breaks implementations in frames.

I've managed to simply fix this by manually setting the redirect URL that the OIDC plugin uses instead of autodetecting it.
As it might be useful for others I've generalized the solution by reading an optional constant from the config.php file.

image
image

fservida added 3 commits May 1, 2022 15:48
Implement configuration parameter for OIDC redirect URL.
Useful for setups behind reverse proxies where the URL is incorrectly detected leading to non working redirects
Users not in the user database could not use cookies due to the nature of the cookie itself and the check implemented by yourls.
As such an additional cookie is created stored the username and an additional check is introduced in the plugin to validate the cookie against such username.
The username cookie has the same security properties as the one set by yourls and is deleted upon logout.
@fservida

fservida commented May 1, 2022

Copy link
Copy Markdown
Author

Commit 44e959c fixes the login with the cookies, which was also critical as the manual redirect URL meant any auth flow became problematic as it was always redirected to the /admin/ path.

Solves #12 and #7

@fservida fservida changed the title Implement option for custom redirect URL Implement option for custom redirect URL & Fixes sessions for users not in database May 1, 2022
@fservida fservida changed the title Implement option for custom redirect URL & Fixes sessions for users not in database Implement option for custom redirect URL & Fixes sessions for users not in local database May 1, 2022
@aurorasmiles

Copy link
Copy Markdown

Thank you very much, this solved my issue similar to #7

@Shocktrooper

Copy link
Copy Markdown

@joshp23 Is there any way we can get this merged soon?

@Shocktrooper

Copy link
Copy Markdown

This code has been stable and working for us for the past week or so with no issues

mvalois added a commit to teicee/YOURLS-OIDC that referenced this pull request Jun 25, 2024
 Implement option for custom redirect URL & Fixes sessions for users not in local database joshp23#11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants