Deny access to the current request

@return void
@throws Exception
960214
private function _denyAccess()
    {
        if (isset($env['auth.JSONerrors']) && $env['auth.JSONerrors'] == true) {
            throw new Exception(
                'Resource '.$this->app->request->getResourceUri().' using '.$this->app->request->getMethod().' method is forbidden',
                403
            );
        } else {
            throw new Exception(
                'You are not authorized to access '.$this->app->request->getResourceUri(),
                403
            );
        }
    }
538035
public function forAccessTokens()
    {
        $this->app->post('/token', $this->prefix('\Dusterio\LumenPassport\Http\Controllers\AccessTokenController@issueToken'));

        $this->app->group(['middleware' => ['auth']], function () {
            $this->app->get('/tokens', $this->prefix('AuthorizedAccessTokenController@forUser'));
            $this->app->delete('/tokens/{token_id}', $this->prefix('AuthorizedAccessTokenController@destroy'));
        });
    }
1368806
public function denyTermsOfUse($sbas_id)
    {
        try {
            $databox = $this->findDataboxById((int) $sbas_id);

            $this->getAclForUser()->revoke_access_from_bases(
                array_keys($this->getAclForUser()->get_granted_base([], [$databox->get_sbas_id()]))
            );
            $this->getAclForUser()->revoke_unused_sbas_rights();

            $this->getAuthenticator()->closeAccount();

            $ret = ['success' => true, 'message' => ''];
        } catch (\Exception $exception) {
            $ret = ['success' => false, 'message' => $exception->getMessage()];
        }

        return $this->app->json($ret);
    }
282890
public function REJECT(int $http_code=403, string $message="Access denied") : self
    {
        $this->rejectHttpCode = $http_code;
        $this->rejectMessage = $message;
        $this->action = self::ACTION_REJECT;
        return $this;
    }
442103
public static function accessDenied($hint = null, $redirectUri = null, Throwable $previous = null)
    {
        return new static(
            'The resource owner or authorization server denied the request.',
            9,
            'access_denied',
            401,
            $hint,
            $redirectUri,
            $previous
        );
    }
739275
public function deny($requester, $controlled, $perms = "*") {
		$permission = $this->_classes['permission'];
		return $permission::allow($requester, $controlled, $perms, -1);
	}
758124
private function _setRequest()
	{
		if ($this->_requestUri !== NULL) {
            $this->_request = preg_replace('#(^/)|(^' . ROOT . ')|(/$)#', '', $this->_requestUri);

            if (! $this->_request) {
            	$this->_request = self::DEFAULT_MODULE . '/' . self::DEFAULT_VIEW;
            }

            $this->_requestVars = explode('/', $this->_request);
            if (count($this->_requestVars) == 1) {
				$this->_request       .= '/' . self::DEFAULT_VIEW;
				$this->_requestVars[]  = self::DEFAULT_VIEW;
            }

            return $this;
        }

        throw new Exception('Request URI is not available');
	}
849329
public function unblockUser(): bool
    {
        $this->activate();
        if (!$this->save()) {
            throw new Exception(\Yii::t('app', 'Ошибка при разблокировке пользователя'));
        }
        return true;
    }
893748
public function actionRevoke()
    {
        if (isset($_GET['itemName'], $_GET['userId'])) {
            $itemName = $_GET['itemName'];
            $userId = $_GET['userId'];

            /* @var $am CAuthManager|AuthBehavior */
            $am = Yii::app()->getAuthManager();

            if ($am->isAssigned($itemName, $userId)) {
                $am->revoke($itemName, $userId);
                if ($am instanceof CPhpAuthManager) {
                    $am->save();
                }

                if ($am instanceof ICachedAuthManager) {
                    $am->flushAccess($itemName, $userId);
                }
            }

            if (!isset($_POST['ajax'])) {
                $this->redirect(array('view', 'id' => $userId));
            }
        } else {
            throw new CHttpException(400, Yii::t('AuthModule.main', 'Invalid request.'));
        }
    }
638853
public function noAccess(Exception $exception)
    {
        $frontController = FrontController::getInstance();

        if (Common::isXmlHttpRequest()) {
            echo $frontController->dispatch(Piwik::getLoginPluginName(), 'ajaxNoAccess', array($exception->getMessage()));
            return;
        }

        echo $frontController->dispatch(Piwik::getLoginPluginName(), 'login', array($exception->getMessage()));
    }
1045364
public function blockUser(): bool
    {
        $this->deactivate();
        if (!$this->save()) {
            print_r($this->getErrors());
            throw new Exception(\Yii::t('app', 'Ошибка при блокировании пользователя'));
        }
        return true;
    }
579981
protected function requestAccessToken()
    {
        $result = $this->httpGet(self::WECHAT_ACCESS_TOKEN_PREFIX, [
            'corpid' => $this->corpId,
            'corpsecret' => $this->secret
        ]);
        return isset($result['access_token']) ? $result : false;
    }
248784
public function deny()
    {
        $app = Application::getFacadeApplication();
        $this->fvIsApproved = false;
        $this->save();
        $fve = new FileVersionEvent($this);
        $app->make(EventDispatcherInterface::class)->dispatch('on_file_version_deny', $fve);
        $app->make('cache/request')->delete('file/version/approved/' . $this->getFileID());
    }
155129
public function logout()
    {
        if ($this->check()) {
            $this->matrix()->request('POST', $this->endpoint('logout'), [], [
                'access_token' => $this->data['access_token']
            ]);
            $this->setData(null);
            return true;
        }
        throw new \Exception('Not authenticated');
    }
841073
public function authorize(): bool
    {
        $currentUser = $this->user($this->route('guard'));

        if (! $currentUser->isA('superadmin') && $currentUser !== $this->route('admin')) {
            throw new GenericException(trans('cortex/auth::messages.action_unauthorized'), route('adminarea.admins.index'));
        }

        return true;
    }
578895
public function forAuthorization()
    {
        $this->router->group(['middleware' => ['web', 'auth']], function ($router) {
            $router->get('/authorize', [
                'uses' => 'AuthorizationController@authorize',
            ]);

            $router->post('/authorize', [
                'uses' => 'ApproveAuthorizationController@approve',
            ]);

            $router->delete('/authorize', [
                'uses' => 'DenyAuthorizationController@deny',
            ]);
        });
    }
399181
public function Permission() {
      if ($this->DeliveryMethod() == DELIVERY_METHOD_XHTML) {
         header("HTTP/1.0 401", TRUE, 401);
         $this->Render();
      } else
         $this->RenderException(PermissionException());
   }