Skip to content

Commit

Permalink
feat(sgid): add /.well-known/openid-configuration (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneRifle authored Apr 28, 2023
1 parent 0640cd4 commit 9842d95
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions lib/express/sgid.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,40 @@ function config(app, { showLoginPage, serviceProvider }) {
jwk.use = 'sig'
res.json({ keys: [jwk] })
})

app.get('/.well-known/openid-configuration', async (req, res) => {
const issuer = `${req.protocol}://${req.get('host')}`

res.json({
issuer,
authorization_endpoint: `${issuer}/${PATH_PREFIX}/authorize`,
token_endpoint: `${issuer}/${PATH_PREFIX}/token`,
userinfo_endpoint: `${issuer}/${PATH_PREFIX}/userinfo`,
jwks_uri: `${issuer}/.well-known/jwks.json`,
response_types_supported: ['code'],
grant_types_supported: ['authorization_code'],
scopes_supported: [
'openid',
'myinfo.nric_number',
'myinfo.name',
'myinfo.email',
'myinfo.sex',
'myinfo.race',
'myinfo.mobile_number',
'myinfo.registered_address',
'myinfo.date_of_birth',
'myinfo.passport_number',
'myinfo.passport_expiry_date',
'myinfo.nationality',
'myinfo.residentialstatus',
'myinfo.residential',
'myinfo.housingtype',
'myinfo.hdbtype',
],
id_token_signing_alg_values_supported: ['RS256'],
subject_types_supported: ['pairwise'],
})
})
}

module.exports = config

0 comments on commit 9842d95

Please sign in to comment.