mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
NEW Filter out authenticators that are falsy
Use-case: if a module is defining its own authenticator and you want to disable it, as it seems we don't have `unregister_authenticator()` anymore and I can't spot how to remove YAML-based injected properties, then this lets you mark it as null or false to prevent it from erroring out when it attempts to call `supportedServices()`
This commit is contained in:
parent
2e5c7b9f2d
commit
5dc57518c2
@ -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]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user