mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #2368 from overleaf/ew-ukamf-metadata-processor-cli
ukamf metadata processor cli GitOrigin-RevId: f823a1dca231546f3ab67c47f6443e56b50e30d1
This commit is contained in:
committed by
sharelatex
parent
1c0dc0a13f
commit
df6d0625f1
@@ -0,0 +1,42 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Run with: node metadata-processor /path/ukamf.xml http://idp/entity/id
|
||||
*
|
||||
* The ukamf metadata xml file can be downloaded from:
|
||||
* http://metadata.ukfederation.org.uk/
|
||||
*
|
||||
* The entity id should be provided by the university.
|
||||
*/
|
||||
|
||||
const UKAMFDB = require('./ukamf-db')
|
||||
|
||||
main().catch(err => {
|
||||
console.error(err.stack)
|
||||
})
|
||||
|
||||
async function main() {
|
||||
const [, , file, entityId] = process.argv
|
||||
|
||||
console.log(`loading file ${file}`)
|
||||
|
||||
const ukamfDB = new UKAMFDB(file)
|
||||
await ukamfDB.init()
|
||||
|
||||
const entity = ukamfDB.findByEntityID(entityId)
|
||||
if (!entity) {
|
||||
throw new Error(`could not find entity for ${entityId}`)
|
||||
}
|
||||
const samlConfig = entity.getSamlConfig()
|
||||
|
||||
console.log(`UPDATE universities SET
|
||||
sso_entity_id = '${entityId}',
|
||||
sso_entry_point = '${samlConfig.entryPoint}',
|
||||
sso_cert = '${samlConfig.cert}',
|
||||
sso_user_id_attribute = 'eduPersonPrincipalName',
|
||||
sso_user_email_attribute = 'mail',
|
||||
sso_license_entitlement_attribute = 'eduPersonPrincipalName',
|
||||
sso_license_entitlement_matcher = '.'
|
||||
WHERE id =
|
||||
`)
|
||||
}
|
||||
Reference in New Issue
Block a user