Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
2021-07-02 12:58:39 +02:00
parent d32ca8586e
commit 69065a03c0

View File

@@ -1,5 +1,6 @@
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
import { AuthenticationException } from '@adonisjs/auth/build/standalone'
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
@@ -32,9 +33,10 @@ export default class AuthMiddleware {
let guardLastAttempted: string | undefined
for (let guard of guards) {
guardLastAttempted = guard
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