Skip to content

feat: use @adonisjs/auth with custom MikroORM user provider#1

Merged
B4nan merged 1 commit intomainfrom
feat/adonis-auth
Mar 15, 2026
Merged

feat: use @adonisjs/auth with custom MikroORM user provider#1
B4nan merged 1 commit intomainfrom
feat/adonis-auth

Conversation

@B4nan
Copy link
Copy Markdown
Member

@B4nan B4nan commented Mar 15, 2026

Summary

  • Replace custom JWT auth with AdonisJS's built-in @adonisjs/auth package using SessionUserProviderContract backed by MikroORM
  • Add MikroOrmUserProvider that bridges MikroORM's EntityManager with the AdonisJS session guard
  • Use route groups with named auth middleware instead of controller-level auth checks
  • Use ctx.auth.use('web').login(user) and ctx.auth.getUserOrFail() in controllers
  • Tests use loginAs(user) helper instead of manual JWT bearer tokens
  • Remove custom JWT service, auth utility, and HttpContext type augmentation

Test plan

  • All 11 existing tests pass (sign in, sign up, profile, CRUD articles, comments)
  • Manual smoke test of sign-in/sign-up flow
  • Verify session cookie is set on sign-in response

🤖 Generated with Claude Code

@B4nan B4nan force-pushed the feat/adonis-auth branch from 1bb1e46 to 1299cdc Compare March 15, 2026 17:58
Replace custom JWT authentication with AdonisJS's built-in auth system
using a SessionUserProviderContract backed by MikroORM. This provides
proper framework integration with session guards, route-level auth
middleware, and loginAs test helpers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@B4nan B4nan force-pushed the feat/adonis-auth branch from 1299cdc to cef472c Compare March 15, 2026 18:52
@B4nan B4nan merged commit 8d74a6e into main Mar 15, 2026
1 check passed
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