Skip to content

Commit

Permalink
Stubplement person-basic endpoint
Browse files Browse the repository at this point in the history
* Add the test MyInfo personas to the assertions module
* Expose `/myinfo/person-basic/:uinfin/`, which looks up the identifier
  amongst the known personas and returns the corresponding MyInfo

TODO:
* person endpoint
* limiting what is returned to only requested attributes
* TUO authn/authz
  • Loading branch information
LoneRifle committed Jan 8, 2019
1 parent 032b533 commit b441e77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -45,6 +47,7 @@ const identities = {
'F1612358R',
'F1612354N',
'F1612357U',
...Object.keys(MYINFO),
],
corpPass: [
{ NRIC: 'S8979373D', UEN: '123456789A' },
Expand Down Expand Up @@ -75,4 +78,5 @@ module.exports = {
create: makeCorpPass,
},
identities,
MYINFO,
}
5 changes: 5 additions & 0 deletions lib/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit b441e77

Please sign in to comment.