function _saml_sp__extract_inbound_id in SAML Service Provider 8.2
Same name and namespace in other branches
- 8.3 saml_sp.module \_saml_sp__extract_inbound_id()
- 7.8 saml_sp.module \_saml_sp__extract_inbound_id()
- 7 saml_sp.module \_saml_sp__extract_inbound_id()
- 7.2 saml_sp.module \_saml_sp__extract_inbound_id()
- 7.3 saml_sp.module \_saml_sp__extract_inbound_id()
- 4.x saml_sp.module \_saml_sp__extract_inbound_id()
- 3.x saml_sp.module \_saml_sp__extract_inbound_id()
Extract the unique ID in an inbound request.
Parameters
String $assertion: UUEncoded SAML assertion from the IdP (i.e. the POST request).
Return value
String|FALSE The unique ID of the inbound request, if it can be decoded. This will be OneLogin_Saml_AuthRequest::ID_PREFIX, followed by a sha1 hash.
1 call to _saml_sp__extract_inbound_id()
- SamlSPController::consume in src/
Controller/ SamlSPController.php - receive data back from the IdP
File
- ./
saml_sp.module, line 400 - SAML Service Provider
Code
function _saml_sp__extract_inbound_id($assertion) {
// Decode the request.
$xml = base64_decode($assertion);
// Load the XML.
$document = new DOMDocument();
if ($document
->loadXML($xml)) {
try {
$id = @$document->firstChild->attributes
->getNamedItem('InResponseTo')->value;
\Drupal::logger('saml_sp')
->notice('SAML login attempt with inbound ID: %id', array(
'%id' => $id,
));
return $id;
} catch (Exception $e) {
\Drupal::logger('saml_sp')
->error('Could not extract inbound ID. %exception', array(
'%exception' => $e,
));
return FALSE;
}
}
\Drupal::logger('saml_sp')
->error('Cannot parse XM response:<br/> <pre>@response</pre>', array(
'@response' => $xml,
));
return FALSE;
}