Merge pull request #8961 from indygriffiths/patch-1

NEW Only get an authenticator if it's an object
This commit is contained in:
Guy Marriott 2019-05-06 14:27:18 +12:00 committed by GitHub
commit 371588e8b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -202,7 +202,7 @@ class Security extends Controller implements TemplateGlobalProvider
*/
public function getAuthenticators()
{
return $this->authenticators;
return array_filter($this->authenticators);
}
/**
@ -244,7 +244,7 @@ class Security extends Controller implements TemplateGlobalProvider
*/
protected function getAuthenticator($name = 'default')
{
$authenticators = $this->authenticators;
$authenticators = $this->getAuthenticators();
if (isset($authenticators[$name])) {
return $authenticators[$name];
@ -286,7 +286,7 @@ class Security extends Controller implements TemplateGlobalProvider
*/
public function hasAuthenticator($authenticator)
{
$authenticators = $this->authenticators;
$authenticators = $this->getAuthenticators();
return !empty($authenticators[$authenticator]);
}