feat(api): /api/v1/auth via host callbacks#77
Merged
Merged
Conversation
Add the general JSON API auth contract (login, register, logout, refresh, me, profile, validate) consumed by the Flutter app. Credential handling is delegated to a host-provided EscalatedApiAuthenticator bean — Escalated owns no passwords or sessions. No bean (or an unimplemented method) responds 501; a method returning null is an auth failure (401). login/register/refresh/logout are permitAll in the API security chain (no token yet); me/profile/validate use the bearer token.
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.
Adds the general JSON API auth contract (consumed by the Flutter app) to Spring, using the host-callback model — dependency-free, no password hashing in the package. Matches the Phoenix / Go / NestJS / Django / Rails / .NET reference.
What
EscalatedApiAuthenticator— an optional host@Bean(interface with default methods that throwUnsupportedOperationException, so the host implements only what it needs).ApiAuthController(/escalated/api/v1/auth):POST login/register/logout/refresh/validate,GET me,PATCH profile. Bearer token from theAuthorizationheader. No bean / unimplemented method →501;nullresult →401.EscalatedSecurityConfignowpermitAlls the public auth paths (login/register/refresh/logout);me/profile/validatestay authenticated.Verification
./gradlew checkstyleMain checkstyleTestclean on changed files (the CI lint gate);./gradlew testBUILD SUCCESSFUL.ApiAuthControllerTest— 7 tests (501 no-bean, delegation, 401 null, 501 unimplemented method, me forwards bearer token, logout always-200, validate requires token).