Skip to content

[localserver] add placeholders for JWT routes#298

Merged
capcom6 merged 2 commits intomasterfrom
localserver/jwt-placeholders
Dec 7, 2025
Merged

[localserver] add placeholders for JWT routes#298
capcom6 merged 2 commits intomasterfrom
localserver/jwt-placeholders

Conversation

@capcom6
Copy link
Copy Markdown
Owner

@capcom6 capcom6 commented Dec 3, 2025

Summary by CodeRabbit

  • New Features
    • Added token-based authentication routes registered under the existing authenticated endpoint (/auth), providing endpoints for creating and revoking tokens (currently returning Not Implemented responses) to prepare for future token management workflows.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 4, 2025

Walkthrough

Registers a new authenticated /auth route by adding an AuthRoutes class with placeholder token endpoints (/token POST and /token/{jti} DELETE) that currently respond with 501 Not Implemented; WebService mounts AuthRoutes inside the authenticated routing scope.

Changes

Cohort / File(s) Summary
Route Integration
app/src/main/java/me/capcom/smsgateway/modules/localserver/WebService.kt
Added import for AuthRoutes and registered it within the authenticated routing scope so its routes are mounted under /auth.
Token Route Handler
app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt
New AuthRoutes class with fun register(routing: Route) that mounts token routes. Private Route.tokenRoutes() defines POST /token and DELETE /token/{jti} handlers returning HttpStatusCode.NotImplemented.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Check that AuthRoutes.register is mounted under the intended authenticated scope and path (/auth).
  • Verify Ktor Route extension (tokenRoutes) syntax and route hierarchy.
  • Confirm HTTP 501 placeholders are intentional and consistent with API design.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding placeholder implementations for JWT token authentication routes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch localserver/jwt-placeholders

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a 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)
app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt (1)

11-12: Remove the empty default constructor.

Per detekt's EmptyDefaultConstructor rule, the empty parentheses can be omitted for cleaner syntax.

-class AuthRoutes(
-) {
+class AuthRoutes {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7b3cfe and 97cc998.

📒 Files selected for processing (2)
  • app/src/main/java/me/capcom/smsgateway/modules/localserver/WebService.kt (2 hunks)
  • app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt (1)
app/src/main/java/me/capcom/smsgateway/modules/orchestrator/EventsRouter.kt (1)
  • route (20-46)
🪛 detekt (1.23.8)
app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt

[warning] 11-12: An empty default constructor can be removed.

(detekt.empty-blocks.EmptyDefaultConstructor)

⏰ 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). (2)
  • GitHub Check: Build release / build-apk
  • GitHub Check: Build insecure / build-apk
🔇 Additional comments (2)
app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt (1)

13-28: Placeholder implementation looks good.

The route structure is consistent with existing route classes in the codebase, and returning HttpStatusCode.NotImplemented (501) is appropriate for placeholder endpoints. The {jti} path parameter follows JWT conventions for token identifiers.

app/src/main/java/me/capcom/smsgateway/modules/localserver/WebService.kt (1)

40-40: Integration follows existing patterns.

The AuthRoutes import and registration are consistent with other route classes in this file. The routes are properly protected under the auth-basic authentication scope, and the registration pattern matches LogsRoutes and SettingsRoutes.

Also applies to: 180-182

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 4, 2025

🤖 Pull request artifacts

file commit
app-release.apk ef8cdb2
app-release.aab ef8cdb2
app-insecure.apk ef8cdb2
app-insecure.aab ef8cdb2

@capcom6 capcom6 added the ready label Dec 4, 2025
@capcom6 capcom6 force-pushed the localserver/jwt-placeholders branch from 596466b to ef8cdb2 Compare December 6, 2025 06:10
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a 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)
app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt (1)

21-28: Optional: make placeholders more self-describing for clients

The 501 status codes are appropriate for “not implemented yet”, but clients will currently get an empty body. Consider adding a minimal message (or TODO) to make it clearer during integration/debugging, e.g.:

post {
    call.respond(HttpStatusCode.NotImplemented, "JWT /auth/token endpoint not implemented yet")
}
delete("/{jti}") {
    call.respond(HttpStatusCode.NotImplemented, "JWT /auth/token/{jti} revocation not implemented yet")
}

Purely cosmetic, can wait until you start wiring real JWT logic.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97cc998 and ef8cdb2.

📒 Files selected for processing (2)
  • app/src/main/java/me/capcom/smsgateway/modules/localserver/WebService.kt (2 hunks)
  • app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/main/java/me/capcom/smsgateway/modules/localserver/WebService.kt
⏰ 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). (2)
  • GitHub Check: Build insecure / build-apk
  • GitHub Check: Build release / build-apk
🔇 Additional comments (1)
app/src/main/java/me/capcom/smsgateway/modules/localserver/routes/AuthRoutes.kt (1)

11-19: Auth route registration structure looks good

AuthRoutes.register cleanly scopes everything under a token sub-route on whatever authenticated Route you pass in, which matches the PR goal of adding JWT-related placeholders without affecting unrelated paths. No functional issues from this structure.

@capcom6 capcom6 merged commit d7ccf26 into master Dec 7, 2025
3 checks passed
@capcom6 capcom6 deleted the localserver/jwt-placeholders branch December 7, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant