当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_OpenId::redirect方法代码示例

本文整理汇总了PHP中Zend_OpenId::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_OpenId::redirect方法的具体用法?PHP Zend_OpenId::redirect怎么用?PHP Zend_OpenId::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_OpenId的用法示例。


在下文中一共展示了Zend_OpenId::redirect方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: HandleObjectCategories

 function HandleObjectCategories($objectCategoryIds)
 {
     global $prefs;
     $perspectivelib = TikiLib::lib('perspective');
     $current_object = current_object();
     if (!$current_object) {
         // only used on tiki objects
         return;
     }
     $descendants = $this->get_category_descendants($prefs['areas_root']);
     $objectPerspective = 0;
     if (!empty($objectCategoryIds)) {
         if (!isset($_SESSION['current_perspective'])) {
             unset($_SESSION['current_perspective']);
         }
         foreach ($objectCategoryIds as $categId) {
             // If category is inside $prefs['areas_root']
             if (in_array($categId, $descendants)) {
                 $area = $this->getAreaByCategId($categId);
                 if ($area) {
                     $objectPerspective = $area['perspectives'][0];
                     // use 1st persp
                     break;
                 }
             }
         }
         if ($objectPerspective && $objectPerspective != $_SESSION['current_perspective']) {
             $area = $this->getAreaByPerspId($_SESSION['current_perspective']);
             $objectArea = $this->getAreaByPerspId($objectPerspective);
             if ($area && !$area['share_common'] || $objectArea && $objectArea['exclusive']) {
                 $perspectivelib->set_perspective($objectPerspective, true);
                 Zend_OpenId::redirect(Zend_OpenId::selfUrl());
             }
         }
     }
     if ($objectPerspective < 1 && !empty($_SESSION['current_perspective'])) {
         // uncategorised objects
         $area = $this->getAreaByPerspId($_SESSION['current_perspective']);
         if ($area) {
             if (!$area['share_common']) {
                 $perspectivelib->set_perspective($objectPerspective, true);
                 Zend_OpenId::redirect(Zend_OpenId::selfUrl());
             }
         }
     }
 }
开发者ID:ameoba32,项目名称:tiki,代码行数:46,代码来源:binderlib.php

示例2: _checkId

 /**
  * Performs check of OpenID identity.
  *
  * This is the first step of OpenID authentication process.
  * On success the function does not return (it does HTTP redirection to
  * server and exits). On failure it returns false.
  *
  * @param bool $immediate enables or disables interaction with user
  * @param string $id OpenID identity
  * @param string $returnTo HTTP URL to redirect response from server to
  * @param string $root HTTP URL to identify consumer on server
  * @param mixed $extensions extension object or array of extensions objects
  * @param Zend_Controller_Response_Abstract $response an optional response
  *  object to perform HTTP or HTML form redirection
  * @return bool
  */
 protected function _checkId($immediate, $id, $returnTo = null, $root = null, $extensions = null, Zend_Controller_Response_Abstract $response = null)
 {
     $this->_setError('');
     if (!Zend_OpenId::normalize($id)) {
         $this->_setError("Normalisation failed");
         return false;
     }
     $claimedId = $id;
     if (!$this->_discovery($id, $server, $version)) {
         $this->_setError("Discovery failed: " . $this->getError());
         return false;
     }
     if (!$this->_associate($server, $version)) {
         $this->_setError("Association failed: " . $this->getError());
         return false;
     }
     if (!$this->_getAssociation($server, $handle, $macFunc, $secret, $expires)) {
         /* Use dumb mode */
         unset($handle);
         unset($macFunc);
         unset($secret);
         unset($expires);
     }
     $params = array();
     if ($version >= 2.0) {
         $params['openid.ns'] = Zend_OpenId::NS_2_0;
     }
     $params['openid.mode'] = $immediate ? 'checkid_immediate' : 'checkid_setup';
     $params['openid.identity'] = $id;
     $params['openid.claimed_id'] = $claimedId;
     if ($version <= 2.0) {
         if ($this->_session !== null) {
             $this->_session->identity = $id;
             $this->_session->claimed_id = $claimedId;
         } else {
             if (defined('SID')) {
                 $_SESSION["zend_openid"] = array("identity" => $id, "claimed_id" => $claimedId);
             } else {
                 require_once "Zend/Session/Namespace.php";
                 $this->_session = new Zend_Session_Namespace("zend_openid");
                 $this->_session->identity = $id;
                 $this->_session->claimed_id = $claimedId;
             }
         }
     }
     if (isset($handle)) {
         $params['openid.assoc_handle'] = $handle;
     }
     $params['openid.return_to'] = Zend_OpenId::absoluteUrl($returnTo);
     if (empty($root)) {
         $root = Zend_OpenId::selfUrl();
         if ($root[strlen($root) - 1] != '/') {
             $root = dirname($root);
         }
     }
     if ($version >= 2.0) {
         $params['openid.realm'] = $root;
     } else {
         $params['openid.trust_root'] = $root;
     }
     if (!Zend_OpenId_Extension::forAll($extensions, 'prepareRequest', $params)) {
         $this->_setError("Extension::prepareRequest failure");
         return false;
     }
     Zend_OpenId::redirect($server, $params, $response);
     return true;
 }
开发者ID:kassimentz,项目名称:Estudos-Zend-Framework,代码行数:83,代码来源:Consumer.php

示例3: respondToConsumer

 /**
  * Perepares information to send back to consumer's authentication request,
  * signs it using shared secret and send back through HTTP redirection
  *
  * @param array $params GET or POST request variables
  * @param mixed $extensions extension object or array of extensions objects
  * @param Zend_Controller_Response_Abstract $response an optional response
  *  object to perform HTTP or HTML form redirection
  * @return bool
  */
 public function respondToConsumer($params, $extensions = null, Zend_Controller_Response_Abstract $response = null)
 {
     $version = 1.1;
     if (isset($params['openid_ns']) && $params['openid_ns'] == Zend_OpenId::NS_2_0) {
         $version = 2.0;
     }
     $ret = array();
     if ($version >= 2.0) {
         $ret['openid.ns'] = Zend_OpenId::NS_2_0;
     }
     $ret = $this->_respond($version, $ret, $params, $extensions);
     if (!empty($params['openid_return_to'])) {
         Zend_OpenId::redirect($params['openid_return_to'], $ret, $response);
     }
     return true;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:26,代码来源:Provider.php

示例4: realpath

$dir = realpath(__DIR__ . "/../../..");
set_include_path("{$dir}/incubator/library" . PATH_SEPARATOR . "{$dir}/library" . PATH_SEPARATOR . get_include_path());
/**
 * @see Zend_Auth
 */
require_once "Zend/Auth.php";
/**
 * @see Zend_Auth_Adapter_OpenId
 */
require_once "Zend/Auth/Adapter/OpenId.php";
$status = "";
$auth = Zend_Auth::getInstance();
if (isset($_POST['openid_action']) && $_POST['openid_action'] == "login" && !empty($_POST['openid_identifier']) || isset($_GET['openid_mode']) || isset($_POST['openid_mode'])) {
    $result = $auth->authenticate(new Zend_Auth_Adapter_OpenId(@$_POST['openid_identifier']));
    if ($result->isValid()) {
        Zend_OpenId::redirect(Zend_OpenId::selfURL());
    } else {
        $auth->clearIdentity();
        foreach ($result->getMessages() as $message) {
            $status .= "{$message}<br>\n";
        }
    }
} else {
    if ($auth->hasIdentity()) {
        if (isset($_POST['openid_action']) && $_POST['openid_action'] == "logout") {
            $auth->clearIdentity();
        } else {
            $status = "You are logged-in as " . $auth->getIdentity() . "<br>\n";
        }
    }
}
开发者ID:alab1001101,项目名称:zf2,代码行数:31,代码来源:test_auth.php

示例5: openId

 /**
  * handle all kinds of openId requests
  * 
  * @return void
  */
 public function openId()
 {
     Tinebase_Core::startCoreSession();
     $server = new Tinebase_OpenId_Provider(null, null, new Tinebase_OpenId_Provider_User_Tine20(), new Tinebase_OpenId_Provider_Storage());
     $server->setOpEndpoint(dirname(Zend_OpenId::selfUrl()) . '/index.php?method=Tinebase.openId');
     // handle openId login form
     if (isset($_POST['openid_action']) && $_POST['openid_action'] === 'login') {
         $server->login($_POST['openid_identifier'], $_POST['password'], $_POST['username']);
         unset($_GET['openid_action']);
         $this->_setJsonKeyCookie();
         Zend_OpenId::redirect(dirname(Zend_OpenId::selfUrl()) . '/index.php', $_GET);
         // display openId login form
     } else {
         if (isset($_GET['openid_action']) && $_GET['openid_action'] === 'login') {
             $view = new Zend_View();
             $view->setScriptPath('Tinebase/views');
             $view->openIdIdentity = $_GET['openid_identity'];
             $view->loginName = $_GET['openid_identity'];
             header('Content-Type: text/html; charset=utf-8');
             echo $view->render('openidLogin.php');
             // handle openId trust form
         } else {
             if (isset($_POST['openid_action']) && $_POST['openid_action'] === 'trust') {
                 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'));
                     }
                 }
                 // display openId trust form
             } else {
                 if (isset($_GET['openid_action']) && $_GET['openid_action'] === 'trust') {
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Display openId trust screen");
                     }
                     $view = new Zend_View();
                     $view->setScriptPath('Tinebase/views');
                     $view->openIdConsumer = $server->getSiteRoot($_GET);
                     $view->openIdIdentity = $server->getLoggedInUser();
                     header('Content-Type: text/html; charset=utf-8');
                     echo $view->render('openidTrust.php');
                     // handle all other openId requests
                 } else {
                     $result = $server->handle();
                     if (is_string($result)) {
                         echo $result;
                     } elseif ($result !== true) {
                         header('HTTP/1.0 403 Forbidden');
                         return;
                     }
                 }
             }
         }
     }
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:67,代码来源:Http.php

示例6: testRedirect

    /**
     * testing testRedirect
     *
     */
    public function testRedirect()
    {
        $response = new Zend_OpenId_ResponseHelper(true);
        Zend_OpenId::redirect("http://www.test.com/", null, $response, 'GET');
        $this->assertSame( 302, $response->getHttpResponseCode() );
        $this->assertSame( array(), $response->getRawHeaders() );
        $headers = $response->getHeaders();
        $this->assertTrue( is_array($headers) );
        $this->assertSame( 1, count($headers) );
        $this->assertTrue( is_array($headers[0]) );
        $this->assertSame( 3, count($headers[0]) );
        $this->assertSame( 'Location', $headers[0]['name'] );
        $this->assertSame( 'http://www.test.com/', $headers[0]['value'] );
        $this->assertSame( true, $headers[0]['replace'] );
        $this->assertSame( '', $response->getBody() );

        $response = new Zend_OpenId_ResponseHelper(true);
        Zend_OpenId::redirect("http://www.test.com/test.php?a=b", null, $response, 'GET');
        $headers = $response->getHeaders();
        $this->assertSame( 'http://www.test.com/test.php?a=b', $headers[0]['value'] );

        $response = new Zend_OpenId_ResponseHelper(true);
        Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'b'), $response, 'GET');
        $headers = $response->getHeaders();
        $this->assertSame( 'http://www.test.com/test.php?a=b', $headers[0]['value'] );

        $response = new Zend_OpenId_ResponseHelper(true);
        Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'b', 'c'=>'d'), $response, 'GET');
        $headers = $response->getHeaders();
        $this->assertSame( 'http://www.test.com/test.php?a=b&c=d', $headers[0]['value'] );

        $response = new Zend_OpenId_ResponseHelper(true);
        Zend_OpenId::redirect("http://www.test.com/test.php?a=b", array('c'=>'d'), $response, 'GET');
        $headers = $response->getHeaders();
        $this->assertSame( 'http://www.test.com/test.php?a=b&c=d', $headers[0]['value'] );

        $response = new Zend_OpenId_ResponseHelper(true);
        Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'x y'), $response, 'GET');
        $headers = $response->getHeaders();
        $this->assertSame( 'http://www.test.com/test.php?a=x+y', $headers[0]['value'] );

        $response = new Zend_OpenId_ResponseHelper(false);
        Zend_OpenId::redirect("http://www.test.com/", null, $response, 'GET');
        $this->assertSame( 200, $response->getHttpResponseCode() );
        $this->assertSame( array(), $response->getRawHeaders() );
        $this->assertSame( array(), $response->getHeaders() );
        $this->assertSame(
            "<script language=\"JavaScript\" type=\"text/javascript\">window.location='http://www.test.com/';</script>",
            $response->getBody() );

        $response = new Zend_OpenId_ResponseHelper(false);
        Zend_OpenId::redirect("http://www.test.com/test.php?a=b", null, $response, 'GET');
        $this->assertSame(
            "<script language=\"JavaScript\" type=\"text/javascript\">window.location='http://www.test.com/test.php?a=b';</script>",
            $response->getBody() );

        $response = new Zend_OpenId_ResponseHelper(false);
        Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'b'), $response, 'GET');
        $this->assertSame(
            "<script language=\"JavaScript\" type=\"text/javascript\">window.location='http://www.test.com/test.php?a=b';</script>",
            $response->getBody() );

        $response = new Zend_OpenId_ResponseHelper(false);
        Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'b','c'=>'d'), $response, 'GET');
        $this->assertSame(
            "<script language=\"JavaScript\" type=\"text/javascript\">window.location='http://www.test.com/test.php?a=b&c=d';</script>",
            $response->getBody() );

        $response = new Zend_OpenId_ResponseHelper(false);
        Zend_OpenId::redirect("http://www.test.com/test.php?a=b", array('c'=>'d'), $response, 'GET');
        $this->assertSame(
            "<script language=\"JavaScript\" type=\"text/javascript\">window.location='http://www.test.com/test.php?a=b&c=d';</script>",
            $response->getBody() );

        $response = new Zend_OpenId_ResponseHelper(false);
        Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'x y'), $response, 'GET');
        $this->assertSame(
            "<script language=\"JavaScript\" type=\"text/javascript\">window.location='http://www.test.com/test.php?a=x+y';</script>",
            $response->getBody() );

        $response = new Zend_OpenId_ResponseHelper(true);
        Zend_OpenId::redirect("http://www.test.com/", null, $response, 'POST');
        $this->assertSame( 200, $response->getHttpResponseCode() );
        $this->assertSame( array(), $response->getRawHeaders() );
        $this->assertSame( array(), $response->getHeaders() );
        $this->assertSame(
            "<html><body onLoad=\"document.forms[0].submit();\">\n" .
            "<form method=\"POST\" action=\"http://www.test.com/\">\n" .
            "<input type=\"submit\" value=\"Continue OpenID transaction\">\n" .
            "</form></body></html>\n",
            $response->getBody() );

        $response = new Zend_OpenId_ResponseHelper(true);
        Zend_OpenId::redirect("http://www.test.com/test.php?a=b", array('a'=>'b'), $response, 'POST');
        $this->assertSame(
            "<html><body onLoad=\"document.forms[0].submit();\">\n" .
//.........这里部分代码省略.........
开发者ID:jorgenils,项目名称:zend-framework,代码行数:101,代码来源:OpenIdTest.php

示例7: Zend_OpenId_Extension_Sreg

 if ($_POST['openid_action'] == 'trust') {
     if (isset($_GET['openid_return_to'])) {
         $sreg = new Zend_OpenId_Extension_Sreg();
         $sreg->parseResponse($_POST);
         if (isset($_POST['allow'])) {
             if (isset($_POST['forever'])) {
                 $server->allowSite($server->getSiteRoot($_GET), $sreg);
             }
             unset($_GET['openid_action']);
             $server->respondToConsumer($_GET, $sreg);
         } 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 {
         if (isset($_POST['allow'])) {
             $server->allowSite($_POST['site']);
             header('Location: ' . $_SERVER['PHP_SELF']);
             exit;
         } else {
             if (isset($_POST['deny'])) {
                 $server->denySite($_POST['site']);
                 header('Location: ' . $_SERVER['PHP_SELF']);
                 exit;
             } else {
                 if (isset($_POST['del'])) {
                     $server->delSite($_POST['site']);
开发者ID:alab1001101,项目名称:zf2,代码行数:31,代码来源:test_server.php

示例8: _checkId

 /**
  * Performs check of OpenID identity.
  *
  * This is the first step of OpenID authentication process.
  * On success the function does not return (it does HTTP redirection to
  * server and exits). On failure it returns false.
  *
  * @param bool $immediate enables or disables interaction with user
  * @param string $id OpenID identity
  * @param string $returnTo HTTP URL to redirect response from server to
  * @param string $root HTTP URL to identify consumer on server
  * @param mixed $extensions extension object or array of extensions objects
  * @param Zend_Controller_Response_Abstract $response an optional response
  *  object to perform HTTP or HTML form redirection
  * @return bool
  */
 protected function _checkId($immediate, $id, $returnTo = null, $root = null, $extensions = null, Zend_Controller_Response_Abstract $response = null)
 {
     if (!Zend_OpenId::normalize($id)) {
         return false;
     }
     $claimedId = $id;
     if (!$this->_discovery($id, $server, $version)) {
         return false;
     }
     if (!$this->_associate($server, $version)) {
         return false;
     }
     if (!$this->_getAssociation($server, $handle, $macFunc, $secret, $expires)) {
         /* Use dumb mode */
         unset($handle);
         unset($macFunc);
         unset($secret);
         unset($expires);
     }
     $params = array();
     if ($version >= 2.0) {
         $params['openid.ns'] = Zend_OpenId::NS_2_0;
     }
     $params['openid.mode'] = $immediate ? 'checkid_immediate' : 'checkid_setup';
     $params['openid.identity'] = $id;
     $params['openid.claimed_id'] = $claimedId;
     if (isset($handle)) {
         $params['openid.assoc_handle'] = $handle;
     }
     $params['openid.return_to'] = Zend_OpenId::absoluteUrl($returnTo);
     if (empty($root)) {
         $root = dirname(Zend_OpenId::selfUrl());
     }
     if ($version >= 2.0) {
         $params['openid.realm'] = $root;
     } else {
         $params['openid.trust_root'] = $root;
     }
     if (!Zend_OpenId_Extension::forAll($extensions, 'prepareRequest', $params)) {
         return false;
     }
     Zend_OpenId::redirect($server, $params, $response);
     return true;
 }
开发者ID:dalinhuang,项目名称:popo,代码行数:60,代码来源:Consumer.php

示例9: wikiplugin_subscribegroup

function wikiplugin_subscribegroup($data, $params)
{
    global $tiki_p_subscribe_groups, $userlib, $user, $smarty;
    static $iSubscribeGroup = 0;
    ++$iSubscribeGroup;
    if (empty($user)) {
        return '';
    }
    if ($tiki_p_subscribe_groups != 'y') {
        return tra('Permission denied');
    }
    extract($params, EXTR_SKIP);
    if (empty($group)) {
        if (!empty($_REQUEST['group'])) {
            $group = $_REQUEST['group'];
        } else {
            return tra('Missing parameter');
        }
    }
    if ($group == 'Anonymous' || $group == 'Registered') {
        return tra('Incorrect param');
    }
    if (!($info = $userlib->get_group_info($group)) || $info['groupName'] != $group) {
        // must have the right case
        return tra('Incorrect param');
    }
    if ($info['userChoice'] != 'y') {
        return tra('Permission denied');
    }
    $groups = $userlib->get_user_groups_inclusion($user);
    $current_defgroup = $userlib->get_user_default_group($user);
    if (!empty($_REQUEST['subscribeGroup']) && !empty($_REQUEST['iSubscribeGroup']) && $_REQUEST['iSubscribeGroup'] == $iSubscribeGroup && $_REQUEST['group'] == $group) {
        if (isset($defgroup) || isset($defgroup_action) || isset($undefgroup) || isset($undefgroup_action)) {
            if ($current_defgroup == $group) {
                $new_group = !empty($undefgroup_group) ? $undefgroup_group : 'Registered';
                $userlib->set_default_group($user, $new_group);
            } else {
                if (!isset($groups[$group])) {
                    $userlib->assign_user_to_group($user, $group);
                }
                $userlib->set_default_group($user, $group);
            }
            if (!empty($params['defgroup_url']) && $params['defgroup_url'] === 'n') {
                Zend_OpenId::redirect(Zend_OpenId::selfUrl());
            } else {
                global $tikiroot;
                Zend_OpenId::redirect($tikiroot);
            }
            die;
        } else {
            if (isset($groups[$group])) {
                $userlib->remove_user_from_group($user, $group);
                unset($groups[$group]);
                if (!empty($postunsubscribe_url)) {
                    header("Location: {$postunsubscribe_url}");
                    die;
                }
            } else {
                $userlib->assign_user_to_group($user, $group);
                $groups[$group] = 'real';
                if (!empty($postsubscribe_url)) {
                    header("Location: {$postsubscribe_url}");
                    die;
                }
            }
        }
    }
    if (isset($undefgroup) || isset($undefgroup_action)) {
        if ($current_defgroup == $group) {
            $text = isset($undefgroup) ? $undefgroup : '';
            if (!isset($undefgroup_action)) {
                $undefgroup_action = tra('OK');
            }
            $smarty->assign('action', $undefgroup_action);
        } else {
            $text = isset($defgroup) ? $defgroup : '';
            if (!isset($defgroup_action)) {
                $defgroup_action = tra('OK');
            }
            $smarty->assign('action', $defgroup_action);
        }
    } else {
        if (isset($groups[$group])) {
            //user already in the group->
            if ($groups[$group] == 'included') {
                return tra('Incorrect param');
            }
            $text = isset($unsubscribe) ? $unsubscribe : tra('Unsubscribe') . '%s';
            if (!isset($unsubscribe_action)) {
                $unsubscribe_action = tra('OK');
            }
            $smarty->assign('action', $unsubscribe_action);
        } else {
            $text = isset($subscribe) ? $subscribe : tra('Subscribe') . '%s';
            if (!isset($subscribe_action)) {
                $subscribe_action = tra('OK');
            }
            $smarty->assign('action', $subscribe_action);
        }
    }
//.........这里部分代码省略.........
开发者ID:jkimdon,项目名称:cohomeals,代码行数:101,代码来源:wikiplugin_subscribegroup.php

示例10: btnLogin_Click

 public function btnLogin_Click($strFormId, $strControlId, $strParameter)
 {
     require_once "Zend/Auth.php";
     require_once "Zend/Auth/Adapter/OpenId.php";
     require_once "Zend/Auth/Storage/NonPersistent.php";
     $this->txtOpenIdUrl->Text = preg_replace('/\\/$/', '', $this->txtOpenIdUrl->Text);
     $status = "";
     $auth = Zend_Auth::getInstance();
     $result = $auth->authenticate(new Zend_Auth_Adapter_OpenId($this->txtOpenIdUrl->Text));
     if ($result->isValid()) {
         Zend_OpenId::redirect(Zend_OpenId::selfURL());
     } else {
         $auth->clearIdentity();
         foreach ($result->getMessages() as $message) {
             $status .= "{$message}<br>\n";
         }
         $this->lblMessage->ForeColor = 'red';
         $this->lblMessage->Text = 'OpenId: ' . $status;
         return false;
     }
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:21,代码来源:word_list.php

示例11: _checkId

 /**
  * Performs check of OpenID identity.
  *
  * This is the first step of OpenID authentication process.
  * On success the function does not return (it does HTTP redirection to
  * server and exits). On failure it returns false.
  *
  * @param bool $immediate enables or disables interaction with user
  * @param string $id OpenID identity
  * @param string $returnTo HTTP URL to redirect response from server to
  * @param string $root HTTP URL to identify consumer on server
  * @param mixed $extensions extension object or array of extensions objects
  * @param Zend_Controller_Response_Abstract $response an optional response
  *  object to perform HTTP or HTML form redirection
  * @return bool
  */
 protected function _checkId($immediate, $id, $returnTo = null, $root = null, $extensions = null, Zend_Controller_Response_Abstract $response = null)
 {
     $this->_setError('');
     if (!Zend_OpenId::normalize($id)) {
         $this->_setError("Normalisation failed");
         return false;
     }
     $claimedId = $id;
     if (!$this->_discovery($id, $server, $version)) {
         $this->_setError("Discovery failed: " . $this->getError());
         return false;
     }
     if (!$this->_associate($server, $version)) {
         $this->_setError("Association failed: " . $this->getError());
         return false;
     }
     if (!$this->_getAssociation($server, $handle, $macFunc, $secret, $expires)) {
         /* Use dumb mode */
         unset($handle);
         unset($macFunc);
         unset($secret);
         unset($expires);
     }
     $params = array();
     if ($version >= 2.0) {
         $params['openid.ns'] = Zend_OpenId::NS_2_0;
     }
     $params['openid.mode'] = $immediate ? 'checkid_immediate' : 'checkid_setup';
     $params['openid.identity'] = $id;
     $params['openid.claimed_id'] = $claimedId;
     if ($version <= 2.0) {
         if ($this->_session !== null) {
             $this->_session->identity = $id;
             $this->_session->claimed_id = $claimedId;
             if ($server == 'https://www.google.com/accounts/o8/ud') {
                 $params['openid.identity'] = 'http://specs.openid.net/auth/2.0/identifier_select';
                 $params['openid.claimed_id'] = 'http://specs.openid.net/auth/2.0/identifier_select';
                 $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
                 $params['openid.ax.mode'] = 'fetch_request';
                 $params['openid.ax.type.email'] = 'http://axschema.org/contact/email';
                 $params['openid.ax.type.country'] = 'http://axschema.org/contact/country/home';
                 $params['openid.ax.type.firstname'] = 'http://axschema.org/namePerson/first';
                 $params['openid.ax.type.lastname'] = 'http://axschema.org/namePerson/last';
                 $params['openid.ax.type.language'] = 'http://axschema.org/pref/language';
                 $params['openid.ax.required'] = 'country,firstname,email,language,lastname';
             }
         } else {
             if (defined('SID')) {
                 $_SESSION["zend_openid"] = array("identity" => $id, "claimed_id" => $claimedId);
             } else {
                 require_once "Zend/Session/Namespace.php";
                 $this->_session = new Zend_Session_Namespace("zend_openid");
                 $this->_session->identity = $id;
                 $this->_session->claimed_id = $claimedId;
             }
         }
     }
     if (isset($handle)) {
         $params['openid.assoc_handle'] = $handle;
     }
     $params['openid.return_to'] = Zend_OpenId::absoluteUrl($returnTo);
     if (empty($root)) {
         $root = Zend_OpenId::selfUrl();
         if ($root[strlen($root) - 1] != '/') {
             $root = dirname($root);
         }
     }
     if ($version >= 2.0) {
         $params['openid.realm'] = $root;
     } else {
         $params['openid.trust_root'] = $root;
     }
     if (!Zend_OpenId_Extension::forAll($extensions, 'prepareRequest', $params)) {
         $this->_setError("Extension::prepareRequest failure");
         return false;
     }
     Zend_OpenId::redirect($server, $params, $response);
     return true;
 }
开发者ID:HuyTran0424,项目名称:noeavrsev345452dfgdfgsg,代码行数:95,代码来源:Consumer.php

示例12: trustAction

 public function trustAction()
 {
     $this->view->title = "Do you trust this website?";
     $server = $this->getServer();
     $this->view->site = $server->getSiteRoot($_GET);
     $this->view->user = $server->getLoggedInUser();
     $userDetails = new Default_Model_UserDetails();
     $sreg = new Zend_OpenId_Extension_Sreg($userDetails->getUserDetailsFromOpenId($server->getLoggedInUser()));
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['openid_action']) && $_POST['openid_action'] === 'trust') {
         if (isset($_POST['allow'])) {
             if (isset($_POST['forever'])) {
                 $server->allowSite($server->getSiteRoot($_GET), $sreg);
             }
             $server->respondToConsumer($_GET, $sreg);
         } else {
             if (isset($_POST['deny'])) {
                 if (isset($_POST['forever'])) {
                     $server->denySite($server->getSiteRoot($_GET));
                 }
                 Zend_OpenId::redirect(urldecode($_GET['openid_return_to']), array('openid.mode' => 'cancel'));
             }
         }
     }
 }
开发者ID:heiglandreas,项目名称:Zend-Framework-OpenID-Provider,代码行数:24,代码来源:ProviderController.php


注:本文中的Zend_OpenId::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。