Commit c19f56bf authored by haemmer's avatar haemmer

Implemented #849

parent 81f96da8
......@@ -188,25 +188,26 @@ function getDomainNameFromURIHint(){
global $IDProviders;
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
if ($hostname == $_SERVER['REMOTE_ADDR']){
$clientHostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
if ($clientHostname == $_SERVER['REMOTE_ADDR']){
return '-';
}
// Do we still have something
$domainname = getDomainNameFromURI($hostname);
if ($domainname != ''){
// Find a matching IdP SSO, must be matching the IdP urn
// or at least the last part of the urn
foreach ($IDProviders as $key => $value){
if (preg_match('/'.$domainname.'$/', $key)){
return $key;
}
}
} else {
// Get domain name from client host name
$clientDomainName = getDomainNameFromURI($clientHostname);
if ($clientDomainName == ''){
return '-';
}
// Return first matching IdP entityID that contains the client domain name
foreach ($IDProviders as $key => $value){
if (preg_match('/'.$clientDomainName.'/', $key)){
return $key;
}
}
// No matching entityID was found
return '-';
}
/******************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment