public function SamlService::getAttributeByConfig in SAML Authentication 8.2
Same name and namespace in other branches
- 8.3 src/SamlService.php \Drupal\samlauth\SamlService::getAttributeByConfig()
- 4.x src/SamlService.php \Drupal\samlauth\SamlService::getAttributeByConfig()
Returns value from a SAML attribute whose name is configured in our module.
This method will return valid data after a response is processed (i.e. after samlAuth->processResponse() is called).
Parameters
string $config_key: A key in the module's configuration, containing the name of a SAML attribute.
Return value
mixed|null The SAML attribute value; NULL if the attribute value, or configuration key, was not found.
1 call to SamlService::getAttributeByConfig()
- SamlService::acs in src/
SamlService.php - Processes a SAML response (Assertion Consumer Service).
File
- src/
SamlService.php, line 359
Class
- SamlService
- Governs communication between the SAML toolkit and the IDP / login behavior.
Namespace
Drupal\samlauthCode
public function getAttributeByConfig($config_key) {
$attribute_name = $this->config
->get($config_key);
if ($attribute_name) {
$attribute = $this
->getSamlAuth()
->getAttribute($attribute_name);
if (!empty($attribute[0])) {
return $attribute[0];
}
}
}