From 91c4cf16ccb7bd7c5813a3e4b4cd08ea31f3eab3 Mon Sep 17 00:00:00 2001 From: Ersun Warncke Date: Wed, 27 Nov 2019 11:05:26 -0400 Subject: [PATCH] extract correct entity id for ukamf metadata GitOrigin-RevId: 4cb1d7f6e5636bbed77c4279d7d7704ab9b9ab77 --- services/web/scripts/ukamf/metadata-processor.js | 2 +- services/web/scripts/ukamf/ukamf-db.js | 2 +- services/web/scripts/ukamf/ukamf-entity.js | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/services/web/scripts/ukamf/metadata-processor.js b/services/web/scripts/ukamf/metadata-processor.js index f657a66be3..60c308756e 100644 --- a/services/web/scripts/ukamf/metadata-processor.js +++ b/services/web/scripts/ukamf/metadata-processor.js @@ -30,7 +30,7 @@ async function main() { const samlConfig = entity.getSamlConfig() console.log(`UPDATE universities SET - sso_entity_id = '${entityId}', + sso_entity_id = '${samlConfig.entityId}', sso_entry_point = '${samlConfig.entryPoint}', sso_cert = '${samlConfig.cert}', sso_user_id_attribute = 'eduPersonPrincipalName', diff --git a/services/web/scripts/ukamf/ukamf-db.js b/services/web/scripts/ukamf/ukamf-db.js index bfca7b1e47..cde8d16860 100644 --- a/services/web/scripts/ukamf/ukamf-db.js +++ b/services/web/scripts/ukamf/ukamf-db.js @@ -22,7 +22,7 @@ class UKAMFDB { const entity = this.entities.find( matcher instanceof RegExp ? e => e.$.entityID.match(matcher) - : e => e.$.entityID === matcher + : e => e.$.entityID.includes(matcher) ) return entity ? new UKAMFEntity(entity) : null } diff --git a/services/web/scripts/ukamf/ukamf-entity.js b/services/web/scripts/ukamf/ukamf-entity.js index 6a8f8a133f..80a7288fd8 100644 --- a/services/web/scripts/ukamf/ukamf-entity.js +++ b/services/web/scripts/ukamf/ukamf-entity.js @@ -11,6 +11,7 @@ class UKAMFEntity { const idp = this.data.IDPSSODescriptor[0] const keys = idp.KeyDescriptor const signingKey = keys.find(key => _.get(key, ['$', 'use']) === 'signing') + const entityId = this.data.$.entityID let cert = _.get(signingKey, [ 'ds:KeyInfo', @@ -37,6 +38,7 @@ class UKAMFEntity { return { cert, + entityId, entryPoint } }