Move auth and permission checks behind plugs and contexts#144
Open
nextinfinity wants to merge 2 commits intomainfrom
Open
Move auth and permission checks behind plugs and contexts#144nextinfinity wants to merge 2 commits intomainfrom
nextinfinity wants to merge 2 commits intomainfrom
Conversation
Co-authored-by: Codex <codex@openai.com>
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.
Summary
This PR continues the controller/context modernization work by thinning the web layer around auth and permission handling, moving more token-sensitive behavior into shared domain modules, and tightening the surrounding tests.
The API shape stays mostly the same. The goal here is to make the current behavior easier to reason about before larger playback or schema work.
Main Changes
GuardianchecksAccountsRoomsVideoControllerTestwith deterministic pollingWhy
This is meant to cover the remaining Phase 1 / Phase 2 modernization work around:
Notable Behavior / Boundary Changes
Accounts.create_authenticated_session/2Accounts.create_anonymous_session/0Accounts.request_password_reset/1Accounts.reset_password/3Rooms.update_permission/3Testing
Ran locally:
mix test test/streamshore/accounts_test.exsmix test test/streamshore/accounts_test.exs test/streamshore/rooms_test.exs test/streamshore_web/controllers/user_controller_test.exs test/streamshore_web/controllers/permission_controller_test.exs test/streamshore_web/controllers/video_controller_test.exs test/streamshore_web/controllers/favorites_controller_test.exs test/streamshore_web/controllers/friends_controller_test.exsFollow-up
UserController.update/2still multiplexes several auth-related actions behind one update route.That is intentionally left in place for now. We agreed to keep the current shape because it gives us a cleaner path to split those actions into distinct routes later without mixing that API change into this boundary-cleanup PR.
In other words: the sensitive token validation and persistence behavior has already moved down into
Accounts, but the route/action split is still outstanding and should come in a follow-up PR.