From 5af8cc09f7eb3c03cc3e8de902e0ee45c5e2cea1 Mon Sep 17 00:00:00 2001 From: nunzionapoli Date: Fri, 20 May 2022 19:13:06 +0200 Subject: [PATCH] feat: aggiunta profili aggregatori servizi privati --- spid-validator/server/api/metadata-sp.js | 2 ++ spid-validator/server/lib/saml-utils.js | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/spid-validator/server/api/metadata-sp.js b/spid-validator/server/api/metadata-sp.js index 37baac7..352f46b 100644 --- a/spid-validator/server/api/metadata-sp.js +++ b/spid-validator/server/api/metadata-sp.js @@ -257,6 +257,8 @@ module.exports = function(app, checkAuthorisation, getEntityDir, database) { if(metadataParser.isMetadataForAgPublicLite()) profile = "spid-sp-ag-public-lite"; if(metadataParser.isMetadataForOpPublicFull()) profile = "spid-sp-op-public-full"; if(metadataParser.isMetadataForOpPublicLite()) profile = "spid-sp-op-public-lite"; + if(metadataParser.isMetadataForAgPrivateFull()) profile = "spid-sp-ag-private-full"; + if(metadataParser.isMetadataForAgPrivateLite()) profile = "spid-sp-ag-private-lite"; switch(cmd) { case "strict": file = getEntityDir(entity_id) + "/sp-metadata-strict.json"; break; diff --git a/spid-validator/server/lib/saml-utils.js b/spid-validator/server/lib/saml-utils.js index 17762df..46aa320 100644 --- a/spid-validator/server/lib/saml-utils.js +++ b/spid-validator/server/lib/saml-utils.js @@ -402,7 +402,7 @@ class MetadataParser { isMetadataForAggregated() { let contactPerson = this.getSPIDContactPerson(); - let assertLength = (contactPerson.length==2); + // let assertLength = (contactPerson.length==2); !!!non valido per gli aggregatori privati let assertAggregator = false; let assertAggregated = false; @@ -411,7 +411,8 @@ class MetadataParser { assertAggregated = assertAggregated || (contactPerson[n].entityType=="spid:aggregated"); } - return assertLength && assertAggregator && assertAggregated; +// return assertLength && assertAggregator && assertAggregated; + return assertAggregator && assertAggregated; } isMetadataForOperator() { @@ -460,6 +461,19 @@ class MetadataParser { return this.isMetadataForOperator() && checkActivityCode; } + isMetadataForAgPrivateFull() { + let entityId = this.getServiceProviderEntityId(); + let checkActivityCode = entityId.indexOf('pri-ag-full') > -1; + return this.isMetadataForAggregated() && checkActivityCode; + } + + isMetadataForAgPrivateLite() { + let entityId = this.getServiceProviderEntityId(); + let checkActivityCode = entityId.indexOf('pri-ag-lite') > -1; + return this.isMetadataForAggregated() && checkActivityCode; + } + + }