@villedemontreal/jwt-validator 5.10.2 → 5.10.4

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.
Files changed (93) hide show
  1. package/dist/src/config/configs.d.ts +1 -0
  2. package/dist/src/config/configs.d.ts.map +1 -0
  3. package/dist/src/config/constants.d.ts +1 -0
  4. package/dist/src/config/constants.d.ts.map +1 -0
  5. package/dist/src/config/init.d.ts +1 -0
  6. package/dist/src/config/init.d.ts.map +1 -0
  7. package/dist/src/config/tokenTransformationMiddlewareConfig.d.ts +1 -0
  8. package/dist/src/config/tokenTransformationMiddlewareConfig.d.ts.map +1 -0
  9. package/dist/src/index.d.ts +1 -0
  10. package/dist/src/index.d.ts.map +1 -0
  11. package/dist/src/jwtValidator.d.ts +1 -0
  12. package/dist/src/jwtValidator.d.ts.map +1 -0
  13. package/dist/src/jwtValidator.test.d.ts +1 -0
  14. package/dist/src/jwtValidator.test.d.ts.map +1 -0
  15. package/dist/src/middleware/jwtMiddleware.d.ts +1 -0
  16. package/dist/src/middleware/jwtMiddleware.d.ts.map +1 -0
  17. package/dist/src/middleware/jwtMiddleware.test.d.ts +1 -0
  18. package/dist/src/middleware/jwtMiddleware.test.d.ts.map +1 -0
  19. package/dist/src/middleware/tokenTransformationMiddleware.d.ts +1 -0
  20. package/dist/src/middleware/tokenTransformationMiddleware.d.ts.map +1 -0
  21. package/dist/src/models/accessToken.d.ts +1 -0
  22. package/dist/src/models/accessToken.d.ts.map +1 -0
  23. package/dist/src/models/customError.d.ts +1 -0
  24. package/dist/src/models/customError.d.ts.map +1 -0
  25. package/dist/src/models/expressRequest.d.ts +1 -0
  26. package/dist/src/models/expressRequest.d.ts.map +1 -0
  27. package/dist/src/models/gluuUserType.d.ts +1 -0
  28. package/dist/src/models/gluuUserType.d.ts.map +1 -0
  29. package/dist/src/models/identities.d.ts +12 -7
  30. package/dist/src/models/identities.d.ts.map +1 -0
  31. package/dist/src/models/jwtPayload.d.ts +1 -0
  32. package/dist/src/models/jwtPayload.d.ts.map +1 -0
  33. package/dist/src/models/pagination.d.ts +1 -0
  34. package/dist/src/models/pagination.d.ts.map +1 -0
  35. package/dist/src/models/publicKey.d.ts +1 -0
  36. package/dist/src/models/publicKey.d.ts.map +1 -0
  37. package/dist/src/repositories/cachedPublicKeyRepository.d.ts +1 -0
  38. package/dist/src/repositories/cachedPublicKeyRepository.d.ts.map +1 -0
  39. package/dist/src/repositories/publicKeyRepository.d.ts +1 -0
  40. package/dist/src/repositories/publicKeyRepository.d.ts.map +1 -0
  41. package/dist/src/userValidator.d.ts +1 -0
  42. package/dist/src/userValidator.d.ts.map +1 -0
  43. package/dist/src/userValidator.test.d.ts +1 -0
  44. package/dist/src/userValidator.test.d.ts.map +1 -0
  45. package/dist/src/utils/createIdentityFromJwt.d.ts +1 -0
  46. package/dist/src/utils/createIdentityFromJwt.d.ts.map +1 -0
  47. package/dist/src/utils/createIdentityFromJwt.js +11 -0
  48. package/dist/src/utils/createIdentityFromJwt.js.map +1 -1
  49. package/dist/src/utils/createIdentityFromJwt.test.d.ts +1 -0
  50. package/dist/src/utils/createIdentityFromJwt.test.d.ts.map +1 -0
  51. package/dist/src/utils/createIdentityFromJwt.test.js +28 -1
  52. package/dist/src/utils/createIdentityFromJwt.test.js.map +1 -1
  53. package/dist/src/utils/jwtMock.d.ts +1 -0
  54. package/dist/src/utils/jwtMock.d.ts.map +1 -0
  55. package/dist/src/utils/logger.d.ts +1 -0
  56. package/dist/src/utils/logger.d.ts.map +1 -0
  57. package/dist/src/utils/testingConfigurations.d.ts +1 -0
  58. package/dist/src/utils/testingConfigurations.d.ts.map +1 -0
  59. package/dist/tsconfig.tsbuildinfo +1 -0
  60. package/package.json +30 -34
  61. package/src/config/configs.ts +1 -1
  62. package/src/config/init.ts +1 -1
  63. package/src/jwtValidator.test.ts +3 -3
  64. package/src/middleware/jwtMiddleware.test.ts +3 -3
  65. package/src/middleware/jwtMiddleware.ts +1 -1
  66. package/src/middleware/tokenTransformationMiddleware.ts +2 -2
  67. package/src/models/customError.ts +1 -1
  68. package/src/models/identities.ts +12 -8
  69. package/src/repositories/cachedPublicKeyRepository.ts +1 -1
  70. package/src/repositories/publicKeyRepository.ts +2 -2
  71. package/src/utils/createIdentityFromJwt.test.ts +61 -34
  72. package/src/utils/createIdentityFromJwt.ts +18 -7
  73. package/dist/scripts/index.d.ts +0 -6
  74. package/dist/scripts/index.js +0 -16
  75. package/dist/scripts/index.js.map +0 -1
  76. package/dist/scripts/lint.d.ts +0 -6
  77. package/dist/scripts/lint.js +0 -18
  78. package/dist/scripts/lint.js.map +0 -1
  79. package/dist/scripts/lintFix.d.ts +0 -6
  80. package/dist/scripts/lintFix.js +0 -21
  81. package/dist/scripts/lintFix.js.map +0 -1
  82. package/dist/scripts/showCoverage.d.ts +0 -13
  83. package/dist/scripts/showCoverage.js +0 -40
  84. package/dist/scripts/showCoverage.js.map +0 -1
  85. package/dist/scripts/test.d.ts +0 -13
  86. package/dist/scripts/test.js +0 -29
  87. package/dist/scripts/test.js.map +0 -1
  88. package/dist/scripts/testUnits.d.ts +0 -15
  89. package/dist/scripts/testUnits.js +0 -95
  90. package/dist/scripts/testUnits.js.map +0 -1
  91. package/dist/scripts/watch.d.ts +0 -14
  92. package/dist/scripts/watch.js +0 -96
  93. package/dist/scripts/watch.js.map +0 -1
@@ -31,10 +31,10 @@ describe('createIdentityFromJwt', () => {
31
31
  // console.log(identity);
32
32
 
33
33
  expect(identity.toString()).to.equal(
34
- 'user:employee:udoejo3:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm'
34
+ 'user:employee:udoejo3:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm',
35
35
  );
36
36
  expect(`${identity}`).to.equal(
37
- 'user:employee:udoejo3:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm'
37
+ 'user:employee:udoejo3:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm',
38
38
  );
39
39
  if (identity.type === 'user') {
40
40
  // we test that the registration is optional when you don't know the type of user
@@ -73,6 +73,7 @@ describe('createIdentityFromJwt', () => {
73
73
  accessTokenIssuer:
74
74
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
75
75
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
76
+ audDisplayName: 'infra-auth-auth-playground-dev',
76
77
  env: 'dev',
77
78
  realm: 'employees',
78
79
  claim: 'userName',
@@ -81,7 +82,7 @@ describe('createIdentityFromJwt', () => {
81
82
  });
82
83
  // console.log(JSON.stringify(identity));
83
84
  expect(JSON.stringify(identity)).to.eql(
84
- `{"type":"user","id":"udoejo3","displayName":"John DOE","attributes":{"type":"employee","email":"john.doe@montreal.ca","username":"udoejo3","registrationNumber":"100674051","department":"421408000000","firstName":"John","lastName":"DOE","accountProfile":"vdm","isGeneric":false},"source":{"aud":"e5dd632b-cb97-48d7-a310-5147be717cde","issuer":"security-identity-token-api","accessTokenIssuer":"https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0","env":"dev","realm":"employees","claim":"userName","internalId":"0b64042a-9cce-42dc-b645-cd721cbbc179"}}`
85
+ `{"type":"user","id":"udoejo3","displayName":"John DOE","attributes":{"type":"employee","email":"john.doe@montreal.ca","username":"udoejo3","registrationNumber":"100674051","department":"421408000000","firstName":"John","lastName":"DOE","accountProfile":"vdm","isGeneric":false},"source":{"aud":"e5dd632b-cb97-48d7-a310-5147be717cde","audDisplayName":"infra-auth-auth-playground-dev","issuer":"security-identity-token-api","accessTokenIssuer":"https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0","env":"dev","realm":"employees","claim":"userName","internalId":"0b64042a-9cce-42dc-b645-cd721cbbc179"}}`,
85
86
  );
86
87
  });
87
88
 
@@ -113,7 +114,7 @@ describe('createIdentityFromJwt', () => {
113
114
  // console.log(identity);
114
115
 
115
116
  expect(identity.toString()).to.equal(
116
- 'user:employee:udoejo3:John DOE:john.doe@spvm.qc.ca:100674051:PDQ 11:spvm'
117
+ 'user:employee:udoejo3:John DOE:john.doe@spvm.qc.ca:100674051:PDQ 11:spvm',
117
118
  );
118
119
  delete identity.toString;
119
120
  expect(identity).to.eql({
@@ -136,6 +137,7 @@ describe('createIdentityFromJwt', () => {
136
137
  accessTokenIssuer:
137
138
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
138
139
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
140
+ audDisplayName: 'infra-auth-auth-playground-dev',
139
141
  env: 'dev',
140
142
  realm: 'employees',
141
143
  claim: 'userName',
@@ -173,7 +175,7 @@ describe('createIdentityFromJwt', () => {
173
175
  // console.log(identity);
174
176
 
175
177
  expect(identity.toString()).to.equal(
176
- 'user:employee:udoejo3:John DOE:john.doe.adm@lavilledemontreal.omnicrosoft.com:100674051:421408000000:vdm-admin'
178
+ 'user:employee:udoejo3:John DOE:john.doe.adm@lavilledemontreal.omnicrosoft.com:100674051:421408000000:vdm-admin',
177
179
  );
178
180
  delete identity.toString;
179
181
  expect(identity).to.eql({
@@ -196,6 +198,7 @@ describe('createIdentityFromJwt', () => {
196
198
  accessTokenIssuer:
197
199
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
198
200
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
201
+ audDisplayName: 'infra-auth-auth-playground-dev',
199
202
  env: 'dev',
200
203
  realm: 'employees',
201
204
  claim: 'userName',
@@ -232,7 +235,7 @@ describe('createIdentityFromJwt', () => {
232
235
  // console.log(identity);
233
236
 
234
237
  expect(identity.toString()).to.equal(
235
- 'user:employee:udoejo3:John DOE:john.doe.adm@montrealville.omnicrosoft.com:100674051:421408000000:vdm-admin'
238
+ 'user:employee:udoejo3:John DOE:john.doe.adm@montrealville.omnicrosoft.com:100674051:421408000000:vdm-admin',
236
239
  );
237
240
  delete identity.toString;
238
241
  expect(identity).to.eql({
@@ -255,6 +258,7 @@ describe('createIdentityFromJwt', () => {
255
258
  accessTokenIssuer:
256
259
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
257
260
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
261
+ audDisplayName: 'infra-auth-auth-playground-dev',
258
262
  env: 'dev',
259
263
  realm: 'employees',
260
264
  claim: 'userName',
@@ -289,7 +293,7 @@ describe('createIdentityFromJwt', () => {
289
293
  // console.log(identity);
290
294
 
291
295
  expect(identity.toString()).to.equal(
292
- 'user:external:xdoejo3:John DOE:john.doe@montreal.ca::vdm'
296
+ 'user:external:xdoejo3:John DOE:john.doe@montreal.ca::vdm',
293
297
  );
294
298
 
295
299
  delete identity.toString;
@@ -312,6 +316,7 @@ describe('createIdentityFromJwt', () => {
312
316
  accessTokenIssuer:
313
317
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
314
318
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
319
+ audDisplayName: 'infra-auth-auth-playground-dev',
315
320
  env: 'dev',
316
321
  realm: 'employees',
317
322
  claim: 'userName',
@@ -345,7 +350,7 @@ describe('createIdentityFromJwt', () => {
345
350
  // console.log(identity);
346
351
 
347
352
  expect(identity.toString()).to.equal(
348
- 'user:external:foobar:John DOE:john.doe.ext@montreal.ca::vdm'
353
+ 'user:external:foobar:John DOE:john.doe.ext@montreal.ca::vdm',
349
354
  );
350
355
 
351
356
  delete identity.toString;
@@ -368,6 +373,7 @@ describe('createIdentityFromJwt', () => {
368
373
  accessTokenIssuer:
369
374
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
370
375
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
376
+ audDisplayName: 'infra-auth-auth-playground-dev',
371
377
  env: 'dev',
372
378
  realm: 'employees',
373
379
  claim: 'userName',
@@ -401,7 +407,7 @@ describe('createIdentityFromJwt', () => {
401
407
  // console.log(identity);
402
408
 
403
409
  expect(identity.toString()).to.equal(
404
- 'user:generic:cgdsecdev2:C.Generique dsec developpeur2::4211:vdm'
410
+ 'user:generic:cgdsecdev2:C.Generique dsec developpeur2::4211:vdm',
405
411
  );
406
412
 
407
413
  delete identity.toString;
@@ -423,6 +429,7 @@ describe('createIdentityFromJwt', () => {
423
429
  accessTokenIssuer:
424
430
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
425
431
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
432
+ audDisplayName: 'infra-auth-auth-playground-dev',
426
433
  env: 'dev',
427
434
  realm: 'employees',
428
435
  claim: 'userName',
@@ -459,7 +466,7 @@ describe('createIdentityFromJwt', () => {
459
466
  // console.log(identity);
460
467
 
461
468
  expect(identity.toString()).to.equal(
462
- 'user:employee:umarba33:C.Generique dsec developpeur2:dsec.dev2.test@montreal.ca:000333:4211:vdm'
469
+ 'user:employee:umarba33:C.Generique dsec developpeur2:dsec.dev2.test@montreal.ca:000333:4211:vdm',
463
470
  );
464
471
 
465
472
  delete identity.toString;
@@ -483,6 +490,7 @@ describe('createIdentityFromJwt', () => {
483
490
  accessTokenIssuer:
484
491
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
485
492
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
493
+ audDisplayName: 'infra-auth-auth-playground-dev',
486
494
  env: 'dev',
487
495
  realm: 'employees',
488
496
  claim: 'userName',
@@ -518,7 +526,7 @@ describe('createIdentityFromJwt', () => {
518
526
  // console.log(identity);
519
527
 
520
528
  expect(identity.toString()).to.equal(
521
- 'user:external:xmarba33:C.Generique dsec developpeur2:dsec.dev2.test@montreal.ca:4211:vdm'
529
+ 'user:external:xmarba33:C.Generique dsec developpeur2:dsec.dev2.test@montreal.ca:4211:vdm',
522
530
  );
523
531
 
524
532
  delete identity.toString;
@@ -541,6 +549,7 @@ describe('createIdentityFromJwt', () => {
541
549
  accessTokenIssuer:
542
550
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
543
551
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
552
+ audDisplayName: 'infra-auth-auth-playground-dev',
544
553
  env: 'dev',
545
554
  realm: 'employees',
546
555
  claim: 'userName',
@@ -572,7 +581,7 @@ describe('createIdentityFromJwt', () => {
572
581
  // console.log(identity);
573
582
 
574
583
  expect(identity.toString()).to.equal(
575
- 'user:guest:employees:doe.daniel_hydro.qc.ca#EXT#@lavilledemontreal.omnicrosoft.com:doe.daniel@hydro.qc.ca:doe.daniel@hydro.qc.ca'
584
+ 'user:guest:employees:doe.daniel_hydro.qc.ca#EXT#@lavilledemontreal.omnicrosoft.com:doe.daniel@hydro.qc.ca:doe.daniel@hydro.qc.ca',
576
585
  );
577
586
 
578
587
  delete identity.toString;
@@ -594,6 +603,7 @@ describe('createIdentityFromJwt', () => {
594
603
  accessTokenIssuer:
595
604
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
596
605
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
606
+ audDisplayName: 'infra-auth-auth-playground-dev',
597
607
  env: 'dev',
598
608
  realm: 'employees',
599
609
  claim: 'userName',
@@ -639,6 +649,7 @@ describe('createIdentityFromJwt', () => {
639
649
  issuer: 'security-identity-token-api',
640
650
  accessTokenIssuer: 'security-identity-anonymous-token-api',
641
651
  aud: '@!4025.CA62.9BB6.16C5!0001!2212.0010!0008!2212.0010',
652
+ audDisplayName: 'Account Identity Managment',
642
653
  env: 'dev',
643
654
  realm: 'anonymous',
644
655
  claim: 'userName',
@@ -667,7 +678,7 @@ describe('createIdentityFromJwt', () => {
667
678
  // console.log(identity);
668
679
 
669
680
  expect(identity.toString()).to.equal(
670
- 'service-account:client:e5dd632b-cb97-48d7-a310-cde5147be717:infra-auth-auth-playground-dev'
681
+ 'service-account:client:e5dd632b-cb97-48d7-a310-cde5147be717:infra-auth-auth-playground-dev',
671
682
  );
672
683
 
673
684
  delete identity.toString;
@@ -683,6 +694,7 @@ describe('createIdentityFromJwt', () => {
683
694
  accessTokenIssuer:
684
695
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
685
696
  aud: 'e5dd632b-cb97-48d7-a310-cde5147be717',
697
+ audDisplayName: 'infra-auth-auth-playground-dev',
686
698
  env: 'dev',
687
699
  realm: 'employees',
688
700
  claim: 'aud',
@@ -714,7 +726,7 @@ describe('createIdentityFromJwt', () => {
714
726
  // console.log(identity);
715
727
 
716
728
  expect(identity.toString()).to.equal(
717
- 'service-account:user:srvAccDiagCanary:srvAcc Diagnostics Canary'
729
+ 'service-account:user:srvAccDiagCanary:srvAcc Diagnostics Canary',
718
730
  );
719
731
 
720
732
  delete identity.toString;
@@ -730,6 +742,7 @@ describe('createIdentityFromJwt', () => {
730
742
  issuer: 'security-identity-token-api',
731
743
  accessTokenIssuer: 'https://auth.dev.interne.montreal.ca',
732
744
  aud: '@!4025.CA62.9BB6.16C5!0001!2212.0010!0008!2212.0130',
745
+ audDisplayName: 'DiagnosticsCanary',
733
746
  env: 'dev',
734
747
  realm: 'citizens',
735
748
  claim: 'userName',
@@ -764,7 +777,7 @@ describe('createIdentityFromJwt', () => {
764
777
  // console.log(identity);
765
778
 
766
779
  expect(identity.toString()).to.equal(
767
- 'user:citizen:@!4025.CA62.9BB6.16C5!0001!2212.0010!0000!3F39.BEDB.4ADB.F74D:John Doe:john.doe@mailinator.com'
780
+ 'user:citizen:@!4025.CA62.9BB6.16C5!0001!2212.0010!0000!3F39.BEDB.4ADB.F74D:John Doe:john.doe@mailinator.com',
768
781
  );
769
782
 
770
783
  delete identity.toString;
@@ -784,6 +797,7 @@ describe('createIdentityFromJwt', () => {
784
797
  accessTokenIssuer:
785
798
  'https://connexion.dev.montreal.ca/1543b575-116b-4325-a0bf-3ccdd7925321/v2.0/',
786
799
  aud: 'a496befa-db7d-45a6-ac7a-11471816b8f1',
800
+ audDisplayName: 'infra-auth-auth-playground',
787
801
  env: 'dev',
788
802
  realm: 'citizens',
789
803
  claim: 'mtlIdentityId',
@@ -816,7 +830,7 @@ describe('createIdentityFromJwt', () => {
816
830
  // console.log(identity);
817
831
 
818
832
  expect(identity.toString()).to.equal(
819
- 'user:unknown:john.doe:John Doe:john.doe@mailinator.com:::vdm'
833
+ 'user:unknown:john.doe:John Doe:john.doe@mailinator.com:::vdm',
820
834
  );
821
835
 
822
836
  delete identity.toString;
@@ -839,6 +853,7 @@ describe('createIdentityFromJwt', () => {
839
853
  accessTokenIssuer:
840
854
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
841
855
  aud: 'a496befa-db7d-45a6-ac7a-11471816b8f1',
856
+ audDisplayName: 'infra-auth-auth-playground',
842
857
  env: 'dev',
843
858
  realm: 'employees',
844
859
  claim: 'userName',
@@ -881,6 +896,7 @@ describe('createIdentityFromJwt', () => {
881
896
  accessTokenIssuer:
882
897
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
883
898
  aud: 'a496befa-db7d-45a6-ac7a-11471816b8f1',
899
+ audDisplayName: 'infra-auth-auth-playground',
884
900
  env: 'dev',
885
901
  realm: 'employees',
886
902
  claim: 'sub',
@@ -923,6 +939,7 @@ describe('createIdentityFromJwt', () => {
923
939
  accessTokenIssuer:
924
940
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
925
941
  aud: 'a496befa-db7d-45a6-ac7a-11471816b8f1',
942
+ audDisplayName: 'infra-auth-auth-playground',
926
943
  env: 'dev',
927
944
  realm: 'employees',
928
945
  claim: 'sub',
@@ -960,7 +977,7 @@ describe('createIdentityFromJwt', () => {
960
977
  // console.log(identity);
961
978
 
962
979
  expect(identity.toString()).to.equal(
963
- 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca::421408000000:vdm'
980
+ 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca::421408000000:vdm',
964
981
  );
965
982
  delete identity.toString;
966
983
  expect(identity).to.eql({
@@ -982,6 +999,7 @@ describe('createIdentityFromJwt', () => {
982
999
  accessTokenIssuer:
983
1000
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
984
1001
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1002
+ audDisplayName: 'infra-auth-auth-playground-dev',
985
1003
  env: 'dev',
986
1004
  realm: 'employees',
987
1005
  claim: 'userName',
@@ -1019,7 +1037,7 @@ describe('createIdentityFromJwt', () => {
1019
1037
  // console.log(identity);
1020
1038
 
1021
1039
  expect(identity.toString()).to.equal(
1022
- 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca:100674051::vdm'
1040
+ 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca:100674051::vdm',
1023
1041
  );
1024
1042
  delete identity.toString;
1025
1043
  expect(identity).to.eql({
@@ -1041,6 +1059,7 @@ describe('createIdentityFromJwt', () => {
1041
1059
  accessTokenIssuer:
1042
1060
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1043
1061
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1062
+ audDisplayName: 'infra-auth-auth-playground-dev',
1044
1063
  env: 'dev',
1045
1064
  realm: 'employees',
1046
1065
  claim: 'userName',
@@ -1078,7 +1097,7 @@ describe('createIdentityFromJwt', () => {
1078
1097
  // console.log(identity);
1079
1098
 
1080
1099
  expect(identity.toString()).to.equal(
1081
- 'user:unknown:usr_foo33:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm'
1100
+ 'user:unknown:usr_foo33:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm',
1082
1101
  );
1083
1102
  delete identity.toString;
1084
1103
  expect(identity).to.eql({
@@ -1100,6 +1119,7 @@ describe('createIdentityFromJwt', () => {
1100
1119
  accessTokenIssuer:
1101
1120
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1102
1121
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1122
+ audDisplayName: 'infra-auth-auth-playground-dev',
1103
1123
  env: 'dev',
1104
1124
  realm: 'employees',
1105
1125
  claim: 'userName',
@@ -1136,7 +1156,7 @@ describe('createIdentityFromJwt', () => {
1136
1156
  // console.log(identity);
1137
1157
 
1138
1158
  expect(identity.toString()).to.equal(
1139
- 'user:unknown:john.doe@montreal.ca:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm'
1159
+ 'user:unknown:john.doe@montreal.ca:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm',
1140
1160
  );
1141
1161
  delete identity.toString;
1142
1162
  expect(identity).to.eql({
@@ -1158,6 +1178,7 @@ describe('createIdentityFromJwt', () => {
1158
1178
  accessTokenIssuer:
1159
1179
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1160
1180
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1181
+ audDisplayName: 'infra-auth-auth-playground-dev',
1161
1182
  env: 'dev',
1162
1183
  realm: 'employees',
1163
1184
  claim: 'email',
@@ -1194,7 +1215,7 @@ describe('createIdentityFromJwt', () => {
1194
1215
  // console.log(identity);
1195
1216
 
1196
1217
  expect(identity.toString()).to.equal(
1197
- 'user:unknown:udoejo3:john.doe@montreal.ca:john.doe@montreal.ca:100674051:421408000000:vdm'
1218
+ 'user:unknown:udoejo3:john.doe@montreal.ca:john.doe@montreal.ca:100674051:421408000000:vdm',
1198
1219
  );
1199
1220
  delete identity.toString;
1200
1221
  expect(identity).to.eql({
@@ -1216,6 +1237,7 @@ describe('createIdentityFromJwt', () => {
1216
1237
  accessTokenIssuer:
1217
1238
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1218
1239
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1240
+ audDisplayName: 'infra-auth-auth-playground-dev',
1219
1241
  env: 'dev',
1220
1242
  realm: 'employees',
1221
1243
  claim: 'userName',
@@ -1252,7 +1274,7 @@ describe('createIdentityFromJwt', () => {
1252
1274
  // console.log(identity);
1253
1275
 
1254
1276
  expect(identity.toString()).to.equal(
1255
- 'user:unknown:udoejo3:udoejo3::100674051:421408000000:vdm'
1277
+ 'user:unknown:udoejo3:udoejo3::100674051:421408000000:vdm',
1256
1278
  );
1257
1279
  delete identity.toString;
1258
1280
  expect(identity).to.eql({
@@ -1274,6 +1296,7 @@ describe('createIdentityFromJwt', () => {
1274
1296
  accessTokenIssuer:
1275
1297
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1276
1298
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1299
+ audDisplayName: 'infra-auth-auth-playground-dev',
1277
1300
  env: 'dev',
1278
1301
  realm: 'employees',
1279
1302
  claim: 'userName',
@@ -1310,7 +1333,7 @@ describe('createIdentityFromJwt', () => {
1310
1333
  // console.log(identity);
1311
1334
 
1312
1335
  expect(identity.toString()).to.equal(
1313
- 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm'
1336
+ 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm',
1314
1337
  );
1315
1338
  delete identity.toString;
1316
1339
  expect(identity).to.eql({
@@ -1332,6 +1355,7 @@ describe('createIdentityFromJwt', () => {
1332
1355
  accessTokenIssuer:
1333
1356
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1334
1357
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1358
+ audDisplayName: 'infra-auth-auth-playground-dev',
1335
1359
  env: 'dev',
1336
1360
  realm: 'employees',
1337
1361
  claim: 'userName',
@@ -1368,7 +1392,7 @@ describe('createIdentityFromJwt', () => {
1368
1392
  // console.log(identity);
1369
1393
 
1370
1394
  expect(identity.toString()).to.equal(
1371
- 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm'
1395
+ 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca:100674051:421408000000:vdm',
1372
1396
  );
1373
1397
  delete identity.toString;
1374
1398
  expect(identity).to.eql({
@@ -1390,6 +1414,7 @@ describe('createIdentityFromJwt', () => {
1390
1414
  accessTokenIssuer:
1391
1415
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1392
1416
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1417
+ audDisplayName: 'infra-auth-auth-playground-dev',
1393
1418
  env: 'dev',
1394
1419
  realm: 'employees',
1395
1420
  claim: 'userName',
@@ -1426,7 +1451,7 @@ describe('createIdentityFromJwt', () => {
1426
1451
  // console.log(identity);
1427
1452
 
1428
1453
  expect(identity.toString()).to.equal(
1429
- 'user:unknown:xdr_foo:John DOE:john.doe@montreal.ca:::vdm'
1454
+ 'user:unknown:xdr_foo:John DOE:john.doe@montreal.ca:::vdm',
1430
1455
  );
1431
1456
 
1432
1457
  delete identity.toString;
@@ -1449,6 +1474,7 @@ describe('createIdentityFromJwt', () => {
1449
1474
  accessTokenIssuer:
1450
1475
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1451
1476
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1477
+ audDisplayName: 'infra-auth-auth-playground-dev',
1452
1478
  env: 'dev',
1453
1479
  realm: 'employees',
1454
1480
  claim: 'userName',
@@ -1482,7 +1508,7 @@ describe('createIdentityFromJwt', () => {
1482
1508
  // console.log(identity);
1483
1509
 
1484
1510
  expect(identity.toString()).to.equal(
1485
- 'user:unknown:xdoejo3:john.doe@montreal.ca:john.doe@montreal.ca:::vdm'
1511
+ 'user:unknown:xdoejo3:john.doe@montreal.ca:john.doe@montreal.ca:::vdm',
1486
1512
  );
1487
1513
 
1488
1514
  delete identity.toString;
@@ -1505,6 +1531,7 @@ describe('createIdentityFromJwt', () => {
1505
1531
  accessTokenIssuer:
1506
1532
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1507
1533
  aud: 'e5dd632b-cb97-48d7-a310-5147be717cde',
1534
+ audDisplayName: 'infra-auth-auth-playground-dev',
1508
1535
  env: 'dev',
1509
1536
  realm: 'employees',
1510
1537
  claim: 'userName',
@@ -1540,7 +1567,7 @@ describe('createIdentityFromJwt', () => {
1540
1567
  email: 'john.doe@montreal.ca',
1541
1568
  };
1542
1569
  expect(() => createIdentityFromJwt(jwt)).throws(
1543
- 'expected to find the "sub" claim in the JWT'
1570
+ 'expected to find the "sub" claim in the JWT',
1544
1571
  );
1545
1572
  });
1546
1573
  it('optional string claim should be a string and not a number', () => {
@@ -1566,7 +1593,7 @@ describe('createIdentityFromJwt', () => {
1566
1593
  email: 'john.doe@montreal.ca',
1567
1594
  };
1568
1595
  expect(() => createIdentityFromJwt(jwt)).throws(
1569
- `claim 'oid' to contain a string but received: 1234`
1596
+ `claim 'oid' to contain a string but received: 1234`,
1570
1597
  );
1571
1598
  });
1572
1599
  it('external users should belong to the employees realm', () => {
@@ -1592,7 +1619,7 @@ describe('createIdentityFromJwt', () => {
1592
1619
  email: 'john.doe@montreal.ca',
1593
1620
  };
1594
1621
  expect(() => createIdentityFromJwt(jwt)).throws(
1595
- 'expected token to belong to the "employees" realm'
1622
+ 'expected token to belong to the "employees" realm',
1596
1623
  );
1597
1624
  });
1598
1625
  it('anonymous users should belong to the anonymous realm', () => {
@@ -1615,7 +1642,7 @@ describe('createIdentityFromJwt', () => {
1615
1642
  accessTokenIssuer: 'security-identity-anonymous-token-api',
1616
1643
  };
1617
1644
  expect(() => createIdentityFromJwt(jwt)).throws(
1618
- 'anonymous: expected token to belong to the "anonymous" realm'
1645
+ 'anonymous: expected token to belong to the "anonymous" realm',
1619
1646
  );
1620
1647
  });
1621
1648
  it('citizen users should belong to the citizens realm', () => {
@@ -1641,7 +1668,7 @@ describe('createIdentityFromJwt', () => {
1641
1668
  email: 'john.doe@mailinator.com',
1642
1669
  };
1643
1670
  expect(() => createIdentityFromJwt(jwt)).throws(
1644
- 'user:citizen: expected token to belong to the "citizens" realm'
1671
+ 'user:citizen: expected token to belong to the "citizens" realm',
1645
1672
  );
1646
1673
  });
1647
1674
  it('employee users should belong to the employees realm', () => {
@@ -1669,7 +1696,7 @@ describe('createIdentityFromJwt', () => {
1669
1696
  email: 'john.doe@montreal.ca',
1670
1697
  };
1671
1698
  expect(() => createIdentityFromJwt(jwt)).throws(
1672
- 'user:employee: expected token to belong to the "employees" realm'
1699
+ 'user:employee: expected token to belong to the "employees" realm',
1673
1700
  );
1674
1701
  });
1675
1702
  it('getStringClaim with identityType error', () => {
@@ -1692,7 +1719,7 @@ describe('createIdentityFromJwt', () => {
1692
1719
  accessTokenIssuer: 'security-identity-anonymous-token-api',
1693
1720
  };
1694
1721
  expect(() => createIdentityFromJwt(jwt)).throws(
1695
- 'anonymous: expected to find the "userName" claim in the JWT'
1722
+ 'anonymous: expected to find the "userName" claim in the JWT',
1696
1723
  );
1697
1724
  });
1698
1725
  it('getStringClaim with identityType and subType error', () => {
@@ -1712,7 +1739,7 @@ describe('createIdentityFromJwt', () => {
1712
1739
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1713
1740
  };
1714
1741
  expect(() => createIdentityFromJwt(jwt)).throws(
1715
- 'service-account: client: expected to find the "displayName" claim in the JWT'
1742
+ 'service-account: client: expected to find the "displayName" claim in the JWT',
1716
1743
  );
1717
1744
  });
1718
1745
  });
@@ -60,6 +60,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
60
60
  const realm = getStringClaim(jwt, 'realm');
61
61
  const aud = getStringClaim(jwt, 'aud');
62
62
  const sub = getStringClaim(jwt, 'sub');
63
+ const audDisplayName = getOptionalStringClaim(jwt, 'displayName');
63
64
  const oid = getOptionalStringClaim(jwt, 'oid');
64
65
  const env = getOptionalStringClaim(jwt, 'env');
65
66
  const userType = getOptionalStringClaim(jwt, 'userType') ?? 'citizen';
@@ -83,6 +84,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
83
84
  },
84
85
  source: {
85
86
  aud,
87
+ audDisplayName,
86
88
  issuer,
87
89
  accessTokenIssuer,
88
90
  env,
@@ -109,6 +111,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
109
111
  },
110
112
  source: {
111
113
  aud,
114
+ audDisplayName,
112
115
  issuer,
113
116
  accessTokenIssuer,
114
117
  env,
@@ -137,6 +140,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
137
140
  },
138
141
  source: {
139
142
  aud,
143
+ audDisplayName,
140
144
  issuer,
141
145
  accessTokenIssuer,
142
146
  env,
@@ -170,6 +174,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
170
174
  },
171
175
  source: {
172
176
  aud,
177
+ audDisplayName,
173
178
  issuer,
174
179
  accessTokenIssuer,
175
180
  env,
@@ -183,7 +188,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
183
188
  this.attributes.type,
184
189
  this.id,
185
190
  this.displayName,
186
- this.attributes.email
191
+ this.attributes.email,
187
192
  );
188
193
  },
189
194
  };
@@ -214,6 +219,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
214
219
  },
215
220
  source: {
216
221
  aud,
222
+ audDisplayName,
217
223
  issuer,
218
224
  accessTokenIssuer,
219
225
  env,
@@ -230,7 +236,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
230
236
  this.attributes.email,
231
237
  this.attributes.registrationNumber,
232
238
  this.attributes.department,
233
- this.attributes.accountProfile
239
+ this.attributes.accountProfile,
234
240
  );
235
241
  },
236
242
  };
@@ -260,6 +266,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
260
266
  },
261
267
  source: {
262
268
  aud,
269
+ audDisplayName,
263
270
  issuer,
264
271
  accessTokenIssuer,
265
272
  env,
@@ -275,7 +282,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
275
282
  this.displayName,
276
283
  this.attributes.email,
277
284
  this.attributes.department,
278
- this.attributes.accountProfile
285
+ this.attributes.accountProfile,
279
286
  );
280
287
  },
281
288
  };
@@ -301,6 +308,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
301
308
  },
302
309
  source: {
303
310
  aud,
311
+ audDisplayName,
304
312
  issuer,
305
313
  accessTokenIssuer,
306
314
  env,
@@ -315,7 +323,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
315
323
  realm,
316
324
  this.id,
317
325
  this.displayName,
318
- this.attributes.email
326
+ this.attributes.email,
319
327
  );
320
328
  },
321
329
  };
@@ -341,6 +349,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
341
349
  },
342
350
  source: {
343
351
  aud,
352
+ audDisplayName,
344
353
  issuer,
345
354
  accessTokenIssuer,
346
355
  env,
@@ -356,7 +365,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
356
365
  this.displayName,
357
366
  this.attributes.email,
358
367
  this.attributes.department,
359
- this.attributes.accountProfile
368
+ this.attributes.accountProfile,
360
369
  );
361
370
  },
362
371
  };
@@ -385,6 +394,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
385
394
  },
386
395
  source: {
387
396
  aud,
397
+ audDisplayName,
388
398
  issuer,
389
399
  accessTokenIssuer,
390
400
  env,
@@ -401,7 +411,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
401
411
  this.attributes.email,
402
412
  this.attributes.registrationNumber,
403
413
  this.attributes.department,
404
- this.attributes.accountProfile
414
+ this.attributes.accountProfile,
405
415
  );
406
416
  },
407
417
  };
@@ -417,6 +427,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
417
427
  },
418
428
  source: {
419
429
  aud,
430
+ audDisplayName,
420
431
  issuer,
421
432
  accessTokenIssuer,
422
433
  env,
@@ -446,7 +457,7 @@ function getStringClaim(
446
457
  jwt: any,
447
458
  name: string,
448
459
  identityType?: string,
449
- identitySubType?: string
460
+ identitySubType?: string,
450
461
  ): string | undefined {
451
462
  const result = getOptionalStringClaim(jwt, name);
452
463
  if (!result) {
@@ -1,6 +0,0 @@
1
- export { LintScript } from './lint';
2
- export { LintFixScript } from './lintFix';
3
- export { ShowCoverageScript } from './showCoverage';
4
- export { TestScript } from './test';
5
- export { TestUnitsScript } from './testUnits';
6
- export { WatchScript } from './watch';
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WatchScript = exports.TestUnitsScript = exports.TestScript = exports.ShowCoverageScript = exports.LintFixScript = exports.LintScript = void 0;
4
- var lint_1 = require("./lint");
5
- Object.defineProperty(exports, "LintScript", { enumerable: true, get: function () { return lint_1.LintScript; } });
6
- var lintFix_1 = require("./lintFix");
7
- Object.defineProperty(exports, "LintFixScript", { enumerable: true, get: function () { return lintFix_1.LintFixScript; } });
8
- var showCoverage_1 = require("./showCoverage");
9
- Object.defineProperty(exports, "ShowCoverageScript", { enumerable: true, get: function () { return showCoverage_1.ShowCoverageScript; } });
10
- var test_1 = require("./test");
11
- Object.defineProperty(exports, "TestScript", { enumerable: true, get: function () { return test_1.TestScript; } });
12
- var testUnits_1 = require("./testUnits");
13
- Object.defineProperty(exports, "TestUnitsScript", { enumerable: true, get: function () { return testUnits_1.TestUnitsScript; } });
14
- var watch_1 = require("./watch");
15
- Object.defineProperty(exports, "WatchScript", { enumerable: true, get: function () { return watch_1.WatchScript; } });
16
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../scripts/index.ts"],"names":[],"mappings":";;;AAAA,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,qCAA0C;AAAjC,wGAAA,aAAa,OAAA;AACtB,+CAAoD;AAA3C,kHAAA,kBAAkB,OAAA;AAC3B,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,yCAA8C;AAArC,4GAAA,eAAe,OAAA;AACxB,iCAAsC;AAA7B,oGAAA,WAAW,OAAA"}