Commit 8ed17cd7 authored by Lukas Haemmerle's avatar Lukas Haemmerle

Implemented #3919 where Shib Scopes and MDUI DomainHint would be added as keywords per IdP as well.

parent 00927b23
......@@ -292,6 +292,23 @@ function processIDPRoleDescriptor($IDPRoleDescriptorNode){
$IDP[$lang]['Keywords'] = $keywords;
}
// Ensure there is a keyword entry for default language
if (!isset($IDP[$defaultLanguage]['Keywords'])){
$IDP[$defaultLanguage]['Keywords'] = '';
}
// Also add entityID as keyword
$IDP[$defaultLanguage]['Keywords'] .= $IDPRoleDescriptorNode->parentNode->getAttribute('entityID');
// Get scopes
$ShibScopes = getShibScopes($IDPRoleDescriptorNode);
// Get domain hints
$MDUIDomainHints = getMDUIDomainHints($IDPRoleDescriptorNode);
// Add unique domains as keywords as well
$IDP[$defaultLanguage]['Keywords'] .= ' '.implode(' ', array_unique(array_merge($ShibScopes, $MDUIDomainHints)));
// Get Logos
$MDUILogos = getMDUILogos($IDPRoleDescriptorNode);
foreach ($MDUILogos as $Logo){
......@@ -327,7 +344,6 @@ function processIDPRoleDescriptor($IDPRoleDescriptorNode){
}
// Get DomainHints
$MDUIDomainHints = getMDUIDomainHints($IDPRoleDescriptorNode);
if ($MDUIDomainHints){
$IDP['DomainHint'] = $MDUIDomainHints;
}
......@@ -507,6 +523,24 @@ function getMDUIKeywords($RoleDescriptorNode){
return $Entity;
}
// Get Shib Scopes from RoleDescriptor
function getShibScopes($RoleDescriptorNode){
$Scopes = Array();
$ShibScopes = $RoleDescriptorNode->getElementsByTagNameNS('urn:mace:shibboleth:metadata:1.0', 'Scope');
foreach( $ShibScopes as $ShibScopeEntry ){
// Ignore regular expression scopes
if ($ShibScopeEntry->getAttribute('regexp') && $ShibScopeEntry->getAttribute('regexp') == 'true'){
continue;
}
$Scopes[] = trim($ShibScopeEntry->nodeValue);
}
return $Scopes;
}
// Get MD Logos from RoleDescriptor. Prefer the favicon logos
function getMDUILogos($RoleDescriptorNode){
......
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