Robyn
Robyn copied to clipboard
Feat: add auth subroutes capabilities
Description
This PR fixes #708
Summary
This PR does handle authentication for subroutes having different levels of precedence:
- Endpoint decorators have highest precedence.
include_routerhas the second highest precedence.SubRouteinstance has the lowest precedence.- If None of the above is specified, the default is
False.
This PR change auth logic:
- It does add an
auth_requiredparameter forRouteobjects. - The authentication middleware is evaluated first and added before starting the server.
- This ensures that precedence is made correctly.
Several integration tests were provided. MDX documentation was also updated. To be discussed on #1026
PR Checklist
Please ensure that:
- [X] The PR contains a descriptive title
- [X] The PR contains a descriptive summary of the changes
- [X] You build and test your changes before submitting a PR.
- [X] You have added relevant documentation
- [X] You have added relevant tests. We prefer integration tests wherever possible
Pre-Commit Instructions:
- [X] Ensure that you have run the pre-commit hooks on your PR.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| robyn | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 26, 2024 8:00am |
Hey @IA-PieroCV 👋
Is the PR still a WIP? Or is it up for review?
Hey @sansyrox ! I set this PR as draft because I don't really know if the proposal of precedence is correct. I'll change it to "ready for review" in order you to review it. It's functional, but as I said, it changes the way how the authentication register the auth middlewares. Let me know any observation!
⚠️ Only 5 files will be analyzed due to processing limits.
⚠️ Only 5 files will be analyzed due to processing limits.
✨ No issues found! Your code is sparkling clean! ✨