You are here

public function ServerVariableLookup::getAuthenticationNameFromServer in LDAP Single Sign On 8.4

Same name in this branch
  1. 8.4 src/ServerVariableLookup.php \Drupal\ldap_sso\ServerVariableLookup::getAuthenticationNameFromServer()
  2. 8.4 tests/modules/ldap_sso_dummy_ldap/src/ServerVariableLookup.php \Drupal\ldap_sso_dummy_ldap\ServerVariableLookup::getAuthenticationNameFromServer()

Get authentication name from override or server variable.

Parameters

string|null $variable: SSO variable to check, such as REMOTE_USER.

Return value

string|null Authentication name.

Overrides ServerVariableLookupInterface::getAuthenticationNameFromServer

File

tests/modules/ldap_sso_dummy_ldap/src/ServerVariableLookup.php, line 17

Class

ServerVariableLookup
Helper function to make dummy data available in functional tests.

Namespace

Drupal\ldap_sso_dummy_ldap

Code

public function getAuthenticationNameFromServer(?string $variable) : ?string {
  $remote_user = NULL;

  // @todo Make this path checking more robust.
  if (strpos($_SERVER['REQUEST_URI'], '/user/login/sso') !== FALSE) {
    $remote_user = 'hpotter';
  }
  return $remote_user;
}