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


PHP Authenticator::get_default_authenticator方法代码示例

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


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

示例1: onBeforeSecurityLogin

 /**
  * Will redirect the user directly to the IdP login endpoint if:
  *
  * 1) the 'SAMLAuthenticator' is the default authenticator
  * 2) there isn't a GET param showloginform set to 1
  * 3) the member is not currently logged in
  * 4) there are no form messages (errors or notices)
  *
  * @return void
  */
 public function onBeforeSecurityLogin()
 {
     if (Authenticator::get_default_authenticator() != 'SAMLAuthenticator') {
         return;
     }
     // by going to the URL Security/login?showloginform=1 we bypass the auto sign on
     if ($this->owner->request->getVar('showloginform') == 1) {
         return;
     }
     // if member is already logged in, don't auto-sign-on, this is most likely because
     // of unsufficient permissions.
     $member = Member::currentUser();
     if ($member && $member->exists()) {
         return;
     }
     // if there are form messages, don't auto-sign-on, this is most likely because of
     // login errors / failures or other notices.
     if (Session::get('FormInfo')) {
         // since FormInfo can be a "nulled" array, we have to check
         foreach (Session::get('FormInfo') as $form => $info) {
             foreach ($info as $name => $value) {
                 if ($value !== null) {
                     return;
                 }
             }
         }
     }
     $backURL = Session::get('BackURL');
     if ($this->owner->request->getVar('BackURL')) {
         $backURL = $this->owner->request->getVar('BackURL');
     }
     $authenticator = Injector::inst()->create('SAMLAuthenticator');
     $authenticator->authenticate(array("BackURL" => $backURL));
 }
开发者ID:eLBirador,项目名称:silverstripe-activedirectory,代码行数:44,代码来源:SAMLSecurityExtension.php

示例2: setUp

 function setUp()
 {
     self::$fixture_file = MODULE_SECUREFILES_PATH . '/tests/SecureFileControllerTest.yml';
     parent::setUp();
     $this->priorAuthenticators = Authenticator::get_authenticators();
     $this->priorDefaultAuthenticator = Authenticator::get_default_authenticator();
     Authenticator::register('MemberAuthenticator');
     Authenticator::set_default_authenticator('MemberAuthenticator');
     if (!file_exists(ASSETS_PATH)) {
         mkdir(ASSETS_PATH);
     }
     /* Create a test folders for each of the fixture references */
     $fileIDs = $this->allFixtureIDs('Folder');
     foreach ($fileIDs as $fileID) {
         $file = DataObject::get_by_id('Folder', $fileID);
         if (!file_exists(BASE_PATH . "/{$file->Filename}")) {
             mkdir(BASE_PATH . "/{$file->Filename}");
         }
     }
     /* Create a test files for each of the fixture references */
     $fileIDs = $this->allFixtureIDs('File');
     foreach ($fileIDs as $fileID) {
         $file = DataObject::get_by_id('File', $fileID);
         $fh = fopen(BASE_PATH . "/{$file->Filename}", "w");
         fwrite($fh, str_repeat('x', 1000));
         fclose($fh);
     }
     // USERS:
     // 1 x ADMIN user
     // 1 x Member with SECUREFILEACCESS
     // 1 x Member with SECURE_FILE_SETTINGS
     // 1 x Member
 }
开发者ID:hamishcampbell,项目名称:silverstripe-securefiles,代码行数:33,代码来源:SecureFileControllerTest.php

示例3: setUp

 function setUp()
 {
     // This test assumes that MemberAuthenticator is present and the default
     $this->priorAuthenticators = Authenticator::get_authenticators();
     $this->priorDefaultAuthenticator = Authenticator::get_default_authenticator();
     Authenticator::register('MemberAuthenticator');
     Authenticator::set_default_authenticator('MemberAuthenticator');
     parent::setUp();
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:9,代码来源:SecurityTest.php

示例4: setUp

 function setUp()
 {
     // This test assumes that MemberAuthenticator is present and the default
     $this->priorAuthenticators = Authenticator::get_authenticators();
     $this->priorDefaultAuthenticator = Authenticator::get_default_authenticator();
     Authenticator::register('MemberAuthenticator');
     Authenticator::set_default_authenticator('MemberAuthenticator');
     // And that the unique identified field is 'Email'
     $this->priorUniqueIdentifierField = Member::get_unique_identifier_field();
     Member::set_unique_identifier_field('Email');
     parent::setUp();
 }
开发者ID:eLBirador,项目名称:AllAboutCity,代码行数:12,代码来源:SecurityTest.php

示例5: setUp

 public function setUp()
 {
     // This test assumes that MemberAuthenticator is present and the default
     $this->priorAuthenticators = Authenticator::get_authenticators();
     $this->priorDefaultAuthenticator = Authenticator::get_default_authenticator();
     foreach ($this->priorAuthenticators as $authenticator) {
         Authenticator::unregister($authenticator);
     }
     Authenticator::register('MemberAuthenticator');
     Authenticator::set_default_authenticator('MemberAuthenticator');
     // And that the unique identified field is 'Email'
     $this->priorUniqueIdentifierField = Member::config()->unique_identifier_field;
     $this->priorRememberUsername = Security::config()->remember_username;
     Member::config()->unique_identifier_field = 'Email';
     parent::setUp();
 }
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:16,代码来源:SecurityTest.php

示例6: authenticate

 /**
  * The authenticate function
  *
  * Takes the basic auth details and attempts to log a user in from the DB
  *
  * @return Member|false The Member object, or false if no member
  */
 public static function authenticate()
 {
     //if there is no username or password, break
     if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
         return false;
     }
     //Attempt to authenticate with the default authenticator for the site
     $authClass = Authenticator::get_default_authenticator();
     $member = $authClass::authenticate(array('Email' => $_SERVER['PHP_AUTH_USER'], 'Password' => $_SERVER['PHP_AUTH_PW']));
     //Log the member in and return the member, if they were found
     if ($member) {
         $member->LogIn(false);
         return $member;
     }
     return false;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-restfulserver,代码行数:23,代码来源:BasicRestfulAuthenticator.php

示例7: setUp

 function setUp()
 {
     // This test assumes that MemberAuthenticator is present and the default
     $this->priorAuthenticators = Authenticator::get_authenticators();
     $this->priorDefaultAuthenticator = Authenticator::get_default_authenticator();
     //Authenticator::register('MemberAuthenticator');
     Authenticator::register_authenticator('ExternalAuthenticator');
     Authenticator::set_default_authenticator('ExternalAuthenticator');
     //Create the sources in this order. Switching them around would mean that
     //all tests use the fake driver because this always succeeds and auto create
     //is on
     ExternalAuthenticator::createSource('sstripe_unittest', 'SSTRIPE', 'SilverStripe');
     ExternalAuthenticator::createSource('fake_unittest', 'FAKE', 'Fake Source');
     ExternalAuthenticator::setAuthSequential(true);
     ExternalAuthenticator::setAuthSSLock('sstripe_unittest', true);
     ExternalAuthenticator::setAuthSSLock('fake_unittest', false);
     ExternalAuthenticator::setAutoAdd('fake_unittest', 'mygroup');
     ExternalAuthenticator::setDefaultDomain('fake_unittest', 'silverstripe.com');
     ExternalAuthenticator::setAuthDebug(false);
     ExternalAuthenticator::setAuditLogFile(false);
     ExternalAuthenticator::setAuditLogSStripe(true);
     parent::setUp();
 }
开发者ID:hamishcampbell,项目名称:silverstripe-auth-external,代码行数:23,代码来源:ExternalAuthenticatorTest.php

示例8: LoginForm

 /**
  * Get the login form to process according to the submitted data
  */
 public function LoginForm()
 {
     if (isset($this->requestParams['AuthenticationMethod'])) {
         $authenticator = trim($_REQUEST['AuthenticationMethod']);
         $authenticators = Authenticator::get_authenticators();
         if (in_array($authenticator, $authenticators)) {
             return call_user_func(array($authenticator, 'get_login_form'), $this);
         }
     } else {
         if ($authenticator = Authenticator::get_default_authenticator()) {
             return call_user_func(array($authenticator, 'get_login_form'), $this);
         }
     }
     user_error('Passed invalid authentication method', E_USER_ERROR);
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:18,代码来源:Security.php

示例9: getAuthenticator

 /**
  * Get the selected authenticator for this request
  *
  * @return string Class name of Authenticator
  */
 protected function getAuthenticator()
 {
     $authenticator = $this->getRequest()->requestVar('AuthenticationMethod');
     if ($authenticator) {
         $authenticators = Authenticator::get_authenticators();
         if (in_array($authenticator, $authenticators)) {
             return $authenticator;
         }
     } else {
         return Authenticator::get_default_authenticator();
     }
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:17,代码来源:Security.php


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