Enable osm-web API endpoints with auth token - #57
Conversation
📝 WalkthroughWalkthroughAdds configurable mirroring of validated TDEI tokens into OSM OAuth tables, revocation of superseded tokens during JWT rotation, and unit tests for bridge, expiry, disabled, and failure-handling behavior. ChangesOSM OAuth token bridge
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant validate_token
participant OSMDatabase
Client->>validate_token: Present bearer JWT
validate_token->>OSMDatabase: Upsert TDEI user and OAuth token
OSMDatabase-->>validate_token: Commit mirrored token
validate_token-->>Client: Validated authentication
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
api/core/security.py (1)
341-426: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the shared users-provisioning SQL. The
usersinsert is duplicated in_provision_users_from_tdei; a shared helper would keep the two paths from diverging.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@api/core/security.py` around lines 341 - 426, Extract the duplicated users-table provisioning INSERT from _bridge_token_to_osm and _provision_users_from_tdei into a shared helper, preserving the existing SQL, parameters, conflict behavior, and transaction semantics. Update both callers to use the helper and retain their current subsequent user lookup and error handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@api/core/security.py`:
- Around line 341-426: Extract the duplicated users-table provisioning INSERT
from _bridge_token_to_osm and _provision_users_from_tdei into a shared helper,
preserving the existing SQL, parameters, conflict behavior, and transaction
semantics. Update both callers to use the helper and retain their current
subsequent user lookup and error handling.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 10246820-51bc-4e30-87a5-2dfa2a7f399b
📒 Files selected for processing (3)
api/core/config.pyapi/core/security.pytests/unit/test_token_bridge.py
AZDO: #3967, #3966
Summary
oauth_access_tokens.