/** * @throws AuthenticationException * @throws \Drahak\Restful\Application\BadRequestException * @throws \Exception */ public function startup() { //kontrola přihlášeného uživatele $apiKey = @$this->getInput()->getData()['apiKey']; if (empty($apiKey)) { $authorizationHeader = $this->getHttpRequest()->getHeader('Authorization'); $apiKey = substr($authorizationHeader, 0, 7) == "ApiKey " ? substr($authorizationHeader, 7) : null; } if (empty($apiKey)) { throw new AuthenticationException("You have to use API KEY!", IAuthenticator::FAILURE); } else { $this->identity = $this->usersFacade->authenticateUserByApiKey($apiKey, $this->currentUser); } //spuštění výchozí startup() akce parent::startup(); }