UnauthorizedHttpException example

throw CustomerException::customerAuthThrottledException($exception->getWaitTime()$exception);
            }
        }

        try {
            $customer = $this->accountService->getCustomerByLogin(
                $email,
                $data->get('password'),
                $context
            );
        } catch (CustomerNotFoundException|BadCredentialsException $exception) {
            throw new UnauthorizedHttpException('json', $exception->getMessage());
        } catch (CustomerOptinNotCompletedException $exception) {
            if (!Feature::isActive('v6.6.0.0')) {
                throw CustomerException::inactiveCustomer($exception->getParameters()['customerId']);
            }

            throw $exception;
        }

        if (isset($cacheKey)) {
            $this->rateLimiter->reset(RateLimiter::LOGIN_ROUTE, $cacheKey);
        }

        

        if (empty($email)) {
            throw CustomerException::badCredentials();
        }

        $event = new CustomerBeforeLoginEvent($context$email);
        $this->eventDispatcher->dispatch($event);

        try {
            $customer = $this->getCustomerByEmail($email$context$includeGuest);
        } catch (CustomerNotFoundException $exception) {
            throw new UnauthorizedHttpException('json', $exception->getMessage());
        }

        return $this->loginByCustomer($customer$context);
    }

    /** * @throws BadCredentialsException * @throws UnauthorizedHttpException */
    public function loginById(string $id, SalesChannelContext $context): string
    {
        
/** * @param string[] $allow */
    public static function methodNotAllowed(array $allow, string $message): SymfonyHttpException
    {
        return new MethodNotAllowedHttpException($allow$message);
    }

    public static function unauthorized(string $challenge, string $message): SymfonyHttpException
    {
        return new UnauthorizedHttpException($challenge$message);
    }

    public static function noEntityCloned(string $entity, string $id): ShopwareHttpException
    {
        return new NoEntityClonedException($entity$id);
    }

    /** * @param string[] $fails */
    public static function expectationFailed(array $fails): ShopwareHttpException
    {
Home | Imprint | This part of the site doesn't use cookies.