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


PHP Gdn::authenticator方法代码示例

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


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

示例1: startAuthenticator

 public function startAuthenticator()
 {
     if (!c('Garden.Installed', false)) {
         return;
     }
     // Start the 'session'
     Gdn::session()->start(false, false);
     // Get list of enabled authenticators
     $AuthenticationSchemes = Gdn::config('Garden.Authenticator.EnabledSchemes', array());
     // Bring all enabled authenticator classes into the defined scope to allow them to be picked up by the plugin manager
     foreach ($AuthenticationSchemes as $AuthenticationSchemeAlias) {
         $Registered = $this->registerAuthenticator($AuthenticationSchemeAlias);
     }
     $this->_Started = true;
     $this->wakeUpAuthenticators();
     if (Gdn::session()->isValid() && !Gdn::session()->checkPermission('Garden.SignIn.Allow')) {
         return Gdn::authenticator()->authenticateWith('user')->deauthenticate();
     }
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:19,代码来源:class.auth.php

示例2: leave

 /**
  * Does actual de-authentication of a user. Used by SignOut().
  *
  * @access public
  * @since 2.0.0
  *
  * @param string $AuthenticationSchemeAlias
  * @param string $TransientKey Unique value to prove intent.
  */
 public function leave($AuthenticationSchemeAlias = 'default', $TransientKey = '')
 {
     deprecated(__FUNCTION__);
     $this->EventArguments['AuthenticationSchemeAlias'] = $AuthenticationSchemeAlias;
     $this->fireEvent('BeforeLeave');
     // Allow hijacking deauth type
     $AuthenticationSchemeAlias = $this->EventArguments['AuthenticationSchemeAlias'];
     try {
         $Authenticator = Gdn::authenticator()->authenticateWith($AuthenticationSchemeAlias);
     } catch (Exception $e) {
         $Authenticator = Gdn::authenticator()->authenticateWith('default');
     }
     // Only sign the user out if this is an authenticated postback! Start off pessimistic
     $this->Leaving = false;
     $Result = Gdn_Authenticator::REACT_RENDER;
     // Build these before doing anything desctructive as they are supposed to have user context
     $LogoutResponse = $Authenticator->logoutResponse();
     $LoginResponse = $Authenticator->loginResponse();
     $AuthenticatedPostbackRequired = $Authenticator->requireLogoutTransientKey();
     if (!$AuthenticatedPostbackRequired || Gdn::session()->validateTransientKey($TransientKey)) {
         $Result = $Authenticator->deauthenticate();
         $this->Leaving = true;
     }
     if ($Result == Gdn_Authenticator::AUTH_SUCCESS) {
         $this->View = 'leave';
         $Reaction = $LogoutResponse;
     } else {
         $this->View = 'auth/' . $Authenticator->getAuthenticationSchemeAlias();
         $Reaction = $LoginResponse;
     }
     switch ($Reaction) {
         case Gdn_Authenticator::REACT_RENDER:
             break;
         case Gdn_Authenticator::REACT_EXIT:
             exit;
             break;
         case Gdn_Authenticator::REACT_REMOTE:
             // Render the view, but set the delivery type to VIEW
             $this->_DeliveryType = DELIVERY_TYPE_VIEW;
             break;
         case Gdn_Authenticator::REACT_REDIRECT:
         default:
             // If we're just told to redirect, but not where... try to figure out somewhere that makes sense.
             if ($Reaction == Gdn_Authenticator::REACT_REDIRECT) {
                 $Route = '/';
                 $Target = $this->target();
                 if (!is_null($Target)) {
                     $Route = $Target;
                 }
             } else {
                 $Route = $Reaction;
             }
             if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
                 $this->RedirectUrl = url($Route);
             } else {
                 if ($Route !== false) {
                     redirect($Route);
                 } else {
                     redirect(Gdn::router()->getDestination('DefaultController'));
                 }
             }
             break;
     }
     $this->render();
 }
开发者ID:korelstar,项目名称:vanilla,代码行数:74,代码来源:class.entrycontroller.php

示例3: Gdn_Locale

Gdn::themeManager()->start();
// Plugins startup
Gdn::pluginManager()->start();
/**
 * Locales
 *
 * Install any custom locales provided by applications and plugins, and set up
 * the locale management system.
 */
// Load the Garden locale system
$gdnLocale = new Gdn_Locale(c('Garden.Locale', 'en'), Gdn::addonManager());
Gdn::factoryInstall(Gdn::AliasLocale, 'Gdn_Locale', null, Gdn::FactorySingleton, $gdnLocale);
unset($gdnLocale);
require_once PATH_LIBRARY_CORE . '/functions.validation.php';
// Start Authenticators
Gdn::authenticator()->startAuthenticator();
/**
 * Bootstrap After
 *
 * After the bootstrap has finished loading, this hook allows developers a last
 * chance to customize Garden's runtime environment before the actual request
 * is handled.
 */
if (file_exists(PATH_ROOT . '/conf/bootstrap.after.php')) {
    require_once PATH_ROOT . '/conf/bootstrap.after.php';
}
// Include "Render" functions now - this way pluggables and custom confs can override them.
require_once PATH_LIBRARY_CORE . '/functions.render.php';
if (!defined('CLIENT_NAME')) {
    define('CLIENT_NAME', 'vanilla');
}
开发者ID:vanilla,项目名称:vanilla,代码行数:31,代码来源:bootstrap.php

示例4: transientKey

 /**
  * Returns the transient key for the authenticated user.
  *
  * @return string
  */
 public function transientKey($NewKey = null)
 {
     if (!is_null($NewKey)) {
         $this->_TransientKey = Gdn::authenticator()->getUserModel()->setTransientKey($this->UserID, $NewKey);
     }
     //      if ($this->_TransientKey)
     return $this->_TransientKey;
     //      else
     //         return RandomString(12); // Postbacks will never be authenticated if transientkey is not defined.
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:15,代码来源:class.session.php

示例5: setIdentity

 /**
  *
  *
  * @param $UserID
  * @param bool $Persist
  */
 public function setIdentity($UserID, $Persist = true)
 {
     $AuthenticationSchemeAlias = $this->getAuthenticationSchemeAlias();
     Gdn::authenticator()->setIdentity($UserID, $Persist);
     Gdn::session()->start();
     if ($UserID > 0) {
         Gdn::session()->setPreference('Authenticator', $AuthenticationSchemeAlias);
     } else {
         Gdn::session()->setPreference('Authenticator', '');
     }
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:17,代码来源:class.authenticator.php

示例6: writeEmbedCommentForm

    function writeEmbedCommentForm()
    {
        $Session = Gdn::session();
        $Controller = Gdn::controller();
        $Discussion = $Controller->data('Discussion');
        if ($Discussion && $Discussion->Closed == '1') {
            ?>
            <div class="Foot Closed">
                <div class="Note Closed"><?php 
            echo t('This discussion has been closed.');
            ?>
</div>
            </div>
        <?php 
        } else {
            ?>
            <h2><?php 
            echo t('Leave a comment');
            ?>
</h2>
            <div class="MessageForm CommentForm EmbedCommentForm">
                <?php 
            echo $Controller->Form->open(array('id' => 'Form_Comment'));
            echo $Controller->Form->errors();
            echo $Controller->Form->Hidden('Name');
            echo wrap($Controller->Form->textBox('Body', array('MultiLine' => TRUE)), 'div', array('class' => 'TextBoxWrapper'));
            echo "<div class=\"Buttons\">\n";
            $AllowSigninPopup = c('Garden.SignIn.Popup');
            $Attributes = array('tabindex' => '-1', 'target' => '_top');
            // If we aren't ajaxing this call then we need to target the url of the parent frame.
            $ReturnUrl = $Controller->data('ForeignSource.vanilla_url', Gdn::request()->PathAndQuery());
            if ($Session->isValid()) {
                $AuthenticationUrl = Gdn::authenticator()->SignOutUrl($ReturnUrl);
                echo wrap(sprintf(t('Commenting as %1$s (%2$s)', 'Commenting as %1$s <span class="SignOutWrap">(%2$s)</span>'), Gdn_Format::text($Session->User->Name), anchor(t('Sign Out'), $AuthenticationUrl, 'SignOut', $Attributes)), 'div', array('class' => 'Author'));
                echo $Controller->Form->button('Post Comment', array('class' => 'Button CommentButton'));
            } else {
                $AuthenticationUrl = url(SignInUrl($ReturnUrl), true);
                if ($AllowSigninPopup) {
                    $CssClass = 'SignInPopup Button Stash';
                } else {
                    $CssClass = 'Button Stash';
                }
                echo anchor(t('Comment As ...'), $AuthenticationUrl, $CssClass, $Attributes);
            }
            echo "</div>\n";
            echo $Controller->Form->close();
            ?>
            </div>
        <?php 
        }
    }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:51,代码来源:helper_functions.php

示例7: configure

 /**
  * Configure authentication method.
  *
  * @since 2.0.3
  * @access public
  *
  * @param string $AuthenticationSchemeAlias
  */
 public function configure($AuthenticationSchemeAlias = null)
 {
     $Message = t("Please choose an authenticator to configure.");
     if (!is_null($AuthenticationSchemeAlias)) {
         $AuthenticatorInfo = Gdn::authenticator()->getAuthenticatorInfo($AuthenticationSchemeAlias);
         if ($AuthenticatorInfo !== false) {
             $this->AuthenticatorChoice = $AuthenticationSchemeAlias;
             if (array_key_exists($AuthenticationSchemeAlias, $this->ConfigureList) && $this->ConfigureList[$AuthenticationSchemeAlias] !== false) {
                 echo Gdn::slice($this->ConfigureList[$AuthenticationSchemeAlias]);
                 return;
             } else {
                 $Message = sprintf(t("The %s Authenticator does not have any custom configuration options."), $AuthenticatorInfo['Name']);
             }
         }
     }
     $this->setData('ConfigureMessage', $Message);
     $this->render();
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:26,代码来源:class.authenticationcontroller.php


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