-
Notifications
You must be signed in to change notification settings - Fork 75
embed auth changes for v2 launch #1177
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
Conversation
WalkthroughAdds a new POST endpoint /login_token/ that returns a login-shaped response using the JWT attached to the request; the auth middleware now stores the raw JWT on Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant Router as API Router
participant M as CustomJwtAuthMiddleware
participant H as post_login_token handler
participant U as orguserfunctions
C->>Router: POST /login_token/ (Authorization: Bearer JWT)
Router->>M: authenticate(request)
M->>M: validate JWT, set request.user, permissions
M->>M: set request.token = JWT
M-->>Router: authenticated request
Router->>H: call handler(request)
H->>H: verify request.user and username
alt invalid
H-->>C: 401 Invalid or missing token
else valid
H->>U: lookup_user(username)
U-->>H: user details
H->>H: set retval["token"] = request.token
H-->>C: 200 JSON (login-shaped payload)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1177 +/- ##
==========================================
- Coverage 52.66% 52.65% -0.02%
==========================================
Files 97 97
Lines 11406 11415 +9
==========================================
+ Hits 6007 6010 +3
- Misses 5399 5405 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ddpui/api/user_org_api.py (1)
164-173
: Clarifylookup_user
docs, error handling, and response consistency
- In ddpui/core/orguserfunctions.py update
lookup_user
’s docstring to “look up user by email” (or rename its- In
post_login_token
(user_org_api.py) change the error toHttpError(401, "User not found or invalid")
.- Consider returning
refresh_token
alongsidetoken
for consistency with/login/
.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
ddpui/api/user_org_api.py
(1 hunks)ddpui/auth.py
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
ddpui/api/user_org_api.py (2)
ddpui/tests/helper/test_auth.py (2)
user
(23-26)token
(29-31)ddpui/core/orguserfunctions.py (1)
lookup_user
(42-73)
ddpui/auth.py (1)
ddpui/tests/helper/test_auth.py (1)
token
(29-31)
🔇 Additional comments (1)
ddpui/auth.py (1)
170-170
: LGTM!Storing the validated token on the request object is appropriate for downstream use by the new
/login_token/
endpoint. The token has already been validated at this point, so there are no security concerns.
Summary by CodeRabbit
New Features
Chores / Configuration