コード例 #1
0
ファイル: TAuthManagerTest.php プロジェクト: bklein01/prado
 public function testDoAuthentication()
 {
     throw new PHPUnit_Framework_IncompleteTestError();
     // Not yet finished, Session won't start because of headers :( :(
     $authManager = new TAuthManager();
     $authManager->setUserManager('users');
     $authManager->init(null);
     $authManager->setLoginPage('LoginPage');
     self::$app->raiseEvent('onAuthentication', self::$app, null);
 }
コード例 #2
0
ファイル: AuthManager.php プロジェクト: larryu/magento-b2b
 /**
  * (non-PHPdoc)
  * @see TAuthManager::onAuthorize()
  */
 public function onAuthorize($param)
 {
     $application = $this->getApplication();
     //if this is a call back function and its session timed out/invalid, then redirect the page to homepage
     if ($this->getRequest()->contains(TPage::FIELD_CALLBACK_TARGET) && !$application->getAuthorizationRules()->isUserAllowed($application->getUser(), $application->getRequest()->getRequestType(), $application->getRequest()->getUserHostAddress())) {
         // Create a callback adapter which counstructor will set up TCallbackReponseAdapter in the HttpResponse class adapter property
         $callbackAdapter = new TActivePageAdapter(new TPage());
         // Redirect (now the adapter is not null)
         $this->Response->redirect('/');
         // Create a html writer
         $writer = $this->Response->createHtmlWriter();
         // Render the response
         $callbackAdapter->renderCallbackResponse($writer);
         //Flush the output
         $application->flushOutput();
         //exit application do not process the futher part
         exit;
     }
     parent::onAuthorize($param);
     $u = Core::getUser();
     if ($u instanceof UserAccount) {
         $r = Core::getRole();
         Core::setUser($u, $r);
     }
 }
コード例 #3
0
 public function init($config)
 {
     if (!$this->_DBHandler) {
         throw new TConfigurationException('You must set DBHandler property!');
     }
     if (!$this->_PermissionsTable) {
         throw new TConfigurationException('You must set PermissionsTable property!');
     }
     parent::init($config);
 }
コード例 #4
0
ファイル: TrackerAuthManager.php プロジェクト: Nurudeen/prado
 /**
  * Logs out the user and delete the token from cookie.
  */
 public function logout()
 {
     parent::logout();
     $cookie = new THttpCookie(self::SignonCookieName, '');
     $this->Response->Cookies[] = $cookie;
 }