Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] remove /logout route (do not implement front channel logout) #3759

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

freemvmt
Copy link
Contributor

@freemvmt freemvmt commented Oct 3, 2024

Relates to this Trello ticket and follows on from #3453.

After some investigation, I came to the conclusion that implementing front channel logout does not make sense in our context.

Before I realised that, and while trying to figure out how best to implement it, I realised that the API's /logout route is never hit, so serves no purpose. Therefore I have removed it in this PR.

Some context

As per the Open ID Connect spec, a front channel logout is intended to log a user out of any server on which they are authenticated by a provider (e.g. Microsoft), when they log out of said provider centrally (or via another service).

For example, if I log out of my Microsoft account on Microsoft.com, I'd expect to be simultaneously logged out of PlanX, assuming I'd logged in via Microsoft SSO.

However, a PlanX user being 'logged in' is currently achieved by the presence of a jwt cookie stored on the browser, and does not relate to any session or state stored on the API server or in the database (this client-side session data is cleared when the user clicks Logout - see here).

Therefore, there is no server to communicate a logout instruction to. The JWT on the user's browser cannot be revoked from without, will expire in due course (??), and cannot be renewed without signing in again.

I think this is a reasonable situation. If we wanted Microsoft to be able to log a user out, we'd have to keep session server-side, which would be a significant change.

Further resources

@freemvmt freemvmt changed the title [api] remove unusued /logout route (do not implement front channel logout) [api] remove /logout route (do not implement front channel logout) Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

Removed vultr server and associated DNS entries

Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, as well as the clear and comprehensive update in the PR description.

One small change required - we also need to update api.planx.uk/modules/auth/docs.yaml to remove the /logout route - this is currently not dynamically generated by Express and is a bit of a painful manual step. This generates our Swagger API docs hosted here -

https://api.3759.planx.pizza/docs/#/auth/get_logout

@freemvmt freemvmt force-pushed the api-microsoft-frontend-logout branch 2 times, most recently from b89676e to 9d2bb7d Compare October 10, 2024 18:34
@freemvmt
Copy link
Contributor Author

One small change required - we also need to update api.planx.uk/modules/auth/docs.yaml to remove the /logout route [...]

@DafyddLlyr nice catch, have done! I took the opportunity to document the new /auth/microsoft routes in the same file, since I'd missed that before.

@freemvmt freemvmt requested a review from DafyddLlyr October 10, 2024 18:44
@freemvmt freemvmt force-pushed the api-microsoft-frontend-logout branch from 9d2bb7d to cb8339b Compare October 10, 2024 18:50
Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! 👏

@freemvmt freemvmt merged commit 39ae01b into main Oct 10, 2024
12 checks passed
@freemvmt freemvmt deleted the api-microsoft-frontend-logout branch October 10, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants