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

add session based auth workflow #464

Merged
merged 14 commits into from
Dec 11, 2024
Merged

add session based auth workflow #464

merged 14 commits into from
Dec 11, 2024

Conversation

pmeier
Copy link
Member

@pmeier pmeier commented Aug 2, 2024

Closes #158, closes #178, and closes #179. This is a massive PR that completely overhauls our auth flow. The old auth flow had multiple problems detailed in #178 (comment).

With this PR we now have a session based auth workflow that is independent of the UI through the following endpoints:

  • GET /login: user defined login page
  • POST /login: login endpoint for form-based auth, e.g. username and password
  • GET /oauth-callback: login endpoint for OAuth based auth
  • GET /logout: logout endpoint to clear the active session

The login endpoints can be configured through the ragna.config.Auth object.

After a successful login we set a session cookie and create an entry for the corresponding user in a key-value-store. With this PR we have support for in-memory and Redis key-value-stores.

Although we don't have a way to display it yet, the auth flow already supports authenticating with an API token, which is generated for each user.

Todo in follow-up PRs:

  • documentation
  • tests
  • automatic handling for refresh tokens when using OAuth
  • generic OAuth object

I'm aware that reviewing this is quite the ask. Happy to schedule some time to walk you through any part of the change.

@pmeier pmeier marked this pull request as ready for review December 11, 2024 14:54
@pmeier
Copy link
Member Author

pmeier commented Dec 11, 2024

Self merging for velocity

@pmeier pmeier merged commit ac13a3c into deploy-dev Dec 11, 2024
7 of 11 checks passed
@pmeier pmeier deleted the auth branch December 11, 2024 14:54
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.

1 participant