This commit is contained in:
Andras Bacsai
2025-09-22 20:16:32 +02:00
parent 992e9a7aef
commit 942c03b36d
39 changed files with 10260 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import type { HttpContext } from '@adonisjs/core/http'
import type { NextFn } from '@adonisjs/core/types/http'
/**
* Silent auth middleware can be used as a global middleware to silent check
* if the user is logged-in or not.
*
* The request continues as usual, even when the user is not logged-in.
*/
export default class SilentAuthMiddleware {
async handle(
ctx: HttpContext,
next: NextFn,
) {
await ctx.auth.check()
return next()
}
}