class ShibSessionVars in Shibboleth Authentication 8
Hierarchy
- class \Drupal\shib_auth\Login\ShibSessionVars
Expanded class hierarchy of ShibSessionVars
1 file declares its use of ShibSessionVars
- CustomDataForm.php in src/
Form/ CustomDataForm.php
1 string reference to 'ShibSessionVars'
1 service uses ShibSessionVars
File
- src/
Login/ ShibSessionVars.php, line 8
Namespace
Drupal\shib_auth\LoginView source
class ShibSessionVars {
/**
* @var string
*/
private $session_id;
/**
* @var string
*/
private $targeted_id;
/**
* @var string
*/
private $email;
/**
* @var string
*/
private $idp;
/**
* @var string
*/
private $entitlement;
/**
* @var string
*/
private $affiliation;
/**
* ShibSessionVars constructor.
*
* @param \Drupal\Core\Config\ImmutableConfig $config
*/
public function __construct($config) {
$this->session_id = self::fixModRewriteIssues('Shib-Session-ID');
$this->targeted_id = self::fixModRewriteIssues($config
->get('server_variable_username'));
$this->email = self::fixModRewriteIssues($config
->get('server_variable_email'));
$this->idp = self::fixModRewriteIssues('Shib-Identity-Provider');
$this->entitlement = self::fixModRewriteIssues('entitlement');
$this->affiliation = self::fixModRewriteIssues('affiliation');
}
/**
* @return string
*/
public function getSessionId() {
return $this->session_id;
}
/**
* @return string
*/
public function getTargetedId() {
return $this->targeted_id;
}
/**
* @return string
*/
public function getEmail() {
return $this->email;
}
/**
* @return string
*/
public function getIdp() {
return $this->idp;
}
/**
* @return string
*/
public function getEntitlement() {
return $this->entitlement;
}
/**
* @return string
*/
public function getAffiliation() {
return $this->affiliation;
}
/**
* Get environment variables that may have been modified by mod_rewrite.
*
* @param $var
*
* @return string or null
*/
private static function fixModRewriteIssues($var) {
if (!$var) {
return NULL;
}
// foo-bar.
if (array_key_exists($var, $_SERVER)) {
return $_SERVER[$var];
}
// FOO-BAR.
$var = strtoupper($var);
if (array_key_exists($var, $_SERVER)) {
return $_SERVER[$var];
}
// REDIRECT_foo_bar.
$var = "REDIRECT_" . str_replace('-', '_', $var);
if (array_key_exists($var, $_SERVER)) {
return $_SERVER[$var];
}
// HTTP_FOO_BAR.
$var = strtoupper($var);
$var = preg_replace('/^REDIRECT/', 'HTTP', $var);
if (array_key_exists($var, $_SERVER)) {
return $_SERVER[$var];
}
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ShibSessionVars:: |
private | property | ||
ShibSessionVars:: |
private | property | ||
ShibSessionVars:: |
private | property | ||
ShibSessionVars:: |
private | property | ||
ShibSessionVars:: |
private | property | ||
ShibSessionVars:: |
private | property | ||
ShibSessionVars:: |
private static | function | Get environment variables that may have been modified by mod_rewrite. | |
ShibSessionVars:: |
public | function | ||
ShibSessionVars:: |
public | function | ||
ShibSessionVars:: |
public | function | ||
ShibSessionVars:: |
public | function | ||
ShibSessionVars:: |
public | function | ||
ShibSessionVars:: |
public | function | ||
ShibSessionVars:: |
public | function | ShibSessionVars constructor. |