@opengovsg/mockpass 3.0.0 → 3.0.1
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 +6 -15
- package/index.js +0 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,22 +18,18 @@ A mock SingPass/CorpPass/MyInfo server for dev purposes
|
|
|
18
18
|
Configure your application to point to the following endpoints:
|
|
19
19
|
|
|
20
20
|
SingPass:
|
|
21
|
-
- http://localhost:5156/singpass/logininitial - SAML login redirect with optional page
|
|
22
|
-
- http://localhost:5156/singpass/soap - receives SAML artifact and returns assertion
|
|
23
21
|
- http://localhost:5156/singpass/authorize - OIDC login redirect with optional page
|
|
24
22
|
- http://localhost:5156/singpass/token - receives OIDC authorization code and returns id_token
|
|
25
23
|
|
|
26
24
|
CorpPass:
|
|
27
|
-
- http://localhost:5156/corppass/logininitial
|
|
28
|
-
- http://localhost:5156/corppass/soap
|
|
29
25
|
- http://localhost:5156/corppass/authorize - OIDC login redirect with optional page
|
|
30
26
|
- http://localhost:5156/corppass/token - receives OIDC authorization code and returns id_token
|
|
31
27
|
|
|
32
28
|
MyInfo:
|
|
33
|
-
- http://localhost:5156/myinfo/
|
|
34
|
-
- http://localhost:5156/myinfo/
|
|
35
|
-
- http://localhost:5156/myinfo/
|
|
36
|
-
- http://localhost:5156/myinfo/
|
|
29
|
+
- http://localhost:5156/myinfo/v3/person-basic (exclusive to government systems)
|
|
30
|
+
- http://localhost:5156/myinfo/v3/authorise
|
|
31
|
+
- http://localhost:5156/myinfo/v3/token
|
|
32
|
+
- http://localhost:5156/myinfo/v3/person
|
|
37
33
|
|
|
38
34
|
sgID:
|
|
39
35
|
- http://localhost:5156/sgid/v1/oauth/authorize
|
|
@@ -49,11 +45,6 @@ Alternatively, provide the paths to your app cert as env vars
|
|
|
49
45
|
```
|
|
50
46
|
$ npm install @opengovsg/mockpass
|
|
51
47
|
|
|
52
|
-
# Some familiarity with SAML Artifact Binding is assumed
|
|
53
|
-
# Optional: Configure where MockPass should send SAML artifact to, default endpoint will be `PartnerId` in request query parameter.
|
|
54
|
-
$ export SINGPASS_ASSERT_ENDPOINT=http://localhost:5000/singpass/assert
|
|
55
|
-
$ export CORPPASS_ASSERT_ENDPOINT=http://localhost:5000/corppass/assert
|
|
56
|
-
|
|
57
48
|
# All values shown here are defaults
|
|
58
49
|
$ export MOCKPASS_PORT=5156
|
|
59
50
|
|
|
@@ -69,7 +60,7 @@ $ export ENCRYPT_ASSERTION=false
|
|
|
69
60
|
$ export SIGN_RESPONSE=false
|
|
70
61
|
$ export RESOLVE_ARTIFACT_REQUEST_SIGNED=false
|
|
71
62
|
|
|
72
|
-
# Encrypt payloads returned by /myinfo
|
|
63
|
+
# Encrypt payloads returned by /myinfo/v3/{person, person-basic},
|
|
73
64
|
# equivalent to MyInfo Auth Level L2 (testing and production)
|
|
74
65
|
$ export ENCRYPT_MYINFO=false
|
|
75
66
|
|
|
@@ -89,7 +80,7 @@ who then need to connect to the staging servers hosted by SingPass/CorpPass,
|
|
|
89
80
|
which may not always be available (eg, down for maintenance, or no Internet).
|
|
90
81
|
|
|
91
82
|
MockPass tries to solves this by providing an extremely lightweight implementation
|
|
92
|
-
of
|
|
83
|
+
of an OIDC Provider that returns mock SingPass and CorpPass assertions.
|
|
93
84
|
It optionally provides a mock login page that (badly) mimics the SingPass/CorpPass
|
|
94
85
|
login experience.
|
|
95
86
|
|
package/index.js
CHANGED
|
@@ -9,16 +9,6 @@ const { configOIDC, configMyInfo, configSGID } = require('./lib/express')
|
|
|
9
9
|
|
|
10
10
|
const PORT = process.env.MOCKPASS_PORT || process.env.PORT || 5156
|
|
11
11
|
|
|
12
|
-
if (
|
|
13
|
-
!process.env.SINGPASS_ASSERT_ENDPOINT &&
|
|
14
|
-
!process.env.CORPPASS_ASSERT_ENDPOINT
|
|
15
|
-
) {
|
|
16
|
-
console.warn(
|
|
17
|
-
'SINGPASS_ASSERT_ENDPOINT or CORPPASS_ASSERT_ENDPOINT is not set. ' +
|
|
18
|
-
'Value of `PartnerId` request query parameter in redirect URL will be used.',
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
12
|
const serviceProvider = {
|
|
23
13
|
cert: fs.readFileSync(
|
|
24
14
|
path.resolve(
|