AuthComponent::startup PHP Метод

startup() публичный Метод

Auth startup All authentication and authorization checking are done in this method
public startup ( )
    public function startup()
    {
        // authenticate
        if (!empty($this->config["authenticate"])) {
            if (!$this->authenticate()) {
                return $this->unauthenticated();
            }
        }
        // authorize
        if (!empty($this->config["authorize"])) {
            if (!$this->authorize()) {
                return $this->unauthorized();
            }
        }
    }

Usage Example

Пример #1
0
 /** 
  * Main execution method.  Initializes CAS client and force authentication if required before passing user to parent startup method.
  * 
  * @param object $controller A reference to the instantiating controller object 
  * @return boolean 
  * @access public 
  */
 function startup(&$controller)
 {
     // CAS authentication required if user is not logged in
     //debug($controller);exit;
     //if (!$this->user()) {
     if (!isset($this->request->query['ticket'])) {
         // Set debug mode
         phpCAS::setDebug(false);
         //if(!empty(phpCAS::getUser()))
         //    debug($this);
         //Initialize phpCAS
         //debug(isset($this->request->query['ticket']));
         phpCAS::client(CAS_VERSION_2_0, Configure::read('CAS.hostname'), Configure::read('CAS.port'), Configure::read('CAS.uri'));
         // No SSL validation for the CAS server
         phpCAS::setNoCasServerValidation();
         // Force CAS authentication if required
         phpCAS::forceAuthentication();
         //debug();exit;
         $model =& $this->getModel();
         $controller->data[$model->alias][$this->fields['username']] = phpCAS::getUser();
         $controller->data[$model->alias][$this->fields['password']] = 'a';
         //$this->User->['username']=phpCAS::getUser();
         //$this->User->['password']='******';
     }
     return parent::startup($controller);
     //$this->redirect(array('controller'=>'User','action'=>'login'));
 }
All Usage Examples Of AuthComponent::startup