@opengovsg/mockpass 2.7.11 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.js +3 -1
- package/lib/express/oidc.js +1 -1
- package/lib/express/saml.js +1 -1
- package/lib/express/sgid.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ $ export MOCKPASS_PORT=5156
|
|
|
59
59
|
$ export MOCKPASS_NRIC=S8979373D
|
|
60
60
|
$ export MOCKPASS_UEN=123456789A
|
|
61
61
|
|
|
62
|
-
$ export SHOW_LOGIN_PAGE=true # Optional, defaults to `false`
|
|
62
|
+
$ export SHOW_LOGIN_PAGE=true # Optional, defaults to `false`; can be overridden per request using `X-Show-Login-Page` HTTP header
|
|
63
63
|
|
|
64
64
|
# Disable signing/encryption (Optional, by default `true`)
|
|
65
65
|
$ export SIGN_ASSERTION=false
|
package/index.js
CHANGED
|
@@ -61,7 +61,9 @@ const options = {
|
|
|
61
61
|
assertEndpoint: process.env.CORPPASS_ASSERT_ENDPOINT,
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
|
-
showLoginPage:
|
|
64
|
+
showLoginPage: (req) => {
|
|
65
|
+
return process.env.SHOW_LOGIN_PAGE === 'true' || req.header('X-Show-Login-Page') === 'true'
|
|
66
|
+
},
|
|
65
67
|
encryptMyInfo: process.env.ENCRYPT_MYINFO === 'true',
|
|
66
68
|
cryptoConfig,
|
|
67
69
|
}
|
package/lib/express/oidc.js
CHANGED
|
@@ -30,7 +30,7 @@ function config(app, { showLoginPage, idpConfig, serviceProvider }) {
|
|
|
30
30
|
app.get(`/${idp.toLowerCase()}/authorize`, (req, res) => {
|
|
31
31
|
const redirectURI = req.query.redirect_uri
|
|
32
32
|
const state = encodeURIComponent(req.query.state)
|
|
33
|
-
if (showLoginPage) {
|
|
33
|
+
if (showLoginPage(req)) {
|
|
34
34
|
const oidc = assertions.oidc[idp]
|
|
35
35
|
const values = oidc.map((rawId, index) => {
|
|
36
36
|
const code = encodeURIComponent(
|
package/lib/express/saml.js
CHANGED
|
@@ -45,7 +45,7 @@ function config(
|
|
|
45
45
|
: idpConfig[idp].assertEndpoint || req.query.PartnerId
|
|
46
46
|
const relayState = req.query.Target
|
|
47
47
|
const partnerId = idpConfig[idp].id
|
|
48
|
-
if (showLoginPage) {
|
|
48
|
+
if (showLoginPage(req)) {
|
|
49
49
|
const saml = assertions.saml[idp]
|
|
50
50
|
const values = saml.map((rawId, index) => {
|
|
51
51
|
const samlArt = encodeURIComponent(samlArtifact(partnerId, index))
|
package/lib/express/sgid.js
CHANGED
|
@@ -30,7 +30,7 @@ function config(app, { showLoginPage, idpConfig, serviceProvider }) {
|
|
|
30
30
|
app.get(`${PATH_PREFIX}/authorize`, (req, res) => {
|
|
31
31
|
const redirectURI = req.query.redirect_uri
|
|
32
32
|
const state = encodeURIComponent(req.query.state)
|
|
33
|
-
if (showLoginPage) {
|
|
33
|
+
if (showLoginPage(req)) {
|
|
34
34
|
const oidc = assertions.oidc.singPass
|
|
35
35
|
const values = oidc
|
|
36
36
|
.filter((rawId) => assertions.myinfo.v3.personas[rawId])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengovsg/mockpass",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "A mock SingPass/CorpPass server for dev purposes",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@xmldom/xmldom": "^0.8.0",
|
|
40
40
|
"base-64": "^1.0.0",
|
|
41
41
|
"cookie-parser": "^1.4.3",
|
|
42
|
-
"dotenv": "^
|
|
42
|
+
"dotenv": "^16.0.0",
|
|
43
43
|
"expiry-map": "^1.1.0",
|
|
44
44
|
"express": "^4.16.3",
|
|
45
45
|
"jsonwebtoken": "^8.4.0",
|