本文整理汇总了PHP中Authenticator::get_authenticators方法的典型用法代码示例。如果您正苦于以下问题:PHP Authenticator::get_authenticators方法的具体用法?PHP Authenticator::get_authenticators怎么用?PHP Authenticator::get_authenticators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authenticator
的用法示例。
在下文中一共展示了Authenticator::get_authenticators方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
}
示例2: 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();
}
示例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');
// And that the unique identified field is 'Email'
$this->priorUniqueIdentifierField = Member::get_unique_identifier_field();
Member::set_unique_identifier_field('Email');
parent::setUp();
}
示例4: 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();
}
示例5: 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();
}
示例6: GetLoginForms
/**
* Get the login forms for all available authentication methods
*
* @return array Returns an array of available login forms (array of Form
* objects).
*
* @todo Check how to activate/deactivate authentication methods
*/
protected function GetLoginForms()
{
$forms = array();
$authenticators = Authenticator::get_authenticators();
foreach ($authenticators as $authenticator) {
array_push($forms, call_user_func(array($authenticator, 'get_login_form'), $this));
}
return $forms;
}
示例7: GetLoginForms
/**
* Get the login forms for all available authentication methods
*
* @return array Returns an array of available login forms (array of Form
* objects).
*
* @todo Check how to activate/deactivate authentication methods
*/
public function GetLoginForms()
{
$forms = array();
$authenticators = Authenticator::get_authenticators();
foreach ($authenticators as $authenticator) {
$forms[] = $authenticator::get_login_form($this);
}
return $forms;
}
示例8: enabled
/**
* Determine if CMSSecurity is enabled
*
* @return bool
*/
public static function enabled()
{
// Disable shortcut
if (!static::config()->reauth_enabled) {
return false;
}
// Count all cms-supported methods
$authenticators = Authenticator::get_authenticators();
foreach ($authenticators as $authenticator) {
// Supported if at least one authenticator is supported
if ($authenticator::supports_cms()) {
return true;
}
}
return false;
}