-
Notifications
You must be signed in to change notification settings - Fork 71
Session-based authentification #610
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
Open
MNassimM
wants to merge
18
commits into
ocaml-sf:master
Choose a base branch
from
pfitaxel:temporary-token
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just FYI @MNassimM, I added three small commits following our recent discussions on the migration to decompress 1.5.3:
Feel free to add other commits in the branch, and I propose that we'll interactively rebase your branch during our meeting tomorrow (in case you have Magit questions!) |
All endpoints previously requiring a token now expect a session. BREAKING CHANGE: Endpoints and clients using token-based authentication must be updated to use session-based authentication.
All API calls and local_storage interactions in the app/ folder now use session for authentication instead of token.
Add a new API route that returns the token associated with a given session, enabling clients to retrieve their token server-side without storing it in the frontend.
…or CLI) Update supported_versions so: - legacy token routes are valid Upto v2.0 - new session routes are valid Since v2.0 Clients ≥ 2.0 negotiate the new API; CLI clients continue to work. Front-end now uses only the “_s” routes.
This change needed to refactor the decompress-based deflate encoding
Replace the JSON-based storage of session-token-date entries with an Irmin Git-backed key-value store. Sessions are no longer stored in 'sessions.json' but in an Irmin Git repository ('session_store.git' by default). Credits: this patch reuses code from oauth-moodle-dev by the following authors. Co-authored-by: Louis Tariot <[email protected]>
as `ocaml/opam:alpine-3.20-*` images are now 6-month old: cf. https://hub.docker.com/r/ocaml/opam/tags?name=alpine-3.20 which caused some CI build issue due to a too-old version of opam: cf. https://github.com/ocaml-sf/learn-ocaml/actions/runs/15413403948/job/43370458368#step:3:122
Otherwise, we get: ``` The following dependencies couldn't be met: - learn-ocaml -> mirage-runtime = 4.8.2 unmet availability conditions: opam-version >= "2.1.0" ``` Related: https://github.com/ocaml-sf/learn-ocaml/actions/runs/15421443343/job/43397321956?pr=610#step:3:163 Related: ocurrent/docker-base-images#132 Related: https://github.com/ocurrent/docker-base-images/blob/02a40d239bbb8dd2700d9bfaa7511926a84eca7b/Dockerfile#L3
Motivation: - Learnocaml_store contained Json_codec - learnocaml_client.ml relies on Json_codec - Learnocaml_store depends on Learnocaml_api - Learnocaml_store pulls irmin-git.unix and cryptokit - unlike Learnocaml_api - and these two dependencies are unneeded for compiling learnocaml_client.ml
Otherwise we'd get: ``` Error loading shared library libgmp.so.10: No such file or directory (needed by /usr/bin/learn-ocaml) ``` cf. https://github.com/ocaml-sf/learn-ocaml/actions/runs/15428646832/job/43421680304?pr=610
14 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces Learn-OCaml v2.0 session-based authentication while preserving backward compatibility for existing CLI users:
*_s
” session endpoints on both the server and the client;token → session
relationships are stored in asession.json
file within the sync directoryUpto v"2.0"
so old (≤ 1.x) CLI clients continue to use them;sync-session
in the local storage;migrate_from_legacy_token
helper in the front-end that detects an oldsync-token
, logs in via the new/login
route, stores the returned session, fetches the save file, then deletes the legacysync-token
– all with a small “connection preserved” alert.Checklist
Note to maintainers
Close #…
if a related issue exists.