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


PHP Gdn_AuthenticationProviderModel::getDefault方法代码示例

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


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

示例1: checkOverride

    /**
     * Check the default provider to see if it overrides one of the entry methods and then redirect.
     *
     * @param string $Type One of the following.
     *  - SignIn
     *  - Register
     *  - SignOut (not complete)
     * @param string $Target
     * @param string $TransientKey
     */
    protected function checkOverride($Type, $Target, $TransientKey = null)
    {
        if (!$this->Request->get('override', true)) {
            return;
        }
        $Provider = Gdn_AuthenticationProviderModel::getDefault();
        if (!$Provider) {
            return;
        }
        $this->EventArguments['Target'] = $Target;
        $this->EventArguments['DefaultProvider'] =& $Provider;
        $this->EventArguments['TransientKey'] = $TransientKey;
        $this->fireEvent("Override{$Type}");
        $Url = $Provider[$Type . 'Url'];
        if ($Url) {
            switch ($Type) {
                case 'Register':
                case 'SignIn':
                    // When the other page comes back it needs to go through /sso to force a sso check.
                    $Target = '/sso?target=' . urlencode($Target);
                    break;
                case 'SignOut':
                    $Cookie = c('Garden.Cookie.Name');
                    if (strpos($Url, '?') === false) {
                        $Url .= '?vfcookie=' . urlencode($Cookie);
                    } else {
                        $Url .= '&vfcookie=' . urlencode($Cookie);
                    }
                    // Check to sign out here.
                    $SignedOut = !Gdn::session()->isValid();
                    if (!$SignedOut && (Gdn::session()->validateTransientKey($TransientKey) || $this->Form->isPostBack())) {
                        Gdn::session()->end();
                        $SignedOut = true;
                    }
                    // Sign out is a bit of a tricky thing so we configure the way it works.
                    $SignoutType = c('Garden.SSO.Signout');
                    switch ($SignoutType) {
                        case 'redirect-only':
                            // Just redirect to the url.
                            break;
                        case 'post-only':
                            $this->setData('Method', 'POST');
                            break;
                        case 'post':
                            // Post to the url after signing out here.
                            if (!$SignedOut) {
                                return;
                            }
                            $this->setData('Method', 'POST');
                            break;
                        case 'none':
                            return;
                        case 'redirect':
                        default:
                            if (!$SignedOut) {
                                return;
                            }
                            break;
                    }
                    break;
                default:
                    throw new Exception("Unknown entry type {$Type}.");
            }
            $Url = str_ireplace('{target}', rawurlencode(url($Target, true)), $Url);
            if ($this->deliveryType() == DELIVERY_TYPE_ALL && strcasecmp($this->data('Method'), 'POST') != 0) {
                redirectUrl($Url, 302);
            } else {
                $this->setData('Url', $Url);
                $Script = <<<EOT
<script type="text/javascript">
   window.location = "{$Url}";
</script>
EOT;
                $this->render('Redirect', 'Utility');
                die;
            }
        }
    }
开发者ID:korelstar,项目名称:vanilla,代码行数:88,代码来源:class.entrycontroller.php

示例2: signInUrl

 function signInUrl($target = '', $force = false)
 {
     // Check to see if there is even a sign in button.
     if (!$force && strcasecmp(C('Garden.Registration.Method'), 'Connect') !== 0) {
         $defaultProvider = Gdn_AuthenticationProviderModel::getDefault();
         if ($defaultProvider && !val('SignInUrl', $defaultProvider)) {
             return '';
         }
     }
     return '/entry/signin' . ($target ? '?Target=' . urlencode($target) : '');
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:11,代码来源:functions.render.php

示例3: rootController_sso_create

 /**
  * Method for plugins that want a friendly /sso method to hook into.
  *
  * @param RootController $Sender
  * @param string $Target The url to redirect to after sso.
  */
 public function rootController_sso_create($Sender, $Target = '')
 {
     if (!$Target) {
         $Target = $Sender->Request->get('redirect');
         if (!$Target) {
             $Target = '/';
         }
     }
     // Get the default authentication provider.
     $DefaultProvider = Gdn_AuthenticationProviderModel::getDefault();
     $Sender->EventArguments['Target'] = $Target;
     $Sender->EventArguments['DefaultProvider'] = $DefaultProvider;
     $Handled = false;
     $Sender->EventArguments['Handled'] =& $Handled;
     $Sender->fireEvent('SSO');
     // If an event handler didn't handle the signin then just redirect to the target.
     if (!$Handled) {
         safeRedirect($Target, 302);
     }
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:26,代码来源:class.hooks.php


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