private function LdapAuthenticationTestCase::setSsoServerEnvironment in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_authentication/tests/ldap_authentication.test \LdapAuthenticationTestCase::setSsoServerEnvironment()
Set mock server variables for sso tests.
Parameters
string $server_var_key:
string $sso_name:
string $ldapImplementation:
bool $seamlessLogin:
Return value
object
1 call to LdapAuthenticationTestCase::setSsoServerEnvironment()
- LdapAuthenticationTestCase::testSSOUserLogon in ldap_authentication/
tests/ ldap_authentication.test - LDAP Authentication Exclusive Mode User Logon Test (ids = LDAP_authen.EM.ULT.*)
File
- ldap_authentication/
tests/ ldap_authentication.test, line 314
Class
- LdapAuthenticationTestCase
- LdapAuthenticationTestCase.
Code
private function setSsoServerEnvironment($server_var_key = 'REMOTE_USER', $sso_name = 'hpotter', $ldapImplementation = 'mod_auth_sspi', $seamlessLogin = TRUE) {
// Clear past environment.
ldap_servers_delete_globals('_SERVER', 'REMOTE_USER', TRUE);
ldap_servers_delete_globals('_SERVER', 'REDIRECT_REMOTE_USER', TRUE);
$authenticationConf = new LdapAuthenticationConfAdmin();
$authenticationConf->ssoEnabled = TRUE;
$authenticationConf->ssoRemoteUserStripDomainName = FALSE;
$authenticationConf->ssoExcludedPaths = [];
$authenticationConf->ssoExcludedHosts = [];
$authenticationConf->seamlessLogin = $seamlessLogin;
$authenticationConf->ldapImplementation = $ldapImplementation;
if ($sso_name !== FALSE) {
if (strpos($sso_name, '@')) {
$sso_name_parts = explode('@', $sso_name);
$sso_name = $sso_name_parts[0];
$authenticationConf->ssoRemoteUserStripDomainName = TRUE;
}
ldap_servers_set_globals('_SERVER', $server_var_key, $sso_name);
}
$authenticationConf
->save();
return ldap_authentication_get_valid_conf(TRUE);
}