diff --git a/lib/assertions.js b/lib/assertions.js index bca3816..1ad5385 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -8,6 +8,8 @@ const readFrom = p => fs.readFileSync(path.resolve(__dirname, p), 'utf8') const TEMPLATE = readFrom('../static/saml/unsigned-assertion.xml') const corpPassTemplate = readFrom('../static/saml/corppass.xml') +const MYINFO = JSON.parse(readFrom('../static/myinfo.json')) + const identities = { singPass: [ 'S8979373D', @@ -45,6 +47,7 @@ const identities = { 'F1612358R', 'F1612354N', 'F1612357U', + ...Object.keys(MYINFO), ], corpPass: [ { NRIC: 'S8979373D', UEN: '123456789A' }, @@ -75,4 +78,5 @@ module.exports = { create: makeCorpPass, }, identities, + MYINFO, } diff --git a/lib/express.js b/lib/express.js index 20d5ecf..10c228b 100644 --- a/lib/express.js +++ b/lib/express.js @@ -80,6 +80,11 @@ function config (app, { showLoginPage, serviceProvider, idpConfig }) { } ) } + + app.get('/myinfo/person-basic/:uinfin/', (req, res) => { + res.send(assertions.MYINFO[req.params.uinfin]) + }) + return app }