Add authentication to collaborative sessions#307
Open
Process-ing wants to merge 6 commits into
Open
Conversation
Process-ing
force-pushed
the
feature/session-validation
branch
from
April 22, 2026 15:38
ca398cb to
1caa7e4
Compare
mariana2103
requested changes
Apr 28, 2026
| path("auth/socket-token/", SocketToken.as_view()), | ||
| path('csrf/', Csrf.as_view()), | ||
| path('admin/courses/', AdminExchangeCoursesView.as_view()), | ||
| path('student/schedule', StudentScheduleView.as_view(), name="auth-student-schedule"), |
Collaborator
There was a problem hiding this comment.
maybe add in the is_authenticated decorator since after the security issues its better to guard everything
| participant_name = query_params.get('participant_name', ["Anonymous"])[0] | ||
| participant = Participant(sid, participant_name) | ||
| participant_name = query_params.get('participant_name', ['Anonymous'])[0] | ||
| participant = Participant(sid, participant_name, username) |
Collaborator
There was a problem hiding this comment.
username is passed as the 3rd arg, which maps to selected_slots in the constructor signature (sid, name, selected_slots, nmec=None). So nmec ends up None for every participant.
Suggested change
| participant = Participant(sid, participant_name, username) | |
| participant = Participant(sid, participant_name, [], username) |
mariana2103
requested changes
Apr 28, 2026
| ) | ||
|
|
||
| token = jwt.encode( | ||
| {"username": request.user.username, "exp": expiration.timestamp()}, |
Collaborator
There was a problem hiding this comment.
datetime.timestamp() returns a float and from what I looked up the JWT exp claim should be an integer and some libraries will reject a float.
| if sessions_server.get_session(session.session_id) is not None: | ||
|
|
||
| await emit_session_update(sid, session) | ||
| await emit_session_update(sid, session) |
Collaborator
There was a problem hiding this comment.
Just to check why did we remove if sessions_server.get_session(session.session_id) is not None ? Was it redundant ?
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
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.
Closes #278
What does this PR do?
This PR adds validation of the user session when entering a collaborative session. Users now need to be authenticated (using federated authentication) to enter/create collaborative sessions.
How to test
Note
This PR is related to frontend PR #723 and you must change your frontend branch to the one in that PR to correctly test what's in this PR