diff --git a/app/AvailablePlugin/FederationSource/Config/Schema/schema.xml b/app/AvailablePlugin/FederationSource/Config/Schema/schema.xml
index f8ea18af9..0e9ef7c9c 100644
--- a/app/AvailablePlugin/FederationSource/Config/Schema/schema.xml
+++ b/app/AvailablePlugin/FederationSource/Config/Schema/schema.xml
@@ -41,6 +41,7 @@
REFERENCES cm_servers(id)
+
diff --git a/app/AvailablePlugin/FederationSource/Lib/enum.php b/app/AvailablePlugin/FederationSource/Lib/enum.php
index 8b58dd494..b2ac23b96 100644
--- a/app/AvailablePlugin/FederationSource/Lib/enum.php
+++ b/app/AvailablePlugin/FederationSource/Lib/enum.php
@@ -30,3 +30,8 @@ class MetadataProtocol
const File = "F";
const MDQ = "MQ";
}
+
+class MdqProtocol
+{
+ const IdpsOnly = "IO";
+}
diff --git a/app/AvailablePlugin/FederationSource/Lib/lang.php b/app/AvailablePlugin/FederationSource/Lib/lang.php
index ef9dba75a..a6332d22e 100644
--- a/app/AvailablePlugin/FederationSource/Lib/lang.php
+++ b/app/AvailablePlugin/FederationSource/Lib/lang.php
@@ -42,11 +42,17 @@
MetadataProtocol::MDQ => "MDQ"
),
+ // Enumeration language texts
+ 'pl.federationsource.en.entities' => array(
+ MdqProtocol::IdpsOnly => 'Idps Only',
+ ),
+
// Error messages
'er.federationsource.notfound.entityid' => 'entityID not found in metadata response',
// Plugin texts
'pl.federationsource.count' => 'Populated %1$s records from all IdPs endpoint',
'pl.federationsource.entityid' => 'Entity ID',
- 'pl.federationsource.protocol' => 'Protocol'
+ 'pl.federationsource.protocol' => 'Protocol',
+ 'pl.federationsource.entities' => 'Entities Filtering'
);
diff --git a/app/AvailablePlugin/FederationSource/Model/FederationSource.php b/app/AvailablePlugin/FederationSource/Model/FederationSource.php
index 77b5fdd2c..7495baa8f 100644
--- a/app/AvailablePlugin/FederationSource/Model/FederationSource.php
+++ b/app/AvailablePlugin/FederationSource/Model/FederationSource.php
@@ -63,6 +63,12 @@ class FederationSource extends OrganizationSourceBackend {
MetadataProtocol::MDQ)),
'required' => true,
'allowEmpty' => false
+ ),
+ 'entities' => array(
+ 'rule' => array('inList',
+ array(MdqProtocol::IdpsOnly)),
+ 'required' => false,
+ 'allowEmpty' => true
)
);
@@ -107,22 +113,23 @@ protected function doRequest($entityID=null) {
$Http->setBaseUrl($srvr['HttpServer']['serverurl']);
- if($cfg['FederationSource']['protocol'] == MetadataProtocol::MDQ) {
+ $url = '';
+ if($cfg['FederationSource']['protocol'] === MetadataProtocol::MDQ) {
$Http->setRequestOptions(array(
'header' => array(
'Content-Type' => 'application/samlmetadata+xml'
)
));
- $url = "/entities/";
+ // CO-2883
+ // https://datatracker.ietf.org/doc/html/draft-young-md-query-22#name-request-all-entities
+ $url = '/entities';
if($entityID) {
- $url .= urlencode($entityID);
- } else {
- $url .= "idps/all";
+ $url .= '/' . urlencode($entityID);
+ } elseif($cfg['FederationSource']['entities'] === MdqProtocol::IdpsOnly) {
+ $url .= '/idps/all';
}
- } else {
- $url = "";
}
return $Http->get($url);
diff --git a/app/AvailablePlugin/FederationSource/View/FederationSources/fields.inc b/app/AvailablePlugin/FederationSource/View/FederationSources/fields.inc
index a0d711009..258830180 100644
--- a/app/AvailablePlugin/FederationSource/View/FederationSources/fields.inc
+++ b/app/AvailablePlugin/FederationSource/View/FederationSources/fields.inc
@@ -59,6 +59,18 @@
print $this->Form->hidden('organization_source_id', array('default' => $vv_osid)) . "\n";
?>
+
+
info
@@ -110,8 +122,9 @@
global $cm_lang, $cm_texts;
$attrs = array();
- $attrs['value'] = (isset($federation_sources[0]['FederationSource']['protocol']) ? $federation_sources[0]['FederationSource']['protocol'] : "");
+ $attrs['value'] = ($federation_sources[0]['FederationSource']['protocol'] ?? '');
$attrs['empty'] = true;
+ $attrs['onchange'] = 'fields_update_entities(this)';
if($e) {
print $this->Form->select('protocol',
@@ -127,6 +140,36 @@
?>
+
+
+
+
+ Form->label('entities', _txt('pl.federationsource.entities')) : _txt('pl.federationsource.entities')); ?>
+
+
+
+ Form->select('entities',
+ $cm_texts[ $cm_lang ]['pl.federationsource.en.entities'],
+ $attrs);
+
+ if($this->Form->isFieldError('entities')) {
+ print $this->Form->error('entities');
+ }
+ } else {
+ print _txt('pl.federationsource.en.entities', null, filter_var($federation_sources[0]['FederationSource']['entities'],FILTER_SANITIZE_SPECIAL_CHARS));
+ }
+ ?>
+
+
+