@villedemontreal/jwt-validator 5.10.3 → 5.11.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.
Files changed (89) 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 +1 -0
  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.test.d.ts +1 -0
  48. package/dist/src/utils/createIdentityFromJwt.test.d.ts.map +1 -0
  49. package/dist/src/utils/jwtMock.d.ts +1 -0
  50. package/dist/src/utils/jwtMock.d.ts.map +1 -0
  51. package/dist/src/utils/logger.d.ts +1 -0
  52. package/dist/src/utils/logger.d.ts.map +1 -0
  53. package/dist/src/utils/testingConfigurations.d.ts +1 -0
  54. package/dist/src/utils/testingConfigurations.d.ts.map +1 -0
  55. package/dist/tsconfig.tsbuildinfo +1 -0
  56. package/package.json +40 -38
  57. package/src/config/configs.ts +1 -1
  58. package/src/config/init.ts +1 -1
  59. package/src/jwtValidator.test.ts +3 -3
  60. package/src/middleware/jwtMiddleware.test.ts +3 -3
  61. package/src/middleware/jwtMiddleware.ts +1 -1
  62. package/src/middleware/tokenTransformationMiddleware.ts +2 -2
  63. package/src/models/customError.ts +1 -1
  64. package/src/models/identities.ts +1 -1
  65. package/src/repositories/cachedPublicKeyRepository.ts +1 -1
  66. package/src/repositories/publicKeyRepository.ts +2 -2
  67. package/src/utils/createIdentityFromJwt.test.ts +34 -34
  68. package/src/utils/createIdentityFromJwt.ts +7 -7
  69. package/dist/scripts/index.d.ts +0 -6
  70. package/dist/scripts/index.js +0 -16
  71. package/dist/scripts/index.js.map +0 -1
  72. package/dist/scripts/lint.d.ts +0 -6
  73. package/dist/scripts/lint.js +0 -18
  74. package/dist/scripts/lint.js.map +0 -1
  75. package/dist/scripts/lintFix.d.ts +0 -6
  76. package/dist/scripts/lintFix.js +0 -21
  77. package/dist/scripts/lintFix.js.map +0 -1
  78. package/dist/scripts/showCoverage.d.ts +0 -13
  79. package/dist/scripts/showCoverage.js +0 -40
  80. package/dist/scripts/showCoverage.js.map +0 -1
  81. package/dist/scripts/test.d.ts +0 -13
  82. package/dist/scripts/test.js +0 -29
  83. package/dist/scripts/test.js.map +0 -1
  84. package/dist/scripts/testUnits.d.ts +0 -15
  85. package/dist/scripts/testUnits.js +0 -95
  86. package/dist/scripts/testUnits.js.map +0 -1
  87. package/dist/scripts/watch.d.ts +0 -14
  88. package/dist/scripts/watch.js +0 -96
  89. package/dist/scripts/watch.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@villedemontreal/jwt-validator",
3
- "version": "5.10.3",
3
+ "version": "5.11.0",
4
4
  "description": "Module to validate JWT (JSON Web Tokens)",
5
5
  "main": "dist/src/index.js",
6
6
  "typings": "dist/src",
@@ -9,19 +9,22 @@
9
9
  "dist"
10
10
  ],
11
11
  "scripts": {
12
- "start": "node run test",
13
- "test": "node run test",
14
- "compile": "node run compile",
15
- "prepare": "node run compile",
16
- "prepublishOnly": "node run test",
17
- "lint": "node run lint",
18
- "lint-fix": "node run lint-fix",
19
- "tslint": "node run tslint",
20
- "tslint-fix": "node run tslint-fix",
21
- "prettier": "node run prettier",
22
- "prettier-fix": "node run prettier-fix",
23
- "watch": "node run watch"
12
+ "start": "npm run test",
13
+ "test": "nyc mocha --require ts-node/register ./src/**/*.test.ts",
14
+ "compile": "tsc --build",
15
+ "show-tsconfig": "tsc --showConfig",
16
+ "show-coverage": "open output/coverage/lcov-report/index.html",
17
+ "lint": "eslint -c .eslintrc.js --ext .ts src",
18
+ "lint-fix": "eslint -c .eslintrc.js --fix --ext .ts src",
19
+ "ncu": "ncu --target minor -x @types/node",
20
+ "ncu-fix": "ncu -u --target minor -x @types/node"
24
21
  },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/villedemontreal/node-core-libs.git",
25
+ "directory": "packages/node-jwt-validator"
26
+ },
27
+ "homepage": "https://github.com/villedemontreal/node-core-libs",
25
28
  "keywords": [
26
29
  "mtl",
27
30
  "jwt",
@@ -33,51 +36,50 @@
33
36
  "license": "MIT",
34
37
  "dependencies": {
35
38
  "@types/nock": "10.0.3",
36
- "@villedemontreal/general-utils": "5.17.5",
37
- "@villedemontreal/http-request": "7.4.11",
38
- "@villedemontreal/logger": "6.6.3",
39
+ "@villedemontreal/general-utils": "5.18.0",
40
+ "@villedemontreal/http-request": "7.5.0",
41
+ "@villedemontreal/logger": "6.7.0",
39
42
  "app-root-path": "3.1.0",
40
43
  "http-header-fields-typed": "1.3.0",
41
44
  "http-status-codes": "2.3.0",
42
45
  "jsonwebtoken": "9.0.2",
43
46
  "lodash": "4.17.21",
44
47
  "moment": "2.30.1",
45
- "nock": "13.5.5",
46
- "superagent": "10.1.0"
48
+ "nock": "13.5.6",
49
+ "superagent": "10.2.0"
47
50
  },
48
51
  "devDependencies": {
49
52
  "@types/app-root-path": "1.2.8",
50
- "@types/chai": "4.3.19",
51
- "@types/chai-as-promised": "^7.1.6",
53
+ "@types/chai": "4.3.20",
54
+ "@types/chai-as-promised": "^7.1.8",
52
55
  "@types/express": "4.17.21",
53
56
  "@types/fs-extra": "11.0.4",
54
57
  "@types/http-status-codes": "1.2.0",
55
- "@types/jsonwebtoken": "9.0.7",
56
- "@types/lodash": "4.17.9",
57
- "@types/mocha": "10.0.8",
58
+ "@types/jsonwebtoken": "9.0.9",
59
+ "@types/lodash": "4.17.16",
60
+ "@types/mocha": "10.0.10",
58
61
  "@types/node": "20.x",
59
62
  "@types/request": "2.48.12",
60
63
  "@types/request-promise-native": "1.0.21",
61
- "@types/sinon": "17.0.3",
64
+ "@types/sinon": "17.0.4",
62
65
  "@types/superagent": "8.1.9",
63
66
  "@types/validator": "13.12.2",
64
- "@typescript-eslint/eslint-plugin": "5.57.1",
65
- "@typescript-eslint/parser": "5.57.1",
66
- "@villedemontreal/scripting": "2.1.9",
67
+ "@typescript-eslint/eslint-plugin": "5.62.0",
68
+ "@typescript-eslint/parser": "5.62.0",
67
69
  "chai": "4.5.0",
68
- "chai-as-promised": "^7.1.1",
69
- "eslint": "8.38.0",
70
- "eslint-config-prettier": "8.8.0",
71
- "eslint-plugin-prettier": "4.2.1",
72
- "fs-extra": "11.2.0",
73
- "mocha": "10.7.3",
74
- "mocha-jenkins-reporter": "0.4.8",
70
+ "chai-as-promised": "^7.1.2",
71
+ "eslint": "8.57.1",
72
+ "eslint-config-prettier": "8.10.0",
73
+ "eslint-plugin-prettier": "5.2.4",
74
+ "fs-extra": "11.3.0",
75
+ "mocha": "10.8.2",
75
76
  "mock-express-request": "0.2.2",
76
- "node-mocks-http": "1.16.0",
77
+ "node-mocks-http": "1.16.2",
77
78
  "node-notifier": "10.0.1",
78
79
  "nyc": "17.1.0",
79
- "sinon": "19.0.2",
80
- "typescript": "5.6.2",
81
- "validator": "13.12.0"
80
+ "sinon": "19.0.5",
81
+ "ts-node": "^10.9.2",
82
+ "typescript": "5.8.2",
83
+ "validator": "13.15.0"
82
84
  }
83
85
  }
@@ -156,7 +156,7 @@ export class Configs {
156
156
  get correlationIdProvider(): () => string {
157
157
  if (!this._correlationIdProvider) {
158
158
  throw new Error(
159
- `The Correlation Id provider HAS to be set as a configuration! Please call the init(...) fonction first.`
159
+ `The Correlation Id provider HAS to be set as a configuration! Please call the init(...) fonction first.`,
160
160
  );
161
161
  }
162
162
  return this._correlationIdProvider;
@@ -15,7 +15,7 @@ export function init(
15
15
  endpoint: string = constants.default.endpoint,
16
16
  fetchKeysParameters: string = constants.default.fetchKeysParameters,
17
17
  cacheDuration: number = constants.default.cacheDuration,
18
- urlCaseSensitive = false
18
+ urlCaseSensitive = false,
19
19
  ): void {
20
20
  if (!loggerCreator) {
21
21
  throw new Error(`The Logger Creator is required.`);
@@ -92,7 +92,7 @@ it('JWT Validator - verifyHeader - should reject unknow authentication scheme',
92
92
  assert.strictEqual(err.error.details[0].target, 'Authorization header');
93
93
  assert.strictEqual(
94
94
  err.error.details[0].message,
95
- 'Bad authentication scheme, "Bearer" required'
95
+ 'Bad authentication scheme, "Bearer" required',
96
96
  );
97
97
  });
98
98
 
@@ -377,7 +377,7 @@ it('JWT Validator - verify - should reject jwt created after the expiration date
377
377
  assert.strictEqual(err.error.details[0].target, 'jwt');
378
378
  assert.strictEqual(
379
379
  err.error.details[0].message,
380
- "this jwt can't be created after the expiration of the public key"
380
+ "this jwt can't be created after the expiration of the public key",
381
381
  );
382
382
  });
383
383
 
@@ -404,7 +404,7 @@ it('JWT Validator - verify - should reject jwt created before the creation date
404
404
  assert.strictEqual(err.error.details[0].target, 'jwt');
405
405
  assert.strictEqual(
406
406
  err.error.details[0].message,
407
- "this jwt can't be created before the public key"
407
+ "this jwt can't be created before the public key",
408
408
  );
409
409
  });
410
410
 
@@ -58,7 +58,7 @@ describe('#jwtValidationMiddleware', () => {
58
58
  headers: { Authorization: authorizationHeader },
59
59
  });
60
60
  verifyMethod = stub(jwtValidator, 'verifyAuthorizationHeader').returns(
61
- delay(DELAY).then(() => jwt)
61
+ delay(DELAY).then(() => jwt),
62
62
  );
63
63
 
64
64
  // WHEN
@@ -77,7 +77,7 @@ describe('#jwtValidationMiddleware', () => {
77
77
  middleware = jwtValidationMiddleware(false);
78
78
  request.headers = {}; // ∅
79
79
  verifyMethod = stub(jwtValidator, 'verifyAuthorizationHeader').returns(
80
- delay(50).then(() => jwt)
80
+ delay(50).then(() => jwt),
81
81
  );
82
82
 
83
83
  // WHEN
@@ -115,7 +115,7 @@ describe('#jwtValidationMiddleware', () => {
115
115
  verifyMethod = stub(jwtValidator, 'verifyAuthorizationHeader').returns(
116
116
  delay(50).then(() => {
117
117
  throw error;
118
- })
118
+ }),
119
119
  );
120
120
 
121
121
  // WHEN
@@ -13,7 +13,7 @@ export const jwtValidationMiddleware =
13
13
  async (
14
14
  req: express.Request,
15
15
  res: express.Response,
16
- next: express.NextFunction
16
+ next: express.NextFunction,
17
17
  ): Promise<void> => {
18
18
  try {
19
19
  const authHeader: string = req.get(httpHeaderFieldsTyped.AUTHORIZATION);
@@ -48,9 +48,9 @@ const getAccessTokenFromHeader = (authHeader: string): string | null => {
48
48
  * @param {boolean} config Configuration of the middleware.
49
49
  */
50
50
  export const tokenTransformationMiddleware: (
51
- config?: ITokenTtransformationMiddlewareConfig
51
+ config?: ITokenTtransformationMiddlewareConfig,
52
52
  ) => (req: express.Request, res: express.Response, next: express.NextFunction) => void = (
53
- config
53
+ config,
54
54
  ) => {
55
55
  return (req: express.Request, res: express.Response, next: express.NextFunction): void => {
56
56
  try {
@@ -25,7 +25,7 @@ export function createInvalidJwtError(detail: IApiError): IApiErrorAndInfo {
25
25
  export function createInvalidAuthHeaderError(detail: IApiError): IApiErrorAndInfo {
26
26
  return createError(
27
27
  constants.errors.codes.INVALID_AUTHORIZATION_HEADER,
28
- 'Invalid Authorization header'
28
+ 'Invalid Authorization header',
29
29
  )
30
30
  .httpStatus(HttpStatusCodes.UNAUTHORIZED)
31
31
  .target('Authorization header')
@@ -589,7 +589,7 @@ export type AnonymousIdentity = BaseIdentity<AnonymousAttributes> & {
589
589
  * The ID is mapped to the 'aud' or the 'username', depending on the subtype.
590
590
  */
591
591
  export type ServiceAccountIdentity<
592
- TAttributes extends ServiceAccountAttributes = ServiceAccountAttributes
592
+ TAttributes extends ServiceAccountAttributes = ServiceAccountAttributes,
593
593
  > = BaseIdentity<TAttributes> & {
594
594
  /**
595
595
  * The type of identity
@@ -72,7 +72,7 @@ export class CachedPublicKeyRepository implements ICachedPublicKeyRepository {
72
72
  }
73
73
  logger.error(
74
74
  JSON.stringify(err),
75
- `[getOne] There was an error getting key ${keyId}, cached value was sent as result`
75
+ `[getOne] There was an error getting key ${keyId}, cached value was sent as result`,
76
76
  );
77
77
  }
78
78
  }
@@ -32,7 +32,7 @@ class PublicKeyRepository implements IPublicKeyRepository {
32
32
  public async getAll(): Promise<IPublicKeys> {
33
33
  const url = `${httpUtils.urlJoin(
34
34
  configs.getHost(),
35
- configs.getEndpoint()
35
+ configs.getEndpoint(),
36
36
  )}?${configs.getFetchKeysParameters()}`;
37
37
  const request = superagent.get(url);
38
38
 
@@ -68,7 +68,7 @@ class PublicKeyRepository implements IPublicKeyRepository {
68
68
 
69
69
  throw createError(
70
70
  constants.errors.codes.UNABLE_TO_GET_PUBLIC_KEY,
71
- `An error occurred calling ${url} : ${response.error}`
71
+ `An error occurred calling ${url} : ${response.error}`,
72
72
  )
73
73
  .httpStatus(response.status)
74
74
  .build();
@@ -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
@@ -82,7 +82,7 @@ describe('createIdentityFromJwt', () => {
82
82
  });
83
83
  // console.log(JSON.stringify(identity));
84
84
  expect(JSON.stringify(identity)).to.eql(
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
+ `{"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"}}`,
86
86
  );
87
87
  });
88
88
 
@@ -114,7 +114,7 @@ describe('createIdentityFromJwt', () => {
114
114
  // console.log(identity);
115
115
 
116
116
  expect(identity.toString()).to.equal(
117
- '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',
118
118
  );
119
119
  delete identity.toString;
120
120
  expect(identity).to.eql({
@@ -175,7 +175,7 @@ describe('createIdentityFromJwt', () => {
175
175
  // console.log(identity);
176
176
 
177
177
  expect(identity.toString()).to.equal(
178
- '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',
179
179
  );
180
180
  delete identity.toString;
181
181
  expect(identity).to.eql({
@@ -235,7 +235,7 @@ describe('createIdentityFromJwt', () => {
235
235
  // console.log(identity);
236
236
 
237
237
  expect(identity.toString()).to.equal(
238
- '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',
239
239
  );
240
240
  delete identity.toString;
241
241
  expect(identity).to.eql({
@@ -293,7 +293,7 @@ describe('createIdentityFromJwt', () => {
293
293
  // console.log(identity);
294
294
 
295
295
  expect(identity.toString()).to.equal(
296
- 'user:external:xdoejo3:John DOE:john.doe@montreal.ca::vdm'
296
+ 'user:external:xdoejo3:John DOE:john.doe@montreal.ca::vdm',
297
297
  );
298
298
 
299
299
  delete identity.toString;
@@ -350,7 +350,7 @@ describe('createIdentityFromJwt', () => {
350
350
  // console.log(identity);
351
351
 
352
352
  expect(identity.toString()).to.equal(
353
- 'user:external:foobar:John DOE:john.doe.ext@montreal.ca::vdm'
353
+ 'user:external:foobar:John DOE:john.doe.ext@montreal.ca::vdm',
354
354
  );
355
355
 
356
356
  delete identity.toString;
@@ -407,7 +407,7 @@ describe('createIdentityFromJwt', () => {
407
407
  // console.log(identity);
408
408
 
409
409
  expect(identity.toString()).to.equal(
410
- 'user:generic:cgdsecdev2:C.Generique dsec developpeur2::4211:vdm'
410
+ 'user:generic:cgdsecdev2:C.Generique dsec developpeur2::4211:vdm',
411
411
  );
412
412
 
413
413
  delete identity.toString;
@@ -466,7 +466,7 @@ describe('createIdentityFromJwt', () => {
466
466
  // console.log(identity);
467
467
 
468
468
  expect(identity.toString()).to.equal(
469
- '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',
470
470
  );
471
471
 
472
472
  delete identity.toString;
@@ -526,7 +526,7 @@ describe('createIdentityFromJwt', () => {
526
526
  // console.log(identity);
527
527
 
528
528
  expect(identity.toString()).to.equal(
529
- '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',
530
530
  );
531
531
 
532
532
  delete identity.toString;
@@ -581,7 +581,7 @@ describe('createIdentityFromJwt', () => {
581
581
  // console.log(identity);
582
582
 
583
583
  expect(identity.toString()).to.equal(
584
- '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',
585
585
  );
586
586
 
587
587
  delete identity.toString;
@@ -678,7 +678,7 @@ describe('createIdentityFromJwt', () => {
678
678
  // console.log(identity);
679
679
 
680
680
  expect(identity.toString()).to.equal(
681
- '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',
682
682
  );
683
683
 
684
684
  delete identity.toString;
@@ -726,7 +726,7 @@ describe('createIdentityFromJwt', () => {
726
726
  // console.log(identity);
727
727
 
728
728
  expect(identity.toString()).to.equal(
729
- 'service-account:user:srvAccDiagCanary:srvAcc Diagnostics Canary'
729
+ 'service-account:user:srvAccDiagCanary:srvAcc Diagnostics Canary',
730
730
  );
731
731
 
732
732
  delete identity.toString;
@@ -777,7 +777,7 @@ describe('createIdentityFromJwt', () => {
777
777
  // console.log(identity);
778
778
 
779
779
  expect(identity.toString()).to.equal(
780
- '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',
781
781
  );
782
782
 
783
783
  delete identity.toString;
@@ -830,7 +830,7 @@ describe('createIdentityFromJwt', () => {
830
830
  // console.log(identity);
831
831
 
832
832
  expect(identity.toString()).to.equal(
833
- 'user:unknown:john.doe:John Doe:john.doe@mailinator.com:::vdm'
833
+ 'user:unknown:john.doe:John Doe:john.doe@mailinator.com:::vdm',
834
834
  );
835
835
 
836
836
  delete identity.toString;
@@ -977,7 +977,7 @@ describe('createIdentityFromJwt', () => {
977
977
  // console.log(identity);
978
978
 
979
979
  expect(identity.toString()).to.equal(
980
- 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca::421408000000:vdm'
980
+ 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca::421408000000:vdm',
981
981
  );
982
982
  delete identity.toString;
983
983
  expect(identity).to.eql({
@@ -1037,7 +1037,7 @@ describe('createIdentityFromJwt', () => {
1037
1037
  // console.log(identity);
1038
1038
 
1039
1039
  expect(identity.toString()).to.equal(
1040
- 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca:100674051::vdm'
1040
+ 'user:unknown:udoejo3:John DOE:john.doe@montreal.ca:100674051::vdm',
1041
1041
  );
1042
1042
  delete identity.toString;
1043
1043
  expect(identity).to.eql({
@@ -1097,7 +1097,7 @@ describe('createIdentityFromJwt', () => {
1097
1097
  // console.log(identity);
1098
1098
 
1099
1099
  expect(identity.toString()).to.equal(
1100
- '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',
1101
1101
  );
1102
1102
  delete identity.toString;
1103
1103
  expect(identity).to.eql({
@@ -1156,7 +1156,7 @@ describe('createIdentityFromJwt', () => {
1156
1156
  // console.log(identity);
1157
1157
 
1158
1158
  expect(identity.toString()).to.equal(
1159
- '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',
1160
1160
  );
1161
1161
  delete identity.toString;
1162
1162
  expect(identity).to.eql({
@@ -1215,7 +1215,7 @@ describe('createIdentityFromJwt', () => {
1215
1215
  // console.log(identity);
1216
1216
 
1217
1217
  expect(identity.toString()).to.equal(
1218
- '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',
1219
1219
  );
1220
1220
  delete identity.toString;
1221
1221
  expect(identity).to.eql({
@@ -1274,7 +1274,7 @@ describe('createIdentityFromJwt', () => {
1274
1274
  // console.log(identity);
1275
1275
 
1276
1276
  expect(identity.toString()).to.equal(
1277
- 'user:unknown:udoejo3:udoejo3::100674051:421408000000:vdm'
1277
+ 'user:unknown:udoejo3:udoejo3::100674051:421408000000:vdm',
1278
1278
  );
1279
1279
  delete identity.toString;
1280
1280
  expect(identity).to.eql({
@@ -1333,7 +1333,7 @@ describe('createIdentityFromJwt', () => {
1333
1333
  // console.log(identity);
1334
1334
 
1335
1335
  expect(identity.toString()).to.equal(
1336
- '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',
1337
1337
  );
1338
1338
  delete identity.toString;
1339
1339
  expect(identity).to.eql({
@@ -1392,7 +1392,7 @@ describe('createIdentityFromJwt', () => {
1392
1392
  // console.log(identity);
1393
1393
 
1394
1394
  expect(identity.toString()).to.equal(
1395
- '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',
1396
1396
  );
1397
1397
  delete identity.toString;
1398
1398
  expect(identity).to.eql({
@@ -1451,7 +1451,7 @@ describe('createIdentityFromJwt', () => {
1451
1451
  // console.log(identity);
1452
1452
 
1453
1453
  expect(identity.toString()).to.equal(
1454
- 'user:unknown:xdr_foo:John DOE:john.doe@montreal.ca:::vdm'
1454
+ 'user:unknown:xdr_foo:John DOE:john.doe@montreal.ca:::vdm',
1455
1455
  );
1456
1456
 
1457
1457
  delete identity.toString;
@@ -1508,7 +1508,7 @@ describe('createIdentityFromJwt', () => {
1508
1508
  // console.log(identity);
1509
1509
 
1510
1510
  expect(identity.toString()).to.equal(
1511
- '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',
1512
1512
  );
1513
1513
 
1514
1514
  delete identity.toString;
@@ -1567,7 +1567,7 @@ describe('createIdentityFromJwt', () => {
1567
1567
  email: 'john.doe@montreal.ca',
1568
1568
  };
1569
1569
  expect(() => createIdentityFromJwt(jwt)).throws(
1570
- 'expected to find the "sub" claim in the JWT'
1570
+ 'expected to find the "sub" claim in the JWT',
1571
1571
  );
1572
1572
  });
1573
1573
  it('optional string claim should be a string and not a number', () => {
@@ -1593,7 +1593,7 @@ describe('createIdentityFromJwt', () => {
1593
1593
  email: 'john.doe@montreal.ca',
1594
1594
  };
1595
1595
  expect(() => createIdentityFromJwt(jwt)).throws(
1596
- `claim 'oid' to contain a string but received: 1234`
1596
+ `claim 'oid' to contain a string but received: 1234`,
1597
1597
  );
1598
1598
  });
1599
1599
  it('external users should belong to the employees realm', () => {
@@ -1619,7 +1619,7 @@ describe('createIdentityFromJwt', () => {
1619
1619
  email: 'john.doe@montreal.ca',
1620
1620
  };
1621
1621
  expect(() => createIdentityFromJwt(jwt)).throws(
1622
- 'expected token to belong to the "employees" realm'
1622
+ 'expected token to belong to the "employees" realm',
1623
1623
  );
1624
1624
  });
1625
1625
  it('anonymous users should belong to the anonymous realm', () => {
@@ -1642,7 +1642,7 @@ describe('createIdentityFromJwt', () => {
1642
1642
  accessTokenIssuer: 'security-identity-anonymous-token-api',
1643
1643
  };
1644
1644
  expect(() => createIdentityFromJwt(jwt)).throws(
1645
- 'anonymous: expected token to belong to the "anonymous" realm'
1645
+ 'anonymous: expected token to belong to the "anonymous" realm',
1646
1646
  );
1647
1647
  });
1648
1648
  it('citizen users should belong to the citizens realm', () => {
@@ -1668,7 +1668,7 @@ describe('createIdentityFromJwt', () => {
1668
1668
  email: 'john.doe@mailinator.com',
1669
1669
  };
1670
1670
  expect(() => createIdentityFromJwt(jwt)).throws(
1671
- 'user:citizen: expected token to belong to the "citizens" realm'
1671
+ 'user:citizen: expected token to belong to the "citizens" realm',
1672
1672
  );
1673
1673
  });
1674
1674
  it('employee users should belong to the employees realm', () => {
@@ -1696,7 +1696,7 @@ describe('createIdentityFromJwt', () => {
1696
1696
  email: 'john.doe@montreal.ca',
1697
1697
  };
1698
1698
  expect(() => createIdentityFromJwt(jwt)).throws(
1699
- 'user:employee: expected token to belong to the "employees" realm'
1699
+ 'user:employee: expected token to belong to the "employees" realm',
1700
1700
  );
1701
1701
  });
1702
1702
  it('getStringClaim with identityType error', () => {
@@ -1719,7 +1719,7 @@ describe('createIdentityFromJwt', () => {
1719
1719
  accessTokenIssuer: 'security-identity-anonymous-token-api',
1720
1720
  };
1721
1721
  expect(() => createIdentityFromJwt(jwt)).throws(
1722
- 'anonymous: expected to find the "userName" claim in the JWT'
1722
+ 'anonymous: expected to find the "userName" claim in the JWT',
1723
1723
  );
1724
1724
  });
1725
1725
  it('getStringClaim with identityType and subType error', () => {
@@ -1739,7 +1739,7 @@ describe('createIdentityFromJwt', () => {
1739
1739
  'https://login.microsoftonline.com/9f15d2dc-8753-4f83-aac2-a58288d3a4bc/v2.0',
1740
1740
  };
1741
1741
  expect(() => createIdentityFromJwt(jwt)).throws(
1742
- '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',
1743
1743
  );
1744
1744
  });
1745
1745
  });
@@ -188,7 +188,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
188
188
  this.attributes.type,
189
189
  this.id,
190
190
  this.displayName,
191
- this.attributes.email
191
+ this.attributes.email,
192
192
  );
193
193
  },
194
194
  };
@@ -236,7 +236,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
236
236
  this.attributes.email,
237
237
  this.attributes.registrationNumber,
238
238
  this.attributes.department,
239
- this.attributes.accountProfile
239
+ this.attributes.accountProfile,
240
240
  );
241
241
  },
242
242
  };
@@ -282,7 +282,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
282
282
  this.displayName,
283
283
  this.attributes.email,
284
284
  this.attributes.department,
285
- this.attributes.accountProfile
285
+ this.attributes.accountProfile,
286
286
  );
287
287
  },
288
288
  };
@@ -323,7 +323,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
323
323
  realm,
324
324
  this.id,
325
325
  this.displayName,
326
- this.attributes.email
326
+ this.attributes.email,
327
327
  );
328
328
  },
329
329
  };
@@ -365,7 +365,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
365
365
  this.displayName,
366
366
  this.attributes.email,
367
367
  this.attributes.department,
368
- this.attributes.accountProfile
368
+ this.attributes.accountProfile,
369
369
  );
370
370
  },
371
371
  };
@@ -411,7 +411,7 @@ export function createIdentityFromJwt(jwt: any): Identity {
411
411
  this.attributes.email,
412
412
  this.attributes.registrationNumber,
413
413
  this.attributes.department,
414
- this.attributes.accountProfile
414
+ this.attributes.accountProfile,
415
415
  );
416
416
  },
417
417
  };
@@ -457,7 +457,7 @@ function getStringClaim(
457
457
  jwt: any,
458
458
  name: string,
459
459
  identityType?: string,
460
- identitySubType?: string
460
+ identitySubType?: string,
461
461
  ): string | undefined {
462
462
  const result = getOptionalStringClaim(jwt, name);
463
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"}
@@ -1,6 +0,0 @@
1
- import { ScriptBase } from '@villedemontreal/scripting/dist/src';
2
- export declare class LintScript extends ScriptBase {
3
- get name(): string;
4
- get description(): string;
5
- protected main(): Promise<void>;
6
- }