Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: include more test accounts for sfa in assertions.js #683

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const oidc = {
{ nric: 'F1612358R', uuid: '45669f5c-e9ac-43c6-bcd2-9c3757f1fa1c' },
{ nric: 'F1612354N', uuid: 'c38ddb2d-9e5d-45c2-bb70-8ccb54fc8320' },
{ nric: 'F1612357U', uuid: 'f904a2b1-4b61-47e2-bdad-e2d606325e20' },
{ nric: 'Y4581892I', uuid: 'acf8edda-bfdf-45fc-b140-a6ec6955d857' },
{ nric: 'Y7654321K', uuid: '9916f054-488e-4894-8299-412e46d89e67' },
{ nric: 'Y1234567P', uuid: '0fdcc18f-840b-4b35-80ee-44094a6cc66f' },
...Object.keys(myinfo.v3.personas).map((nric) => ({
nric,
uuid: myinfo.v3.personas[nric].uuid.value,
Expand Down Expand Up @@ -136,8 +139,16 @@ const oidc = {
accessToken = crypto.randomBytes(15).toString('hex'),
) => {
let sub
const sfa = {
Y4581892I: { fid: 'G730Z-H5P96', coi: 'DE', RP: 'CORPPASS' },
Y7654321K: { fid: '123456789', coi: 'CN', RP: 'IRAS' },
Y1234567P: { fid: 'G730Z-H5P96', coi: 'MY', RP: 'CORPPASS' },
}
if (nric.startsWith('Y')) {
sub = `s=${nric},fid='G730Z-H5P96',coi='DE',u=${uuid}`
const sfaAccount = sfa[nric]
? sfa[nric]
: { fid: 'G730Z-H5P96', coi: 'DE', RP: 'CORPPASS' }
sub = `s=${nric},fid=${sfaAccount.fid},coi=${sfaAccount.coi},u=${uuid}`
} else {
sub = `s=${nric},u=${uuid}`
}
Expand Down
Loading