original_string: public function startup(Event $event)
      {
          /** @var \Cake\Controller\Controller $controller */
          $controller = $event->getSubject();
          $request = $controller->request;
          $this->session = $request->getSession();
          $this->_action = $request->getParam('action');
          $hasData = ($request->getData() || $request->is(['put', 'post', 'delete', 'patch']));
          try {
              $this->_secureRequired($controller);
              $this->_authRequired($controller);
  
              $isNotRequestAction = !$request->getParam('requested');
  
              if ($this->_action === $this->_config['blackHoleCallback']) {
                  throw new AuthSecurityException(sprintf('Action %s is defined as the blackhole callback.', $this->_action));
              }
  
              if (!in_array($this->_action, (array)$this->_config['unlockedActions']) &&
                  $hasData &&
                  $isNotRequestAction &&
                  $this->_config['validatePost']
              ) {
                  $this->_validatePost($controller);
              }
          } catch (SecurityException $se) {
              return $this->blackHole($controller, $se->getType(), $se);
          }
  
          $request = $this->generateToken($request);
          if ($hasData && is_array($controller->getRequest()->getData())) {
              $request = $request->withoutData('_Token');
          }
          $controller->setRequest($request);
      }
code: public function startup(Event $event)
      {
          /** @var \Cake\Controller\Controller $controller */
          $controller = $event->getSubject();
          $request = $controller->request;
          $this->session = $request->getSession();
          $this->_action = $request->getParam('action');
          $hasData = ($request->getData() || $request->is(['put', 'post', 'delete', 'patch']));
          try {
              $this->_secureRequired($controller);
              $this->_authRequired($controller);
  
              $isNotRequestAction = !$request->getParam('requested');
  
              if ($this->_action === $this->_config['blackHoleCallback']) {
                  throw new AuthSecurityException(sprintf('Action %s is defined as the blackhole callback.', $this->_action));
              }
  
              if (!in_array($this->_action, (array)$this->_config['unlockedActions']) &&
                  $hasData &&
                  $isNotRequestAction &&
                  $this->_config['validatePost']
              ) {
                  $this->_validatePost($controller);
              }
          } catch (SecurityException $se) {
              return $this->blackHole($controller, $se->getType(), $se);
          }
  
          $request = $this->generateToken($request);
          if ($hasData && is_array($controller->getRequest()->getData())) {
              $request = $request->withoutData('_Token');
          }
          $controller->setRequest($request);
      }
code_tokens: public function startup ( Event $ event ) { /** @var \Cake\Controller\Controller $controller */ $ controller = $ event -> getSubject ( ) ; $ request = $ controller -> request ; $ this -> session = $ request -> getSession ( ) ; $ this -> _action = $ request -> getParam ( 'action' ) ; $ hasData = ( $ request -> getData ( ) || $ request -> is ( [ 'put' , 'post' , 'delete' , 'patch' ] ) ) ; try { $ this -> _secureRequired ( $ controller ) ; $ this -> _authRequired ( $ controller ) ; $ isNotRequestAction = ! $ request -> getParam ( 'requested' ) ; if ( $ this -> _action === $ this -> _config [ 'blackHoleCallback' ] ) { throw new AuthSecurityException ( sprintf ( 'Action %s is defined as the blackhole callback.' , $ this -> _action ) ) ; } if ( ! in_array ( $ this -> _action , ( array ) $ this -> _config [ 'unlockedActions' ] ) && $ hasData && $ isNotRequestAction && $ this -> _config [ 'validatePost' ] ) { $ this -> _validatePost ( $ controller ) ; } } catch ( SecurityException $ se ) { return $ this -> blackHole ( $ controller , $ se -> getType ( ) , $ se ) ; } $ request = $ this -> generateToken ( $ request ) ; if ( $ hasData && is_array ( $ controller -> getRequest ( ) -> getData ( ) ) ) { $ request = $ request -> withoutData ( '_Token' ) ; } $ controller -> setRequest ( $ request ) ; }
docstring: Component startup. All security checking happens here.
  
  @param \Cake\Event\Event $event An Event instance
  @return mixed
docstring_tokens: Component startup . All security checking happens here .