FIX CMSSecurity doesn't have Authenticators assigned.

This commit is contained in:
Damian Mooyman 2017-06-12 10:10:34 +12:00 committed by GitHub
commit 0dcfa5fa9d
3 changed files with 6 additions and 3 deletions

View File

@ -31,5 +31,8 @@ SilverStripe\Core\Injector\Injector:
properties:
Authenticators:
default: %$SilverStripe\Security\MemberAuthenticator\MemberAuthenticator
SilverStripe\Security\CMSSecurity:
properties:
Authenticators:
cms: %$SilverStripe\Security\MemberAuthenticator\CMSMemberAuthenticator
SilverStripe\Security\IdentityStore: %$SilverStripe\Security\AuthenticationHandler

View File

@ -165,14 +165,14 @@ PHP
*
* @return bool
*/
public static function enabled()
public function enabled()
{
// Disable shortcut
if (!static::config()->get('reauth_enabled')) {
return false;
}
return count(Security::singleton()->getApplicableAuthenticators(Authenticator::CMS_LOGIN)) > 0;
return count($this->getApplicableAuthenticators(Authenticator::CMS_LOGIN)) > 0;
}
/**

View File

@ -356,7 +356,7 @@ class Security extends Controller implements TemplateGlobalProvider
_t('SilverStripe\\CMS\\Controllers\\ContentController.NOTLOGGEDIN', 'Not logged in')
);
// Tell the CMS to allow re-authentication
if (CMSSecurity::enabled()) {
if (CMSSecurity::singleton()->enabled()) {
$response->addHeader('X-Reauthenticate', '1');
}
}