vmware-archive / gangway

An application that can be used to easily enable authentication flows via OIDC for a kubernetes cluster.
Apache License 2.0
410 stars 112 forks source link

Change logout button href (in commandline.tmpl) from `/logout` to `$BASEPATH/logout` #150

Closed kdevu closed 3 years ago

kdevu commented 4 years ago

Hi,

The syntax in the title is definitely not accurate/correct, but I hope it makes sense.

My Problem

I've set Gangway's base path to /gangway, but the Logout button in the /gangway/commandline page doesn't use the new base path I've set. It's set to /logout rather than /gangway/logout.

For example, when I click the logout button I would expect it to go to /gangway/logout but instead the logout attempt is failing because it is going to /logout .

The workaround to this is for me to not use the broken Logout button, but instead directly go to /gangway/logout via the Address Bar.

Looking at this line in the template file it appears that the Logout button will always be set to /logout and is not customizable (unless you fork the project and change it yourself).

Would it be possible to make the Logout button use $BASEPATH/logout instead?

jkirklan commented 4 years ago

Can you post the config file you are using with gangway when the issue happens?

kdevu commented 4 years ago

Hi,

Sorry for the late response.

The key observation I've done is to open MY_URL/gangway/ (the homepage) and MY_URL/gangway/commandline (the commandline page you see after logging in) and compare the contents of their HTML by opening the Developer Tools of my browser of choice.


The Sign-In button in the home page uses $BASEPATH/login

The MY_URL/gangway page has a sign-in button that has the path correctly configured to point to /gangway/login with /gangway being the value I set to gangway.httpPath

Looking at the template files, I can see that this is the line where the path is configured https://github.com/heptiolabs/gangway/blob/master/templates/home.tmpl#L51


The Logout button in the commandline page uses /logout

The MY_URL/gangway/commandlne page with the broken logout button is incorrectly configured to point to /login. If I've set the basepath to /gangway the path used should be /gangway/logout

Looking at the template files, I can see that this is the line where the path is incorrectly configured https://github.com/heptiolabs/gangway/blob/master/templates/commandline.tmpl#L25


Comparing the two template files, it seems like updating the logout button to use {{ .HTTPPath }}/logout (like how the sign-in button is configured) could work.

jenting commented 3 years ago

The #153 merged, I think this issue could be closed. cc @stevesloka

srvmsr commented 3 years ago

Since this is not release yet , i would also recommend to modify your ingress as below to change the basepath for logout . nginx.ingress.kubernetes.io/configuration-snippet: | proxy_set_header Accept-Encoding ""; sub_filter '<a href="/logout">' '<a href="/<**basepath**>/logout">'; sub_filter_once on;