public function tearDown()
 {
     // Restore selected authenticator
     // MemberAuthenticator might not actually be present
     if (!in_array('SilverStripe\\Security\\MemberAuthenticator', $this->priorAuthenticators)) {
         Authenticator::unregister('SilverStripe\\Security\\MemberAuthenticator');
     }
     foreach ($this->priorAuthenticators as $authenticator) {
         Authenticator::register($authenticator);
     }
     Authenticator::set_default_authenticator($this->priorDefaultAuthenticator);
     // Restore unique identifier field
     Member::config()->unique_identifier_field = $this->priorUniqueIdentifierField;
     Security::config()->remember_username = $this->priorRememberUsername;
     parent::tearDown();
 }
 /**
  * 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;
 }
 /**
  * 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;
 }