Ejemplo n.º 1
0
 /**
  * testing logout
  *
  */
 public function testLoggedInUser()
 {
     $storage = new Zend_OpenId_Provider_Storage_File(dirname(__FILE__) . "/_files/provider");
     $storage->delUser(self::USER);
     $this->_user->delLoggedInUser();
     $provider = new Zend_OpenId_Provider(null, null, $this->_user, $storage);
     $this->assertFalse($provider->getLoggedInUser());
     $this->assertTrue($provider->register(self::USER, self::PASSWORD));
     $this->assertFalse($provider->getLoggedInUser());
     $this->assertTrue($provider->login(self::USER, self::PASSWORD));
     $this->assertSame(self::USER, $this->_user->getLoggedInUser());
     $this->assertTrue($provider->logout());
     $this->assertFalse($provider->getLoggedInUser());
     $storage->delUser(self::USER);
     $this->_user->delLoggedInUser();
 }
Ejemplo n.º 2
0
             }
         } else {
             if ($_GET['openid_action'] == 'logout') {
                 $server->logout();
                 header('Location: ' . $_SERVER['PHP_SELF']);
                 exit;
             } else {
                 if ($_GET['openid_action'] == 'login') {
                     if (isset($_GET['openid_identity'])) {
                         $view->id = $_GET['openid_identity'];
                         $view->ro = true;
                     }
                     $ret = $view->render('login.phtml');
                 } else {
                     if ($_GET['openid_action'] == 'trust') {
                         if ($server->getLoggedInUser() !== false) {
                             $view->site = $server->getSiteRoot($_GET);
                             $view->url = $server->getLoggedInUser();
                             $sreg = new Zend_OpenId_Extension_Sreg();
                             $sreg->parseRequest($_GET);
                             $view->sreg = sreg_form($sreg);
                             if ($server->hasUser($view->url)) {
                                 $ret = $view->render('trust.phtml');
                             }
                         }
                     }
                 }
             }
         }
     }
 } else {
Ejemplo n.º 3
0
        OCP\User::checkLoggedIn();
        if (isset($_POST['allow'])) {
            if (isset($_POST['forever'])) {
                $server->allowSite($server->getSiteRoot($_GET));
            }
            $server->respondToConsumer($_GET);
        } else {
            if (isset($_POST['deny'])) {
                if (isset($_POST['forever'])) {
                    $server->denySite($server->getSiteRoot($_GET));
                }
                Zend_OpenId::redirect($_GET['openid_return_to'], array('openid.mode' => 'cancel'));
            } else {
                $tmpl = new OCP\Template('user_openid_provider', 'trust', 'user');
                $tmpl->assign('site', $server->getSiteRoot($_GET));
                $tmpl->assign('openid', $server->getLoggedInUser());
                $tmpl->printPage();
            }
        }
    } else {
        $ret = $server->handle();
        if (is_string($ret)) {
            echo $ret;
        } else {
            if ($ret !== true) {
                header('HTTP/1.0 403 Forbidden');
                echo 'Forbidden';
            }
        }
    }
}