feat(api): /api/v1/auth via host callbacks#98
Merged
Merged
Conversation
Add the general JSON API auth contract (login, register, logout, refresh, me, profile, validate) consumed by the Flutter app. All credential handling is delegated to host-app callbacks on EscalatedOptions.ApiAuth — Escalated owns no passwords or sessions. An unconfigured callback responds 501; a callback returning null is an auth failure (401). login/register/refresh/ logout carry no token, so the host leaves those paths unauthenticated when wiring ApiTokenAuthMiddleware.
The main project was bumped to EF Core 9.0.17 but the test project still pinned Sqlite 9.0.16, causing an NU1605 package-downgrade restore error (main was red). Bump the test reference to match.
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 .NET, using the host-callback model — dependency-free, no password hashing in the package. Matches the Phoenix / Go / NestJS / Django / Rails reference.
What
ApiAuthOptionshost-callbacks onEscalatedOptions.ApiAuth(Authenticate,Register,Validate,Refresh,UpdateProfile,Logout).Api/ApiAuthController(support/api/v1/auth):POST login/register/logout/refresh/validate,GET me,PATCH profile. Bearer token read from theAuthorizationheader. Unconfigured →501; null result →401.login/register/refresh/logoutcarry no token; the host leaves those paths unauthenticated when wiringApiTokenAuthMiddleware.Verification
dotnet buildclean;dotnet format --verify-no-changes(the CI gate) clean on changed files.ApiAuthControllerTests— 6 tests (501 not-configured, delegation, 401 null, me forwards bearer token, logout always-200, validate requires token).