mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
91c4cf16cc
GitOrigin-RevId: 4cb1d7f6e5636bbed77c4279d7d7704ab9b9ab77
42 lines
1 KiB
JavaScript
42 lines
1 KiB
JavaScript
'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 = '${samlConfig.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 =
|
|
`)
|
|
}
|