Skip to content

feat(api): /api/v1/auth via host callbacks#98

Merged
mpge merged 2 commits into
mainfrom
feat/api-auth
Jun 27, 2026
Merged

feat(api): /api/v1/auth via host callbacks#98
mpge merged 2 commits into
mainfrom
feat/api-auth

Conversation

@mpge

@mpge mpge commented Jun 27, 2026

Copy link
Copy Markdown
Member

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

  • ApiAuthOptions host-callbacks on EscalatedOptions.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 the Authorization header. Unconfigured → 501; null result → 401.
  • login/register/refresh/logout carry no token; the host leaves those paths unauthenticated when wiring ApiTokenAuthMiddleware.

Verification

  • dotnet build clean; dotnet format --verify-no-changes (the CI gate) clean on changed files.
  • New ApiAuthControllerTests — 6 tests (501 not-configured, delegation, 401 null, me forwards bearer token, logout always-200, validate requires token).

mpge added 2 commits June 27, 2026 05:55
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.
@mpge mpge merged commit b87a565 into main Jun 27, 2026
2 checks passed
@mpge mpge deleted the feat/api-auth branch June 27, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant