function _saml_sp__extract_outbound_id in SAML Service Provider 7.2
Same name and namespace in other branches
- 8.3 saml_sp.module \_saml_sp__extract_outbound_id()
- 8.2 saml_sp.module \_saml_sp__extract_outbound_id()
- 7.8 saml_sp.module \_saml_sp__extract_outbound_id()
- 7 saml_sp.module \_saml_sp__extract_outbound_id()
- 7.3 saml_sp.module \_saml_sp__extract_outbound_id()
- 4.x saml_sp.module \_saml_sp__extract_outbound_id()
- 3.x saml_sp.module \_saml_sp__extract_outbound_id()
Extract the unique ID of an outbound request.
Parameters
String $encoded_url: The response of OneLogin_Saml_AuthRequest::getRedirectUrl(), which is multiple-encoded.
Return value
String|FALSE The unique ID of the outbound request, if it can be decoded. This will be OneLogin_Saml_AuthRequest::ID_PREFIX, followed by a sha1 hash.
File
- ./
saml_sp.module, line 756 - SAML Service Provider
Code
function _saml_sp__extract_outbound_id($encoded_url) {
$string = $encoded_url;
$string = @urldecode($string);
$string = @substr($string, 0, strpos($string, '&'));
$string = @base64_decode($string);
$string = @gzinflate($string);
// This regex is based on the constructor code provided in
// OneLogin_Saml2_AuthnRequest.
$regex = '/^<samlp:AuthnRequest
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="(ONELOGIN_[0-9a-f]{40})"/m';
$result = FALSE;
if (preg_match($regex, $string, $matches)) {
$result = $matches[1];
}
return $result;
}