Error 401 Unauthorized

GET https://e-batiment.fji.ch/api/auth/2fa_check

Exceptions

  1. Full authentication is required to access this resource.

    HTTP 401 Unauthorized

  2. Full authentication is required to access this resource.
  3. User is not in a two-factor authentication process.

Stack Trace

private function throwUnauthorizedException(AuthenticationException $authException): never
{
$this->logger?->notice(\sprintf('No Authentication entry point configured, returning a %s HTTP response. Configure "entry_point" on the firewall "%s" if you want to modify the response.', Response::HTTP_UNAUTHORIZED, $this->firewallName));
throw new HttpException(Response::HTTP_UNAUTHORIZED, $authException->getMessage(), $authException, [], $authException->getCode());
}
}
ExceptionListener->throwUnauthorizedException() in vendor/symfony/security-http/Firewall/ExceptionListener.php (line 215)
}
private function startAuthentication(Request $request, AuthenticationException $authException): Response
{
if (null === $this->authenticationEntryPoint) {
$this->throwUnauthorizedException($authException);
}
$this->logger?->debug('Calling Authentication entry point.', ['entry_point' => $this->authenticationEntryPoint]);
// an entry point that only stands in has no authentication to start, so there is
ExceptionListener->startAuthentication() in vendor/symfony/security-http/Firewall/ExceptionListener.php (line 174)
$insufficientAuthenticationException = new InsufficientAuthenticationException('Full authentication is required to access this resource.', 0, $exception);
if (null !== $token) {
$insufficientAuthenticationException->setToken($token);
}
$event->setResponse($this->startAuthentication($event->getRequest(), $insufficientAuthenticationException));
} catch (\Exception $e) {
$event->setThrowable($e);
}
return;
ExceptionListener->handleAccessDeniedException() in vendor/symfony/security-http/Firewall/ExceptionListener.php (line 106)
return;
}
if ($exception instanceof AccessDeniedException) {
$this->handleAccessDeniedException($event, $exception);
return;
}
if ($exception instanceof LazyResponseException) {
ExceptionListener->onKernelException() in vendor/symfony/security-http/Firewall.php (line 99)
}
public function onKernelException(ExceptionEvent $event): void
{
foreach ($this->exceptionListeners as $request) {
$this->exceptionListeners[$request]->onKernelException($event);
}
}
public function onKernelFinishRequest(FinishRequestEvent $event): void
{
Firewall->onKernelException() in vendor/symfony/event-dispatcher/Debug/WrappedListener.php (line 122)
$this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener);
$e = $this->stopwatch->start($this->name, 'event_listener');
try {
($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
} finally {
if ($e->isStarted()) {
$e->stop();
}
TraceableEventDispatcher->dispatch() in vendor/symfony/http-kernel/HttpKernel.php (line 260)
* Handles a throwable by trying to convert it to a Response.
*/
private function handleThrowable(\Throwable $e, Request $request, int $type, ?ControllerMetadata $controllerMetadata = null): Response
{
$event = new ExceptionEvent($this, $request, $type, $e, isKernelTerminating: $this->terminating, controllerMetadata: $controllerMetadata);
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
// a listener might have replaced the exception
$e = $event->getThrowable();
if (!$event->hasResponse()) {
HttpKernel->handleThrowable() in vendor/symfony/http-kernel/HttpKernel.php (line 95)
$this->finishRequest($request, $type, $controllerMetadata);
throw $e;
}
return $response = $this->handleThrowable($e, $request, $type, $controllerMetadata);
} finally {
$this->requestStack->pop();
if ($response instanceof StreamedResponse && $callback = $response->getCallback()) {
$requestStack = $this->requestStack;
HttpKernel->handle() in vendor/symfony/http-kernel/Kernel.php (line 156)
if (!$this->handlingHttpCache) {
$this->resetServices = true;
}
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
) {
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
$response->send(false);
if (\function_exists('fastcgi_finish_request') && !$this->debug) {
fastcgi_finish_request();
HttpKernelRunner->run() in vendor/autoload_runtime.php (line 32)
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);
require_once('/home/clients/7013e9c520340d452787db41b1ef6905/sites/e-batiment.fji.ch/vendor/autoload_runtime.php') in public/index.php (line 7)
declare(strict_types=1);
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return static function (array $context): Kernel {
$env = $context['APP_ENV'] ?? 'prod';
return new Kernel(is_string($env) ? $env : 'prod', (bool) ($context['APP_DEBUG'] ?? false));

Stack Trace

if (!$isFullFledged) {
$this->logger?->debug('Access denied, the user is not fully authenticated; redirecting to authentication entry point.', ['exception' => $exception]);
try {
$insufficientAuthenticationException = new InsufficientAuthenticationException('Full authentication is required to access this resource.', 0, $exception);
if (null !== $token) {
$insufficientAuthenticationException->setToken($token);
}
$event->setResponse($this->startAuthentication($event->getRequest(), $insufficientAuthenticationException));
ExceptionListener->handleAccessDeniedException() in vendor/symfony/security-http/Firewall/ExceptionListener.php (line 106)
return;
}
if ($exception instanceof AccessDeniedException) {
$this->handleAccessDeniedException($event, $exception);
return;
}
if ($exception instanceof LazyResponseException) {
ExceptionListener->onKernelException() in vendor/symfony/security-http/Firewall.php (line 99)
}
public function onKernelException(ExceptionEvent $event): void
{
foreach ($this->exceptionListeners as $request) {
$this->exceptionListeners[$request]->onKernelException($event);
}
}
public function onKernelFinishRequest(FinishRequestEvent $event): void
{
Firewall->onKernelException() in vendor/symfony/event-dispatcher/Debug/WrappedListener.php (line 122)
$this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener);
$e = $this->stopwatch->start($this->name, 'event_listener');
try {
($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
} finally {
if ($e->isStarted()) {
$e->stop();
}
TraceableEventDispatcher->dispatch() in vendor/symfony/http-kernel/HttpKernel.php (line 260)
* Handles a throwable by trying to convert it to a Response.
*/
private function handleThrowable(\Throwable $e, Request $request, int $type, ?ControllerMetadata $controllerMetadata = null): Response
{
$event = new ExceptionEvent($this, $request, $type, $e, isKernelTerminating: $this->terminating, controllerMetadata: $controllerMetadata);
$this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
// a listener might have replaced the exception
$e = $event->getThrowable();
if (!$event->hasResponse()) {
HttpKernel->handleThrowable() in vendor/symfony/http-kernel/HttpKernel.php (line 95)
$this->finishRequest($request, $type, $controllerMetadata);
throw $e;
}
return $response = $this->handleThrowable($e, $request, $type, $controllerMetadata);
} finally {
$this->requestStack->pop();
if ($response instanceof StreamedResponse && $callback = $response->getCallback()) {
$requestStack = $this->requestStack;
HttpKernel->handle() in vendor/symfony/http-kernel/Kernel.php (line 156)
if (!$this->handlingHttpCache) {
$this->resetServices = true;
}
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
) {
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
$response->send(false);
if (\function_exists('fastcgi_finish_request') && !$this->debug) {
fastcgi_finish_request();
HttpKernelRunner->run() in vendor/autoload_runtime.php (line 32)
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);
require_once('/home/clients/7013e9c520340d452787db41b1ef6905/sites/e-batiment.fji.ch/vendor/autoload_runtime.php') in public/index.php (line 7)
declare(strict_types=1);
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return static function (array $context): Kernel {
$env = $context['APP_ENV'] ?? 'prod';
return new Kernel(is_string($env) ? $env : 'prod', (bool) ($context['APP_DEBUG'] ?? false));

Stack Trace

// within the "authenticate" stage.
$currentToken = $this->tokenStorage->getToken();
if (!$currentToken instanceof TwoFactorTokenInterface) {
// This should only happen when the check path is called outside of a 2fa process
// access_control can't handle this, as it's called after the authenticator
throw new AccessDeniedException('User is not in a two-factor authentication process.');
}
$this->dispatchTwoFactorAuthenticationEvent(TwoFactorAuthenticationEvents::ATTEMPT, $request, $currentToken);
$credentials = new TwoFactorCodeCredentials($currentToken, $this->twoFactorFirewallConfig->getAuthCodeFromRequest($request));
TwoFactorAuthenticator->authenticate() in vendor/symfony/security-http/Authenticator/Debug/TraceableAuthenticator.php (line 82)
public function authenticate(Request $request): Passport
{
$startTime = microtime(true);
try {
$this->passport = $this->authenticator->authenticate($request);
} finally {
$this->duration = microtime(true) - $startTime;
}
return $this->passport;
TraceableAuthenticator->authenticate() in vendor/symfony/security-http/Authentication/AuthenticatorManager.php (line 173)
$passport = null;
$previousToken = $this->tokenStorage->getToken();
try {
// get the passport from the Authenticator
$passport = $authenticator->authenticate($request);
// check the passport (e.g. password checking)
$event = new CheckPassportEvent($authenticator, $passport);
$this->eventDispatcher->dispatch($event);
AuthenticatorManager->executeAuthenticator() in vendor/symfony/security-http/Authentication/AuthenticatorManager.php (line 155)
$this->logger?->debug('Skipping the "{authenticator}" authenticator as it did not support the request.', ['authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
continue;
}
$response = $this->executeAuthenticator($authenticator, $request);
if (null !== $response) {
$this->logger?->debug('The "{authenticator}" authenticator set the response. Any later authenticator will not be called', ['authenticator' => ($authenticator instanceof TraceableAuthenticator ? $authenticator->getAuthenticator() : $authenticator)::class]);
return $response;
}
AuthenticatorManager->executeAuthenticators() in vendor/symfony/security-http/Authentication/AuthenticatorManager.php (line 137)
if (!$authenticators) {
return null;
}
return $this->executeAuthenticators($authenticators, $request);
}
/**
* @param AuthenticatorInterface[] $authenticators
*/
AuthenticatorManager->authenticateRequest() in vendor/symfony/security-http/Firewall/AuthenticatorManagerListener.php (line 38)
}
public function authenticate(RequestEvent $event): void
{
$request = $event->getRequest();
$response = $this->authenticatorManager->authenticateRequest($request);
if (null === $response) {
return;
}
$event->setResponse($response);
return $supports;
}
public function authenticate(RequestEvent $event): void
{
$this->authenticationManagerListener->authenticate($event);
}
public function getAuthenticatorManagerListener(): AuthenticatorManagerListener
{
return $this->authenticationManagerListener;
TraceableAuthenticatorManagerListener->authenticate() in vendor/symfony/security-bundle/Debug/WrappedLazyListener.php (line 52)
public function authenticate(RequestEvent $event): void
{
$startTime = microtime(true);
try {
$this->listener->authenticate($event);
} catch (LazyResponseException $e) {
$this->response = $e->getResponse();
throw $e;
} finally {
WrappedLazyListener->authenticate() in vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php (line 93)
foreach ($requestListeners as $listener) {
if (false === $listener->supports($event->getRequest())) {
continue;
}
$listener->authenticate($event);
if ($event->hasResponse()) {
break;
}
}
TraceableFirewallListener->callListeners() in vendor/symfony/security-http/Firewall.php (line 93)
if (null !== $logoutListener) {
yield $logoutListener;
}
};
$this->callListeners($event, $authenticationListeners());
}
public function onKernelException(ExceptionEvent $event): void
{
foreach ($this->exceptionListeners as $request) {
Firewall->onKernelRequest() in vendor/symfony/event-dispatcher/Debug/WrappedListener.php (line 122)
$this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener);
$e = $this->stopwatch->start($this->name, 'event_listener');
try {
($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
} finally {
if ($e->isStarted()) {
$e->stop();
}
TraceableEventDispatcher->dispatch() in vendor/symfony/http-kernel/HttpKernel.php (line 174)
*/
private function handleRaw(Request $request, int $type = self::MAIN_REQUEST, ?ControllerMetadata &$controllerMetadata = null): Response
{
// request
$event = new RequestEvent($this, $request, $type);
$this->dispatcher->dispatch($event, KernelEvents::REQUEST);
if ($event->hasResponse()) {
return $this->filterResponse($event->getResponse(), $request, $type);
}
HttpKernel->handleRaw() in vendor/symfony/http-kernel/HttpKernel.php (line 80)
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
$response = null;
try {
return $response = $this->handleRaw($request, $type, $controllerMetadata);
} catch (\Throwable $e) {
if ($e instanceof \Error && !$this->handleAllThrowables) {
throw $e;
}
HttpKernel->handle() in vendor/symfony/http-kernel/Kernel.php (line 156)
if (!$this->handlingHttpCache) {
$this->resetServices = true;
}
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
) {
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
$response->send(false);
if (\function_exists('fastcgi_finish_request') && !$this->debug) {
fastcgi_finish_request();
HttpKernelRunner->run() in vendor/autoload_runtime.php (line 32)
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);
require_once('/home/clients/7013e9c520340d452787db41b1ef6905/sites/e-batiment.fji.ch/vendor/autoload_runtime.php') in public/index.php (line 7)
declare(strict_types=1);
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return static function (array $context): Kernel {
$env = $context['APP_ENV'] ?? 'prod';
return new Kernel(is_string($env) ? $env : 'prod', (bool) ($context['APP_DEBUG'] ?? false));