Fix for CMS Authenticator. Should only apply to CMSSecurity

This commit is contained in:
Simon Erkelens 2017-06-10 14:46:01 +12:00
parent c7f7233c4d
commit 3fe837dad7
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');
}
}