Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
2021-07-02 17:23:50 +02:00
parent 69065a03c0
commit 7dd2cdfdd5
10 changed files with 52 additions and 49 deletions

View File

@@ -1,6 +1,5 @@
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
import {AuthenticationException} from '@adonisjs/auth/build/standalone'
import Logger from "@ioc:Adonis/Core/Logger";
/**
* Auth middleware is meant to restrict un-authenticated access to a given route
@@ -34,9 +33,7 @@ export default class AuthMiddleware {
for (let guard of guards) {
guardLastAttempted = guard
Logger.info('Trying to connect with ' + guard)
if (await auth.use(guard).check()) {
Logger.info(auth.use(guard).isLoggedIn)
/**
* Instruct auth to use the given guard as the default guard for
* the rest of the request, since the user authenticated