You are here

public function SecuresiteManager::forcedAuth in Secure Site 8

Determine if Secure Site authentication should be forced.

Overrides SecuresiteManagerInterface::forcedAuth

File

src/SecuresiteManager.php, line 531
Contains \Drupal\securesite\SecuresiteManager.

Class

SecuresiteManager

Namespace

Drupal\securesite

Code

public function forcedAuth() {

  // Do we require credentials to display this page?
  if (php_sapi_name() == 'cli' || current_path() == 'admin/reports/request-test') {
    return FALSE;
  }
  else {
    switch (\Drupal::config('securesite.settings')
      ->get('securesite_enabled')) {
      case SECURESITE_ALWAYS:
        return TRUE;
      case SECURESITE_OFFLINE:
        return \Drupal::state()
          ->get('system.maintenance_mode') ?: 0;
      default:
        return FALSE;
    }
  }
}