/** * Checks if a valid user is logged in * * @throws \Exception * @return AccessControllerInterface::ACCESS */ protected function checkAuthentication() { try { $isAuthenticated = $this->objectManager->getAuthenticationProvider()->authenticate(); } catch (\Exception $exception) { Dispatcher::getSharedDispatcher()->logException($exception); throw $exception; } if ($isAuthenticated === FALSE) { return self::ACCESS_UNAUTHORIZED; } return self::ACCESS_ALLOW; }
/** * @test */ public function getAuthenticationProviderTest() { $object = $this->fixture->getAuthenticationProvider(); $this->assertInstanceOf('Cundd\\Rest\\Authentication\\AuthenticationProviderInterface', $object); }