@tsed/oidc-provider 7.0.0-beta.2 → 7.0.0-beta.20

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 (126) hide show
  1. package/coverage.json +6 -0
  2. package/jest.config.js +9 -0
  3. package/lib/cjs/OidcModule.js +28 -18
  4. package/lib/cjs/OidcModule.js.map +1 -1
  5. package/lib/cjs/constants/{index.js → constants.js} +1 -1
  6. package/lib/cjs/constants/constants.js.map +1 -0
  7. package/lib/cjs/decorators/grantId.js +1 -1
  8. package/lib/cjs/decorators/grantId.js.map +1 -1
  9. package/lib/cjs/decorators/interaction.js +1 -1
  10. package/lib/cjs/decorators/interaction.js.map +1 -1
  11. package/lib/cjs/decorators/interactions.js +1 -1
  12. package/lib/cjs/decorators/interactions.js.map +1 -1
  13. package/lib/cjs/decorators/oidcCtx.js +1 -1
  14. package/lib/cjs/decorators/oidcCtx.js.map +1 -1
  15. package/lib/cjs/decorators/oidcSession.js +1 -1
  16. package/lib/cjs/decorators/oidcSession.js.map +1 -1
  17. package/lib/cjs/decorators/params.js +1 -1
  18. package/lib/cjs/decorators/params.js.map +1 -1
  19. package/lib/cjs/decorators/prompt.js +1 -1
  20. package/lib/cjs/decorators/prompt.js.map +1 -1
  21. package/lib/cjs/decorators/uid.js +1 -1
  22. package/lib/cjs/decorators/uid.js.map +1 -1
  23. package/lib/cjs/domain/OidcAccountsMethods.js.map +1 -1
  24. package/lib/cjs/domain/OidcBadInteractionName.js +8 -0
  25. package/lib/cjs/domain/OidcBadInteractionName.js.map +1 -0
  26. package/lib/cjs/domain/OidcInteractionPromptProps.js +3 -0
  27. package/lib/cjs/domain/OidcInteractionPromptProps.js.map +1 -0
  28. package/lib/cjs/domain/OidcSettings.js.map +1 -1
  29. package/lib/cjs/domain/interfaces.js +3 -0
  30. package/lib/cjs/domain/interfaces.js.map +1 -0
  31. package/lib/cjs/index.js +31 -11
  32. package/lib/cjs/index.js.map +1 -1
  33. package/lib/cjs/middlewares/OidcInteractionMiddleware.js +7 -27
  34. package/lib/cjs/middlewares/OidcInteractionMiddleware.js.map +1 -1
  35. package/lib/cjs/middlewares/OidcNoCacheMiddleware.js +6 -6
  36. package/lib/cjs/middlewares/OidcNoCacheMiddleware.js.map +1 -1
  37. package/lib/cjs/middlewares/OidcSecureMiddleware.js +7 -7
  38. package/lib/cjs/middlewares/OidcSecureMiddleware.js.map +1 -1
  39. package/lib/cjs/package.json +3 -0
  40. package/lib/cjs/services/OidcAdapters.js +25 -3
  41. package/lib/cjs/services/OidcAdapters.js.map +1 -1
  42. package/lib/cjs/services/OidcInteractionContext.js +70 -25
  43. package/lib/cjs/services/OidcInteractionContext.js.map +1 -1
  44. package/lib/cjs/services/OidcInteractions.js +16 -15
  45. package/lib/cjs/services/OidcInteractions.js.map +1 -1
  46. package/lib/cjs/services/OidcJwks.js +8 -5
  47. package/lib/cjs/services/OidcJwks.js.map +1 -1
  48. package/lib/cjs/services/OidcProvider.js +43 -31
  49. package/lib/cjs/services/OidcProvider.js.map +1 -1
  50. package/lib/cjs/utils/debug.js +1 -1
  51. package/lib/cjs/utils/debug.js.map +1 -1
  52. package/lib/esm/OidcModule.js +20 -10
  53. package/lib/esm/OidcModule.js.map +1 -1
  54. package/lib/esm/constants/{index.js → constants.js} +1 -1
  55. package/lib/esm/constants/constants.js.map +1 -0
  56. package/lib/esm/decorators/grantId.js +1 -1
  57. package/lib/esm/decorators/grantId.js.map +1 -1
  58. package/lib/esm/decorators/interaction.js +1 -1
  59. package/lib/esm/decorators/interaction.js.map +1 -1
  60. package/lib/esm/decorators/interactions.js +3 -3
  61. package/lib/esm/decorators/interactions.js.map +1 -1
  62. package/lib/esm/decorators/noCache.js +1 -1
  63. package/lib/esm/decorators/oidcCtx.js +1 -1
  64. package/lib/esm/decorators/oidcCtx.js.map +1 -1
  65. package/lib/esm/decorators/oidcSession.js +1 -1
  66. package/lib/esm/decorators/oidcSession.js.map +1 -1
  67. package/lib/esm/decorators/params.js +1 -1
  68. package/lib/esm/decorators/params.js.map +1 -1
  69. package/lib/esm/decorators/prompt.js +1 -1
  70. package/lib/esm/decorators/prompt.js.map +1 -1
  71. package/lib/esm/decorators/uid.js +1 -1
  72. package/lib/esm/decorators/uid.js.map +1 -1
  73. package/lib/esm/domain/OidcAccountsMethods.js.map +1 -1
  74. package/lib/esm/domain/OidcBadInteractionName.js +4 -0
  75. package/lib/esm/domain/OidcBadInteractionName.js.map +1 -0
  76. package/lib/esm/domain/OidcInteractionPromptProps.js +2 -0
  77. package/lib/esm/domain/OidcInteractionPromptProps.js.map +1 -0
  78. package/lib/esm/domain/OidcSettings.js.map +1 -1
  79. package/lib/esm/domain/interfaces.js +2 -0
  80. package/lib/esm/domain/interfaces.js.map +1 -0
  81. package/lib/esm/index.js +31 -11
  82. package/lib/esm/index.js.map +1 -1
  83. package/lib/esm/middlewares/OidcInteractionMiddleware.js +8 -28
  84. package/lib/esm/middlewares/OidcInteractionMiddleware.js.map +1 -1
  85. package/lib/esm/package.json +3 -0
  86. package/lib/esm/services/OidcAdapters.js +22 -0
  87. package/lib/esm/services/OidcAdapters.js.map +1 -1
  88. package/lib/esm/services/OidcInteractionContext.js +65 -20
  89. package/lib/esm/services/OidcInteractionContext.js.map +1 -1
  90. package/lib/esm/services/OidcInteractions.js +9 -8
  91. package/lib/esm/services/OidcInteractions.js.map +1 -1
  92. package/lib/esm/services/OidcJwks.js +3 -0
  93. package/lib/esm/services/OidcJwks.js.map +1 -1
  94. package/lib/esm/services/OidcProvider.js +24 -12
  95. package/lib/esm/services/OidcProvider.js.map +1 -1
  96. package/lib/types/OidcModule.d.ts +5 -5
  97. package/lib/types/constants/{index.d.ts → constants.d.ts} +0 -0
  98. package/lib/types/decorators/interaction.d.ts +1 -1
  99. package/lib/types/domain/OidcAccountsMethods.d.ts +2 -2
  100. package/lib/types/domain/OidcBadInteractionName.d.ts +3 -0
  101. package/lib/types/domain/OidcInteractionPromptProps.d.ts +9 -0
  102. package/lib/types/domain/OidcSettings.d.ts +9 -1
  103. package/lib/types/domain/interfaces.d.ts +3 -0
  104. package/lib/types/index.d.ts +24 -4
  105. package/lib/types/middlewares/OidcInteractionMiddleware.d.ts +3 -5
  106. package/lib/types/services/OidcAdapters.d.ts +3 -2
  107. package/lib/types/services/OidcInteractionContext.d.ts +9 -4
  108. package/lib/types/services/OidcInteractions.d.ts +1 -1
  109. package/lib/types/services/OidcProvider.d.ts +3 -3
  110. package/package.json +26 -23
  111. package/readme.md +31 -35
  112. package/tsconfig.compile.esm.json +1 -12
  113. package/.mocharc.js +0 -5
  114. package/.nycrc +0 -27
  115. package/lib/cjs/constants/index.js.map +0 -1
  116. package/lib/cjs/decorators/index.js +0 -13
  117. package/lib/cjs/decorators/index.js.map +0 -1
  118. package/lib/cjs/domain/index.js +0 -9
  119. package/lib/cjs/domain/index.js.map +0 -1
  120. package/lib/esm/constants/index.js.map +0 -1
  121. package/lib/esm/decorators/index.js +0 -10
  122. package/lib/esm/decorators/index.js.map +0 -1
  123. package/lib/esm/domain/index.js +0 -6
  124. package/lib/esm/domain/index.js.map +0 -1
  125. package/lib/types/decorators/index.d.ts +0 -9
  126. package/lib/types/domain/index.d.ts +0 -8
package/coverage.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "statements": 99.69,
3
+ "branches": 94.82,
4
+ "functions": 98.71,
5
+ "lines": 99.67
6
+ }
package/jest.config.js ADDED
@@ -0,0 +1,9 @@
1
+ // For a detailed explanation regarding each configuration property, visit:
2
+ // https://jestjs.io/docs/en/configuration.html
3
+
4
+ module.exports = {
5
+ ...require("@tsed/jest-config")(__dirname, "oidc-provider"),
6
+ coverageThreshold: {
7
+ global: require("./coverage.json")
8
+ }
9
+ };
@@ -4,10 +4,16 @@ exports.OidcModule = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@tsed/common");
6
6
  const di_1 = require("@tsed/di");
7
+ const koa_mount_1 = tslib_1.__importDefault(require("koa-mount"));
7
8
  const OidcAdapters_1 = require("./services/OidcAdapters");
8
9
  const OidcJwks_1 = require("./services/OidcJwks");
9
10
  const OidcProvider_1 = require("./services/OidcProvider");
10
11
  let OidcModule = class OidcModule {
12
+ app;
13
+ platformName;
14
+ basePath;
15
+ oidcProvider;
16
+ injector;
11
17
  async $onInit() {
12
18
  if (this.oidcProvider.hasConfiguration()) {
13
19
  await this.oidcProvider.create();
@@ -15,7 +21,7 @@ let OidcModule = class OidcModule {
15
21
  }
16
22
  async $onRoutesInit() {
17
23
  if (this.basePath !== "/") {
18
- this.app.use(this.getRewriteMiddleware());
24
+ this.app.use(await this.getRewriteMiddleware());
19
25
  }
20
26
  }
21
27
  async $afterRoutesInit() {
@@ -27,50 +33,54 @@ let OidcModule = class OidcModule {
27
33
  this.app.use(this.basePath, provider.callback());
28
34
  break;
29
35
  case "koa":
30
- this.app.use(require("koa-mount")(this.basePath, provider.app));
36
+ this.app.use((0, koa_mount_1.default)(this.basePath, provider.app));
31
37
  break;
32
38
  }
33
39
  }
34
40
  }
35
41
  $onReady() {
36
- if (this.oidcProvider.hasConfiguration() && this.injector.settings.getBestHost) {
42
+ if (this.oidcProvider.hasConfiguration() && "getBestHost" in this.injector.settings) {
37
43
  const { injector } = this;
44
+ // @ts-ignore
38
45
  const host = injector.settings.getBestHost();
39
46
  const url = host.toString();
40
47
  injector.logger.info(`WellKnown is available on ${url}/.well-known/openid-configuration`);
41
48
  }
42
49
  }
43
- getRewriteMiddleware() {
50
+ async getRewriteMiddleware() {
44
51
  switch (this.platformName) {
45
52
  default:
46
53
  case "express":
47
- return require("express-urlrewrite")("/.well-known/*", `${this.basePath}/.well-known/$1`);
54
+ const { default: expressUrlRewrite } = await Promise.resolve().then(() => tslib_1.__importStar(require("express-urlrewrite")));
55
+ return expressUrlRewrite("/.well-known/*", `${this.basePath}/.well-known/$1`);
48
56
  case "koa":
49
- return require("koa-rewrite")("/.well-known/(.*)", `${this.basePath}/.well-known/$1`);
57
+ // @ts-ignore
58
+ const { default: koaUrlRewrite } = await Promise.resolve().then(() => tslib_1.__importStar(require("koa-rewrite")));
59
+ return koaUrlRewrite("/.well-known/(.*)", `${this.basePath}/.well-known/$1`);
50
60
  }
51
61
  }
52
62
  };
53
- (0, tslib_1.__decorate)([
63
+ tslib_1.__decorate([
54
64
  (0, common_1.Inject)(),
55
- (0, tslib_1.__metadata)("design:type", common_1.PlatformApplication)
65
+ tslib_1.__metadata("design:type", common_1.PlatformApplication)
56
66
  ], OidcModule.prototype, "app", void 0);
57
- (0, tslib_1.__decorate)([
67
+ tslib_1.__decorate([
58
68
  (0, di_1.Constant)("PLATFORM_NAME"),
59
- (0, tslib_1.__metadata)("design:type", String)
69
+ tslib_1.__metadata("design:type", String)
60
70
  ], OidcModule.prototype, "platformName", void 0);
61
- (0, tslib_1.__decorate)([
62
- (0, di_1.Constant)("oidc.path", "/"),
63
- (0, tslib_1.__metadata)("design:type", String)
71
+ tslib_1.__decorate([
72
+ (0, di_1.Constant)("oidc.path", "/oidc"),
73
+ tslib_1.__metadata("design:type", String)
64
74
  ], OidcModule.prototype, "basePath", void 0);
65
- (0, tslib_1.__decorate)([
75
+ tslib_1.__decorate([
66
76
  (0, common_1.Inject)(),
67
- (0, tslib_1.__metadata)("design:type", OidcProvider_1.OidcProvider)
77
+ tslib_1.__metadata("design:type", OidcProvider_1.OidcProvider)
68
78
  ], OidcModule.prototype, "oidcProvider", void 0);
69
- (0, tslib_1.__decorate)([
79
+ tslib_1.__decorate([
70
80
  (0, common_1.Inject)(),
71
- (0, tslib_1.__metadata)("design:type", common_1.InjectorService)
81
+ tslib_1.__metadata("design:type", common_1.InjectorService)
72
82
  ], OidcModule.prototype, "injector", void 0);
73
- OidcModule = (0, tslib_1.__decorate)([
83
+ OidcModule = tslib_1.__decorate([
74
84
  (0, di_1.Module)({
75
85
  imports: [OidcProvider_1.OidcProvider, OidcAdapters_1.OidcAdapters, OidcJwks_1.OidcJwks]
76
86
  })
@@ -1 +1 @@
1
- {"version":3,"file":"OidcModule.js","sourceRoot":"","sources":["../../src/OidcModule.ts"],"names":[],"mappings":";;;;AAAA,yCAA0E;AAC1E,iCAA0C;AAC1C,0DAAqD;AACrD,kDAA6C;AAC7C,0DAAqD;AAKrD,IAAa,UAAU,GAAvB,MAAa,UAAU;IAgBrB,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,EAAE;YACxC,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;SAClC;IACH,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,IAAI,IAAI,CAAC,QAAQ,KAAK,GAAG,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;SAC3C;IACH,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,EAAE;YACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;YAEzC,QAAQ,IAAI,CAAC,YAAY,EAAE;gBACzB,QAAQ;gBACR,KAAK,SAAS;oBACZ,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;oBACjD,MAAM;gBACR,KAAK,KAAK;oBACR,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;oBAChE,MAAM;aACT;SACF;IACH,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE;YAC9E,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;YACxB,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAE5B,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,GAAG,mCAAmC,CAAC,CAAC;SAC3F;IACH,CAAC;IAEO,oBAAoB;QAC1B,QAAQ,IAAI,CAAC,YAAY,EAAE;YACzB,QAAQ;YACR,KAAK,SAAS;gBACZ,OAAO,OAAO,CAAC,oBAAoB,CAAC,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,QAAQ,iBAAiB,CAAC,CAAC;YAC5F,KAAK,KAAK;gBACR,OAAO,OAAO,CAAC,aAAa,CAAC,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC,QAAQ,iBAAiB,CAAC,CAAC;SACzF;IACH,CAAC;CACF,CAAA;AA7DC;IADC,IAAA,eAAM,GAAE;2CACJ,4BAAmB;uCAAC;AAGzB;IADC,IAAA,aAAQ,EAAC,eAAe,CAAC;;gDACL;AAGrB;IADC,IAAA,aAAQ,EAAC,WAAW,EAAE,GAAG,CAAC;;4CACV;AAGjB;IADC,IAAA,eAAM,GAAE;2CACK,2BAAY;gDAAC;AAG3B;IADC,IAAA,eAAM,GAAE;2CACC,wBAAe;4CAAC;AAdf,UAAU;IAHtB,IAAA,WAAM,EAAC;QACN,OAAO,EAAE,CAAC,2BAAY,EAAE,2BAAY,EAAE,mBAAQ,CAAC;KAChD,CAAC;GACW,UAAU,CA+DtB;AA/DY,gCAAU","sourcesContent":["import {Inject, InjectorService, PlatformApplication} from \"@tsed/common\";\nimport {Constant, Module} from \"@tsed/di\";\nimport {OidcAdapters} from \"./services/OidcAdapters\";\nimport {OidcJwks} from \"./services/OidcJwks\";\nimport {OidcProvider} from \"./services/OidcProvider\";\n\n@Module({\n imports: [OidcProvider, OidcAdapters, OidcJwks]\n})\nexport class OidcModule {\n @Inject()\n app: PlatformApplication;\n\n @Constant(\"PLATFORM_NAME\")\n platformName: string;\n\n @Constant(\"oidc.path\", \"/\")\n basePath: string;\n\n @Inject()\n oidcProvider: OidcProvider;\n\n @Inject()\n injector: InjectorService;\n\n async $onInit() {\n if (this.oidcProvider.hasConfiguration()) {\n await this.oidcProvider.create();\n }\n }\n\n async $onRoutesInit() {\n if (this.basePath !== \"/\") {\n this.app.use(this.getRewriteMiddleware());\n }\n }\n\n async $afterRoutesInit() {\n if (this.oidcProvider.hasConfiguration()) {\n const provider = this.oidcProvider.get();\n\n switch (this.platformName) {\n default:\n case \"express\":\n this.app.use(this.basePath, provider.callback());\n break;\n case \"koa\":\n this.app.use(require(\"koa-mount\")(this.basePath, provider.app));\n break;\n }\n }\n }\n\n $onReady() {\n if (this.oidcProvider.hasConfiguration() && this.injector.settings.getBestHost) {\n const {injector} = this;\n const host = injector.settings.getBestHost();\n const url = host.toString();\n\n injector.logger.info(`WellKnown is available on ${url}/.well-known/openid-configuration`);\n }\n }\n\n private getRewriteMiddleware() {\n switch (this.platformName) {\n default:\n case \"express\":\n return require(\"express-urlrewrite\")(\"/.well-known/*\", `${this.basePath}/.well-known/$1`);\n case \"koa\":\n return require(\"koa-rewrite\")(\"/.well-known/(.*)\", `${this.basePath}/.well-known/$1`);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"OidcModule.js","sourceRoot":"","sources":["../../src/OidcModule.ts"],"names":[],"mappings":";;;;AAAA,yCAA0E;AAC1E,iCAA0C;AAC1C,kEAAiC;AACjC,0DAAqD;AACrD,kDAA6C;AAC7C,0DAAqD;AAKrD,IAAa,UAAU,GAAvB,MAAa,UAAU;IAEX,GAAG,CAAsB;IAGzB,YAAY,CAAS;IAGrB,QAAQ,CAAS;IAGjB,YAAY,CAAe;IAG3B,QAAQ,CAAkB;IAEpC,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,EAAE;YACxC,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;SAClC;IACH,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,IAAI,IAAI,CAAC,QAAQ,KAAK,GAAG,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;SACjD;IACH,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,EAAE;YACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;YAEzC,QAAQ,IAAI,CAAC,YAAY,EAAE;gBACzB,QAAQ;gBACR,KAAK,SAAS;oBACZ,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;oBACjD,MAAM;gBACR,KAAK,KAAK;oBACR,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;oBACpD,MAAM;aACT;SACF;IACH,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,IAAI,aAAa,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACnF,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;YACxB,aAAa;YACb,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAE5B,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,GAAG,mCAAmC,CAAC,CAAC;SAC3F;IACH,CAAC;IAEO,KAAK,CAAC,oBAAoB;QAChC,QAAQ,IAAI,CAAC,YAAY,EAAE;YACzB,QAAQ;YACR,KAAK,SAAS;gBACZ,MAAM,EAAC,OAAO,EAAE,iBAAiB,EAAC,GAAG,gEAAa,oBAAoB,GAAC,CAAC;gBACxE,OAAO,iBAAiB,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,QAAQ,iBAAiB,CAAC,CAAC;YAChF,KAAK,KAAK;gBACR,aAAa;gBACb,MAAM,EAAC,OAAO,EAAE,aAAa,EAAC,GAAG,gEAAa,aAAa,GAAC,CAAC;gBAC7D,OAAO,aAAa,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC,QAAQ,iBAAiB,CAAC,CAAC;SAChF;IACH,CAAC;CACF,CAAA;AAjEC;IADC,IAAA,eAAM,GAAE;sCACM,4BAAmB;uCAAC;AAGnC;IADC,IAAA,aAAQ,EAAC,eAAe,CAAC;;gDACK;AAG/B;IADC,IAAA,aAAQ,EAAC,WAAW,EAAE,OAAO,CAAC;;4CACJ;AAG3B;IADC,IAAA,eAAM,GAAE;sCACe,2BAAY;gDAAC;AAGrC;IADC,IAAA,eAAM,GAAE;sCACW,wBAAe;4CAAC;AAdzB,UAAU;IAHtB,IAAA,WAAM,EAAC;QACN,OAAO,EAAE,CAAC,2BAAY,EAAE,2BAAY,EAAE,mBAAQ,CAAC;KAChD,CAAC;GACW,UAAU,CAmEtB;AAnEY,gCAAU","sourcesContent":["import {Inject, InjectorService, PlatformApplication} from \"@tsed/common\";\nimport {Constant, Module} from \"@tsed/di\";\nimport koaMount from \"koa-mount\";\nimport {OidcAdapters} from \"./services/OidcAdapters\";\nimport {OidcJwks} from \"./services/OidcJwks\";\nimport {OidcProvider} from \"./services/OidcProvider\";\n\n@Module({\n imports: [OidcProvider, OidcAdapters, OidcJwks]\n})\nexport class OidcModule {\n @Inject()\n protected app: PlatformApplication;\n\n @Constant(\"PLATFORM_NAME\")\n protected platformName: string;\n\n @Constant(\"oidc.path\", \"/oidc\")\n protected basePath: string;\n\n @Inject()\n protected oidcProvider: OidcProvider;\n\n @Inject()\n protected injector: InjectorService;\n\n async $onInit() {\n if (this.oidcProvider.hasConfiguration()) {\n await this.oidcProvider.create();\n }\n }\n\n async $onRoutesInit() {\n if (this.basePath !== \"/\") {\n this.app.use(await this.getRewriteMiddleware());\n }\n }\n\n async $afterRoutesInit() {\n if (this.oidcProvider.hasConfiguration()) {\n const provider = this.oidcProvider.get();\n\n switch (this.platformName) {\n default:\n case \"express\":\n this.app.use(this.basePath, provider.callback());\n break;\n case \"koa\":\n this.app.use(koaMount(this.basePath, provider.app));\n break;\n }\n }\n }\n\n $onReady() {\n if (this.oidcProvider.hasConfiguration() && \"getBestHost\" in this.injector.settings) {\n const {injector} = this;\n // @ts-ignore\n const host = injector.settings.getBestHost();\n const url = host.toString();\n\n injector.logger.info(`WellKnown is available on ${url}/.well-known/openid-configuration`);\n }\n }\n\n private async getRewriteMiddleware() {\n switch (this.platformName) {\n default:\n case \"express\":\n const {default: expressUrlRewrite} = await import(\"express-urlrewrite\");\n return expressUrlRewrite(\"/.well-known/*\", `${this.basePath}/.well-known/$1`);\n case \"koa\":\n // @ts-ignore\n const {default: koaUrlRewrite} = await import(\"koa-rewrite\");\n return koaUrlRewrite(\"/.well-known/(.*)\", `${this.basePath}/.well-known/$1`);\n }\n }\n}\n"]}
@@ -11,4 +11,4 @@ exports.INTERACTION_DETAILS = "interactionDetails";
11
11
  exports.INTERACTION_OPTIONS = "interactionOptions";
12
12
  exports.INTERACTION = "interaction";
13
13
  exports.INTERACTIONS = "interactions";
14
- //# sourceMappingURL=index.js.map
14
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG,oBAAoB,CAAC;AAC3C,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,oBAAoB,GAAG,oBAAoB,CAAC;AAC5C,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,eAAe,GAAG,gBAAgB,CAAC;AACnC,QAAA,mBAAmB,GAAG,oBAAoB,CAAC;AAC3C,QAAA,mBAAmB,GAAG,oBAAoB,CAAC;AAC3C,QAAA,mBAAmB,GAAG,oBAAoB,CAAC;AAC3C,QAAA,WAAW,GAAG,aAAa,CAAC;AAC5B,QAAA,YAAY,GAAG,cAAc,CAAC","sourcesContent":["export const INTERACTION_CONTEXT = \"interactionContext\";\nexport const INTERACTION_PARAMS = \"interactionParams\";\nexport const INTERACTION_GRANT_ID = \"interactionGrantId\";\nexport const INTERACTION_PROMPT = \"interactionPrompt\";\nexport const INTERACTION_UID = \"interactionUid\";\nexport const INTERACTION_SESSION = \"interactionSession\";\nexport const INTERACTION_DETAILS = \"interactionDetails\";\nexport const INTERACTION_OPTIONS = \"interactionOptions\";\nexport const INTERACTION = \"interaction\";\nexport const INTERACTIONS = \"interactions\";\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GrantId = void 0;
4
4
  const common_1 = require("@tsed/common");
5
5
  const core_1 = require("@tsed/core");
6
- const constants_1 = require("../constants");
6
+ const constants_1 = require("../constants/constants");
7
7
  function GrantId() {
8
8
  return (0, core_1.useDecorators)((0, common_1.Context)(constants_1.INTERACTION_GRANT_ID));
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"grantId.js","sourceRoot":"","sources":["../../../src/decorators/grantId.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AACzC,4CAAsE;AAEtE,SAAgB,OAAO;IACrB,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,gCAAoB,CAAC,CAAC,CAAC;AACtD,CAAC;AAFD,0BAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {INTERACTION_GRANT_ID, INTERACTION_PARAMS} from \"../constants\";\n\nexport function GrantId(): ParameterDecorator {\n return useDecorators(Context(INTERACTION_GRANT_ID));\n}\n\nexport type GrantId = string;\n"]}
1
+ {"version":3,"file":"grantId.js","sourceRoot":"","sources":["../../../src/decorators/grantId.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AACzC,sDAAgF;AAEhF,SAAgB,OAAO;IACrB,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,gCAAoB,CAAC,CAAC,CAAC;AACtD,CAAC;AAFD,0BAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {INTERACTION_GRANT_ID, INTERACTION_PARAMS} from \"../constants/constants\";\n\nexport function GrantId(): ParameterDecorator {\n return useDecorators(Context(INTERACTION_GRANT_ID));\n}\n\nexport type GrantId = string;\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Interaction = void 0;
4
4
  const common_1 = require("@tsed/common");
5
5
  const core_1 = require("@tsed/core");
6
- const constants_1 = require("../constants");
6
+ const constants_1 = require("../constants/constants");
7
7
  /**
8
8
  * @Oidc
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../../src/decorators/interaction.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,qCAAqD;AACrD,4CAA8D;AAG9D;;GAEG;AACH,SAAgB,WAAW,CAAC,OAA+B;IACzD,OAAO,IAAA,oBAAa,EAClB,IAAA,mBAAU,EAAC;QACT,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,uBAAW;KACrB,CAAC,EACF,IAAA,iBAAU,EAAC,+BAAmB,EAAE,OAAO,CAAC,CACzC,CAAC;AACJ,CAAC;AARD,kCAQC","sourcesContent":["import {Controller} from \"@tsed/common\";\nimport {StoreMerge, useDecorators} from \"@tsed/core\";\nimport {INTERACTION, INTERACTION_OPTIONS} from \"../constants\";\nimport {OidcInteractionOptions} from \"../domain\";\n\n/**\n * @Oidc\n */\nexport function Interaction(options: OidcInteractionOptions): ClassDecorator {\n return useDecorators(\n Controller({\n path: \"/\",\n subType: INTERACTION\n }),\n StoreMerge(INTERACTION_OPTIONS, options)\n );\n}\n"]}
1
+ {"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../../src/decorators/interaction.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,qCAAqD;AACrD,sDAAwE;AAGxE;;GAEG;AACH,SAAgB,WAAW,CAAC,OAA+B;IACzD,OAAO,IAAA,oBAAa,EAClB,IAAA,mBAAU,EAAC;QACT,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,uBAAW;KACrB,CAAC,EACF,IAAA,iBAAU,EAAC,+BAAmB,EAAE,OAAO,CAAC,CACzC,CAAC;AACJ,CAAC;AARD,kCAQC","sourcesContent":["import {Controller} from \"@tsed/common\";\nimport {StoreMerge, useDecorators} from \"@tsed/core\";\nimport {INTERACTION, INTERACTION_OPTIONS} from \"../constants/constants\";\nimport {OidcInteractionOptions} from \"../domain/OidcInteractionOptions\";\n\n/**\n * @Oidc\n */\nexport function Interaction(options: OidcInteractionOptions): ClassDecorator {\n return useDecorators(\n Controller({\n path: \"/\",\n subType: INTERACTION\n }),\n StoreMerge(INTERACTION_OPTIONS, options)\n );\n}\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Interactions = void 0;
4
4
  const common_1 = require("@tsed/common");
5
5
  const core_1 = require("@tsed/core");
6
- const constants_1 = require("../constants");
6
+ const constants_1 = require("../constants/constants");
7
7
  const OidcInteractionMiddleware_1 = require("../middlewares/OidcInteractionMiddleware");
8
8
  const noCache_1 = require("./noCache");
9
9
  function Interactions(options) {
@@ -1 +1 @@
1
- {"version":3,"file":"interactions.js","sourceRoot":"","sources":["../../../src/decorators/interactions.ts"],"names":[],"mappings":";;;AAAA,yCAAmD;AACnD,qCAA+C;AAC/C,4CAA0C;AAC1C,wFAAmF;AACnF,uCAAkC;AAOlC,SAAgB,YAAY,CAAC,OAA4B;IACvD,MAAM,EAAC,IAAI,EAAC,GAAG,OAAO,CAAC;IACvB,OAAO,IAAA,oBAAa,EAClB,IAAA,mBAAU,EAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,wBAAY,EAAC,CAAC,EACrE,IAAA,iBAAO,GAAE,EACT,IAAA,kBAAS,EAAC,qDAAyB,CAAC,CACrC,CAAC;AACJ,CAAC;AAPD,oCAOC","sourcesContent":["import {Controller, UseBefore} from \"@tsed/common\";\nimport {Type, useDecorators} from \"@tsed/core\";\nimport {INTERACTIONS} from \"../constants\";\nimport {OidcInteractionMiddleware} from \"../middlewares/OidcInteractionMiddleware\";\nimport {NoCache} from \"./noCache\";\n\nexport interface InteractionsOptions {\n path: string;\n children: Type<any>[];\n}\n\nexport function Interactions(options: InteractionsOptions): ClassDecorator {\n const {path} = options;\n return useDecorators(\n Controller({path, children: options.children, subType: INTERACTIONS}),\n NoCache(),\n UseBefore(OidcInteractionMiddleware)\n );\n}\n"]}
1
+ {"version":3,"file":"interactions.js","sourceRoot":"","sources":["../../../src/decorators/interactions.ts"],"names":[],"mappings":";;;AAAA,yCAAmD;AACnD,qCAA+C;AAC/C,sDAAoD;AACpD,wFAAmF;AACnF,uCAAkC;AAOlC,SAAgB,YAAY,CAAC,OAA4B;IACvD,MAAM,EAAC,IAAI,EAAC,GAAG,OAAO,CAAC;IACvB,OAAO,IAAA,oBAAa,EAClB,IAAA,mBAAU,EAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,wBAAY,EAAC,CAAC,EACrE,IAAA,iBAAO,GAAE,EACT,IAAA,kBAAS,EAAC,qDAAyB,CAAC,CACrC,CAAC;AACJ,CAAC;AAPD,oCAOC","sourcesContent":["import {Controller, UseBefore} from \"@tsed/common\";\nimport {Type, useDecorators} from \"@tsed/core\";\nimport {INTERACTIONS} from \"../constants/constants\";\nimport {OidcInteractionMiddleware} from \"../middlewares/OidcInteractionMiddleware\";\nimport {NoCache} from \"./noCache\";\n\nexport interface InteractionsOptions {\n path: string;\n children: Type<any>[];\n}\n\nexport function Interactions(options: InteractionsOptions): ClassDecorator {\n const {path} = options;\n return useDecorators(\n Controller({path, children: options.children, subType: INTERACTIONS}),\n NoCache(),\n UseBefore(OidcInteractionMiddleware)\n );\n}\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OidcCtx = void 0;
4
4
  const common_1 = require("@tsed/common");
5
5
  const core_1 = require("@tsed/core");
6
- const constants_1 = require("../constants");
6
+ const constants_1 = require("../constants/constants");
7
7
  function OidcCtx() {
8
8
  return (0, core_1.useDecorators)((0, common_1.Context)(constants_1.INTERACTION_CONTEXT));
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oidcCtx.js","sourceRoot":"","sources":["../../../src/decorators/oidcCtx.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AACzC,4CAAiD;AAGjD,SAAgB,OAAO;IACrB,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,+BAAmB,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,0BAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {INTERACTION_CONTEXT} from \"../constants\";\nimport {OidcInteractionContext} from \"../services/OidcInteractionContext\";\n\nexport function OidcCtx(): ParameterDecorator {\n return useDecorators(Context(INTERACTION_CONTEXT));\n}\n\nexport type OidcCtx = OidcInteractionContext;\n"]}
1
+ {"version":3,"file":"oidcCtx.js","sourceRoot":"","sources":["../../../src/decorators/oidcCtx.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AACzC,sDAA2D;AAG3D,SAAgB,OAAO;IACrB,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,+BAAmB,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,0BAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {INTERACTION_CONTEXT} from \"../constants/constants\";\nimport {OidcInteractionContext} from \"../services/OidcInteractionContext\";\n\nexport function OidcCtx(): ParameterDecorator {\n return useDecorators(Context(INTERACTION_CONTEXT));\n}\n\nexport type OidcCtx = OidcInteractionContext;\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OidcSession = void 0;
4
4
  const common_1 = require("@tsed/common");
5
5
  const core_1 = require("@tsed/core");
6
- const constants_1 = require("../constants");
6
+ const constants_1 = require("../constants/constants");
7
7
  /**
8
8
  * @decorator
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"oidcSession.js","sourceRoot":"","sources":["../../../src/decorators/oidcSession.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AAEzC,4CAAiD;AAEjD;;GAEG;AACH,SAAgB,WAAW,CAAC,UAAmB;IAC7C,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,CAAC,+BAAmB,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC;AAFD,kCAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {Provider} from \"oidc-provider\";\nimport {INTERACTION_SESSION} from \"../constants\";\n\n/**\n * @decorator\n */\nexport function OidcSession(expression?: string): ParameterDecorator {\n return useDecorators(Context([INTERACTION_SESSION, expression].filter(Boolean).join(\".\")));\n}\n\nexport type OidcSession = InstanceType<Provider[\"Session\"]>;\n"]}
1
+ {"version":3,"file":"oidcSession.js","sourceRoot":"","sources":["../../../src/decorators/oidcSession.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AAEzC,sDAA2D;AAE3D;;GAEG;AACH,SAAgB,WAAW,CAAC,UAAmB;IAC7C,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,CAAC,+BAAmB,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC;AAFD,kCAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {Provider} from \"oidc-provider\";\nimport {INTERACTION_SESSION} from \"../constants/constants\";\n\n/**\n * @decorator\n */\nexport function OidcSession(expression?: string): ParameterDecorator {\n return useDecorators(Context([INTERACTION_SESSION, expression].filter(Boolean).join(\".\")));\n}\n\nexport type OidcSession = InstanceType<Provider[\"Session\"]>;\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Params = void 0;
4
4
  const common_1 = require("@tsed/common");
5
5
  const core_1 = require("@tsed/core");
6
- const constants_1 = require("../constants");
6
+ const constants_1 = require("../constants/constants");
7
7
  function Params(expression) {
8
8
  return (0, core_1.useDecorators)((0, common_1.Context)([constants_1.INTERACTION_PARAMS, expression].filter(Boolean).join(".")));
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"params.js","sourceRoot":"","sources":["../../../src/decorators/params.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AACzC,4CAAgD;AAEhD,SAAgB,MAAM,CAAC,UAAmB;IACxC,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,CAAC,8BAAkB,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC;AAFD,wBAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {INTERACTION_PARAMS} from \"../constants\";\n\nexport function Params(expression?: string): ParameterDecorator {\n return useDecorators(Context([INTERACTION_PARAMS, expression].filter(Boolean).join(\".\")));\n}\n\nexport type Params = Record<string, any>;\n"]}
1
+ {"version":3,"file":"params.js","sourceRoot":"","sources":["../../../src/decorators/params.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AACzC,sDAA0D;AAE1D,SAAgB,MAAM,CAAC,UAAmB;IACxC,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,CAAC,8BAAkB,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC;AAFD,wBAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {INTERACTION_PARAMS} from \"../constants/constants\";\n\nexport function Params(expression?: string): ParameterDecorator {\n return useDecorators(Context([INTERACTION_PARAMS, expression].filter(Boolean).join(\".\")));\n}\n\nexport type Params = Record<string, any>;\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Prompt = void 0;
4
4
  const common_1 = require("@tsed/common");
5
5
  const core_1 = require("@tsed/core");
6
- const constants_1 = require("../constants");
6
+ const constants_1 = require("../constants/constants");
7
7
  function Prompt() {
8
8
  return (0, core_1.useDecorators)((0, common_1.Context)(constants_1.INTERACTION_PROMPT));
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/decorators/prompt.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AAEzC,4CAAgD;AAEhD,SAAgB,MAAM;IACpB,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,8BAAkB,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,wBAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {PromptDetail as P} from \"oidc-provider\";\nimport {INTERACTION_PROMPT} from \"../constants\";\n\nexport function Prompt(): ParameterDecorator {\n return useDecorators(Context(INTERACTION_PROMPT));\n}\n\nexport type Prompt = P;\n"]}
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/decorators/prompt.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AAEzC,sDAA0D;AAE1D,SAAgB,MAAM;IACpB,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,8BAAkB,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,wBAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {PromptDetail as P} from \"oidc-provider\";\nimport {INTERACTION_PROMPT} from \"../constants/constants\";\n\nexport function Prompt(): ParameterDecorator {\n return useDecorators(Context(INTERACTION_PROMPT));\n}\n\nexport type Prompt = P;\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Uid = void 0;
4
4
  const common_1 = require("@tsed/common");
5
5
  const core_1 = require("@tsed/core");
6
- const constants_1 = require("../constants");
6
+ const constants_1 = require("../constants/constants");
7
7
  function Uid() {
8
8
  return (0, core_1.useDecorators)((0, common_1.Context)(constants_1.INTERACTION_UID));
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"uid.js","sourceRoot":"","sources":["../../../src/decorators/uid.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AACzC,4CAA6C;AAE7C,SAAgB,GAAG;IACjB,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,2BAAe,CAAC,CAAC,CAAC;AACjD,CAAC;AAFD,kBAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {INTERACTION_UID} from \"../constants\";\n\nexport function Uid(): ParameterDecorator {\n return useDecorators(Context(INTERACTION_UID));\n}\n\nexport type Uid = string;\n"]}
1
+ {"version":3,"file":"uid.js","sourceRoot":"","sources":["../../../src/decorators/uid.ts"],"names":[],"mappings":";;;AAAA,yCAAqC;AACrC,qCAAyC;AACzC,sDAAuD;AAEvD,SAAgB,GAAG;IACjB,OAAO,IAAA,oBAAa,EAAC,IAAA,gBAAO,EAAC,2BAAe,CAAC,CAAC,CAAC;AACjD,CAAC;AAFD,kBAEC","sourcesContent":["import {Context} from \"@tsed/common\";\nimport {useDecorators} from \"@tsed/core\";\nimport {INTERACTION_UID} from \"../constants/constants\";\n\nexport function Uid(): ParameterDecorator {\n return useDecorators(Context(INTERACTION_UID));\n}\n\nexport type Uid = string;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"OidcAccountsMethods.js","sourceRoot":"","sources":["../../../src/domain/OidcAccountsMethods.ts"],"names":[],"mappings":"","sourcesContent":["import {PlatformContext} from \"@tsed/common\";\nimport {Provider, Account} from \"oidc-provider\";\n\nexport type AuthorizationCode = InstanceType<Provider[\"AuthorizationCode\"]>;\nexport type AccessToken = InstanceType<Provider[\"AccessToken\"]>;\nexport type DeviceCode = InstanceType<Provider[\"DeviceCode\"]>;\n\nexport interface OidcAccountsMethods {\n findAccount(\n id: string,\n token: AuthorizationCode | AccessToken | DeviceCode | undefined,\n ctx: PlatformContext\n ): Promise<Account | undefined>;\n}\n"]}
1
+ {"version":3,"file":"OidcAccountsMethods.js","sourceRoot":"","sources":["../../../src/domain/OidcAccountsMethods.ts"],"names":[],"mappings":"","sourcesContent":["import {Provider, Account} from \"oidc-provider\";\n\nexport type AuthorizationCode = InstanceType<Provider[\"AuthorizationCode\"]>;\nexport type AccessToken = InstanceType<Provider[\"AccessToken\"]>;\nexport type DeviceCode = InstanceType<Provider[\"DeviceCode\"]>;\nexport type BackchannelAuthenticationRequest = InstanceType<Provider[\"BackchannelAuthenticationRequest\"]>;\n\nexport interface OidcAccountsMethods {\n findAccount(\n id: string,\n token: AuthorizationCode | AccessToken | DeviceCode | BackchannelAuthenticationRequest | undefined\n ): Promise<Account | undefined>;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OidcBadInteractionName = void 0;
4
+ const exceptions_1 = require("@tsed/exceptions");
5
+ class OidcBadInteractionName extends exceptions_1.BadRequest {
6
+ }
7
+ exports.OidcBadInteractionName = OidcBadInteractionName;
8
+ //# sourceMappingURL=OidcBadInteractionName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OidcBadInteractionName.js","sourceRoot":"","sources":["../../../src/domain/OidcBadInteractionName.ts"],"names":[],"mappings":";;;AAAA,iDAA4C;AAE5C,MAAa,sBAAuB,SAAQ,uBAAU;CAAG;AAAzD,wDAAyD","sourcesContent":["import {BadRequest} from \"@tsed/exceptions\";\n\nexport class OidcBadInteractionName extends BadRequest {}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=OidcInteractionPromptProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OidcInteractionPromptProps.js","sourceRoot":"","sources":["../../../src/domain/OidcInteractionPromptProps.ts"],"names":[],"mappings":"","sourcesContent":["import {UnknownObject} from \"oidc-provider\";\nimport {OidcClient} from \"./interfaces\";\n\nexport type OidcInteractionPromptProps<Props = Record<string, any>> = {\n client: OidcClient;\n uid: string;\n grantId: string;\n details: UnknownObject;\n params: Record<string, any>;\n} & Props;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"OidcSettings.js","sourceRoot":"","sources":["../../../src/domain/OidcSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {JwksKeyParameters} from \"@tsed/jwks\";\nimport {Configuration} from \"oidc-provider\";\nimport {OidcAccountsMethods} from \"./OidcAccountsMethods\";\n\nexport interface OidcSettings extends Configuration {\n /**\n * Path on which the oidc-provider instance is mounted.\n */\n path?: string;\n /**\n * Issuer URI. By default Ts.ED create issuer with http://localhost:${httpPort}\n */\n issuer?: string;\n /**\n * Path to store jwks keys.\n */\n jwksPath?: string;\n /**\n * Generate jwks from given certificates\n */\n certificates?: JwksKeyParameters[];\n /**\n * Secure keys.\n */\n secureKey?: string[];\n /**\n * Enable proxy.\n */\n proxy?: boolean;\n /**\n * Injectable service to manage accounts.\n */\n Accounts?: Type<OidcAccountsMethods>;\n /**\n * Injectable service to manage clients.\n */\n // Clients?: Type<OidcClientsMethods>;\n}\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n oidc: OidcSettings;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"OidcSettings.js","sourceRoot":"","sources":["../../../src/domain/OidcSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {JwksKeyParameters} from \"@tsed/jwks\";\nimport {Configuration} from \"oidc-provider\";\nimport {OidcAccountsMethods} from \"./OidcAccountsMethods\";\n\nexport interface OidcSettings extends Configuration {\n /**\n * force the secure cookie. By default, in dev mode it's disabled and in production it's enabled.\n */\n secureCookies?: boolean;\n /**\n * Path on which the oidc-provider instance is mounted.\n */\n path?: string;\n /**\n * Issuer URI. By default, Ts.ED create issuer with http://localhost:${httpPort}\n */\n issuer?: string;\n /**\n * Path to store jwks keys.\n */\n jwksPath?: string;\n /**\n * Generate jwks from given certificates\n */\n certificates?: JwksKeyParameters[];\n /**\n * Secure keys.\n */\n secureKey?: string[];\n /**\n * Enable proxy.\n */\n proxy?: boolean;\n /**\n * Allow redirect_uri on HTTP protocol and localhost domain.\n */\n allowHttpLocalhost?: boolean;\n /**\n * Injectable service to manage accounts.\n */\n Accounts?: Type<OidcAccountsMethods>;\n}\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n oidc: OidcSettings;\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/domain/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import {interactionPolicy, Provider} from \"oidc-provider\";\n\nexport type OidcClient = InstanceType<Provider[\"Client\"]>;\nexport type DefaultPolicy = interactionPolicy.DefaultPolicy;\n"]}
package/lib/cjs/index.js CHANGED
@@ -1,15 +1,35 @@
1
1
  "use strict";
2
+ /**
3
+ * @file Automatically generated by barrelsby.
4
+ */
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./decorators"), exports);
5
- (0, tslib_1.__exportStar)(require("./domain"), exports);
6
- (0, tslib_1.__exportStar)(require("./middlewares/OidcInteractionMiddleware"), exports);
7
- (0, tslib_1.__exportStar)(require("./middlewares/OidcNoCacheMiddleware"), exports);
8
- (0, tslib_1.__exportStar)(require("./middlewares/OidcSecureMiddleware"), exports);
9
- (0, tslib_1.__exportStar)(require("./services/OidcAdapters"), exports);
10
- (0, tslib_1.__exportStar)(require("./services/OidcInteractions"), exports);
11
- (0, tslib_1.__exportStar)(require("./services/OidcInteractionContext"), exports);
12
- (0, tslib_1.__exportStar)(require("./services/OidcJwks"), exports);
13
- (0, tslib_1.__exportStar)(require("./services/OidcProvider"), exports);
14
- (0, tslib_1.__exportStar)(require("./OidcModule"), exports);
7
+ tslib_1.__exportStar(require("./OidcModule"), exports);
8
+ tslib_1.__exportStar(require("./constants/constants"), exports);
9
+ tslib_1.__exportStar(require("./decorators/grantId"), exports);
10
+ tslib_1.__exportStar(require("./decorators/interaction"), exports);
11
+ tslib_1.__exportStar(require("./decorators/interactions"), exports);
12
+ tslib_1.__exportStar(require("./decorators/noCache"), exports);
13
+ tslib_1.__exportStar(require("./decorators/oidcCtx"), exports);
14
+ tslib_1.__exportStar(require("./decorators/oidcSession"), exports);
15
+ tslib_1.__exportStar(require("./decorators/params"), exports);
16
+ tslib_1.__exportStar(require("./decorators/prompt"), exports);
17
+ tslib_1.__exportStar(require("./decorators/uid"), exports);
18
+ tslib_1.__exportStar(require("./domain/OidcAccountsMethods"), exports);
19
+ tslib_1.__exportStar(require("./domain/OidcBadInteractionName"), exports);
20
+ tslib_1.__exportStar(require("./domain/OidcInteraction"), exports);
21
+ tslib_1.__exportStar(require("./domain/OidcInteractionMethods"), exports);
22
+ tslib_1.__exportStar(require("./domain/OidcInteractionOptions"), exports);
23
+ tslib_1.__exportStar(require("./domain/OidcInteractionPromptProps"), exports);
24
+ tslib_1.__exportStar(require("./domain/OidcSettings"), exports);
25
+ tslib_1.__exportStar(require("./domain/interfaces"), exports);
26
+ tslib_1.__exportStar(require("./middlewares/OidcInteractionMiddleware"), exports);
27
+ tslib_1.__exportStar(require("./middlewares/OidcNoCacheMiddleware"), exports);
28
+ tslib_1.__exportStar(require("./middlewares/OidcSecureMiddleware"), exports);
29
+ tslib_1.__exportStar(require("./services/OidcAdapters"), exports);
30
+ tslib_1.__exportStar(require("./services/OidcInteractionContext"), exports);
31
+ tslib_1.__exportStar(require("./services/OidcInteractions"), exports);
32
+ tslib_1.__exportStar(require("./services/OidcJwks"), exports);
33
+ tslib_1.__exportStar(require("./services/OidcProvider"), exports);
34
+ tslib_1.__exportStar(require("./utils/debug"), exports);
15
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,4DAA6B;AAE7B,wDAAyB;AAEzB,uFAAwD;AACxD,mFAAoD;AACpD,kFAAmD;AAEnD,uEAAwC;AACxC,2EAA4C;AAC5C,iFAAkD;AAClD,mEAAoC;AACpC,uEAAwC;AAExC,4DAA6B","sourcesContent":["export * from \"./decorators\";\n\nexport * from \"./domain\";\n\nexport * from \"./middlewares/OidcInteractionMiddleware\";\nexport * from \"./middlewares/OidcNoCacheMiddleware\";\nexport * from \"./middlewares/OidcSecureMiddleware\";\n\nexport * from \"./services/OidcAdapters\";\nexport * from \"./services/OidcInteractions\";\nexport * from \"./services/OidcInteractionContext\";\nexport * from \"./services/OidcJwks\";\nexport * from \"./services/OidcProvider\";\n\nexport * from \"./OidcModule\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uDAA6B;AAC7B,gEAAsC;AACtC,+DAAqC;AACrC,mEAAyC;AACzC,oEAA0C;AAC1C,+DAAqC;AACrC,+DAAqC;AACrC,mEAAyC;AACzC,8DAAoC;AACpC,8DAAoC;AACpC,2DAAiC;AACjC,uEAA6C;AAC7C,0EAAgD;AAChD,mEAAyC;AACzC,0EAAgD;AAChD,0EAAgD;AAChD,8EAAoD;AACpD,gEAAsC;AACtC,8DAAoC;AACpC,kFAAwD;AACxD,8EAAoD;AACpD,6EAAmD;AACnD,kEAAwC;AACxC,4EAAkD;AAClD,sEAA4C;AAC5C,8DAAoC;AACpC,kEAAwC;AACxC,wDAA8B","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./OidcModule\";\nexport * from \"./constants/constants\";\nexport * from \"./decorators/grantId\";\nexport * from \"./decorators/interaction\";\nexport * from \"./decorators/interactions\";\nexport * from \"./decorators/noCache\";\nexport * from \"./decorators/oidcCtx\";\nexport * from \"./decorators/oidcSession\";\nexport * from \"./decorators/params\";\nexport * from \"./decorators/prompt\";\nexport * from \"./decorators/uid\";\nexport * from \"./domain/OidcAccountsMethods\";\nexport * from \"./domain/OidcBadInteractionName\";\nexport * from \"./domain/OidcInteraction\";\nexport * from \"./domain/OidcInteractionMethods\";\nexport * from \"./domain/OidcInteractionOptions\";\nexport * from \"./domain/OidcInteractionPromptProps\";\nexport * from \"./domain/OidcSettings\";\nexport * from \"./domain/interfaces\";\nexport * from \"./middlewares/OidcInteractionMiddleware\";\nexport * from \"./middlewares/OidcNoCacheMiddleware\";\nexport * from \"./middlewares/OidcSecureMiddleware\";\nexport * from \"./services/OidcAdapters\";\nexport * from \"./services/OidcInteractionContext\";\nexport * from \"./services/OidcInteractions\";\nexport * from \"./services/OidcJwks\";\nexport * from \"./services/OidcProvider\";\nexport * from \"./utils/debug\";\n"]}
@@ -3,38 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OidcInteractionMiddleware = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@tsed/common");
6
- const constants_1 = require("../constants");
7
6
  const OidcInteractionContext_1 = require("../services/OidcInteractionContext");
8
- const OidcInteractions_1 = require("../services/OidcInteractions");
9
7
  let OidcInteractionMiddleware = class OidcInteractionMiddleware {
10
- async use(context) {
11
- const oidcInteraction = this.injector.invoke(OidcInteractionContext_1.OidcInteractionContext, context.container);
12
- const interactionDetails = await oidcInteraction.interactionDetails();
13
- const { uid, prompt, params, session, grantId } = interactionDetails;
14
- context.set(constants_1.INTERACTION_CONTEXT, oidcInteraction);
15
- context.set(constants_1.INTERACTION_DETAILS, interactionDetails);
16
- context.set(constants_1.INTERACTION_UID, uid);
17
- context.set(constants_1.INTERACTION_PROMPT, prompt);
18
- context.set(constants_1.INTERACTION_PARAMS, params);
19
- context.set(constants_1.INTERACTION_GRANT_ID, grantId);
20
- context.set(constants_1.INTERACTION_SESSION, session);
8
+ oidcInteractionContext;
9
+ async use() {
10
+ await this.oidcInteractionContext.interactionDetails();
21
11
  }
22
12
  };
23
- (0, tslib_1.__decorate)([
13
+ tslib_1.__decorate([
24
14
  (0, common_1.Inject)(),
25
- (0, tslib_1.__metadata)("design:type", OidcInteractions_1.OidcInteractions)
26
- ], OidcInteractionMiddleware.prototype, "oidcInteractions", void 0);
27
- (0, tslib_1.__decorate)([
28
- (0, common_1.Inject)(),
29
- (0, tslib_1.__metadata)("design:type", common_1.InjectorService)
30
- ], OidcInteractionMiddleware.prototype, "injector", void 0);
31
- (0, tslib_1.__decorate)([
32
- (0, tslib_1.__param)(0, (0, common_1.Context)()),
33
- (0, tslib_1.__metadata)("design:type", Function),
34
- (0, tslib_1.__metadata)("design:paramtypes", [Object]),
35
- (0, tslib_1.__metadata)("design:returntype", Promise)
36
- ], OidcInteractionMiddleware.prototype, "use", null);
37
- OidcInteractionMiddleware = (0, tslib_1.__decorate)([
15
+ tslib_1.__metadata("design:type", OidcInteractionContext_1.OidcInteractionContext)
16
+ ], OidcInteractionMiddleware.prototype, "oidcInteractionContext", void 0);
17
+ OidcInteractionMiddleware = tslib_1.__decorate([
38
18
  (0, common_1.Middleware)()
39
19
  ], OidcInteractionMiddleware);
40
20
  exports.OidcInteractionMiddleware = OidcInteractionMiddleware;
@@ -1 +1 @@
1
- {"version":3,"file":"OidcInteractionMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcInteractionMiddleware.ts"],"names":[],"mappings":";;;;AAAA,yCAA0E;AAC1E,4CAQsB;AACtB,+EAA0E;AAC1E,mEAA8D;AAG9D,IAAa,yBAAyB,GAAtC,MAAa,yBAAyB;IAOpC,KAAK,CAAC,GAAG,CAAY,OAAgB;QACnC,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAyB,+CAAsB,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QAChH,MAAM,kBAAkB,GAAG,MAAM,eAAe,CAAC,kBAAkB,EAAE,CAAC;QACtE,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAC,GAAG,kBAAyB,CAAC;QAE1E,OAAO,CAAC,GAAG,CAAC,+BAAmB,EAAE,eAAe,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,+BAAmB,EAAE,kBAAkB,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,2BAAe,EAAE,GAAG,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,8BAAkB,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,8BAAkB,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,gCAAoB,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,+BAAmB,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF,CAAA;AAlBC;IADC,IAAA,eAAM,GAAE;2CACmB,mCAAgB;mEAAC;AAG7C;IADC,IAAA,eAAM,GAAE;2CACW,wBAAe;2DAAC;AAEpC;IAAW,wBAAA,IAAA,gBAAO,GAAE,CAAA;;;;oDAYnB;AAnBU,yBAAyB;IADrC,IAAA,mBAAU,GAAE;GACA,yBAAyB,CAoBrC;AApBY,8DAAyB","sourcesContent":["import {Context, Inject, InjectorService, Middleware} from \"@tsed/common\";\nimport {\n INTERACTION_CONTEXT,\n INTERACTION_DETAILS,\n INTERACTION_PARAMS,\n INTERACTION_GRANT_ID,\n INTERACTION_PROMPT,\n INTERACTION_SESSION,\n INTERACTION_UID\n} from \"../constants\";\nimport {OidcInteractionContext} from \"../services/OidcInteractionContext\";\nimport {OidcInteractions} from \"../services/OidcInteractions\";\n\n@Middleware()\nexport class OidcInteractionMiddleware {\n @Inject()\n protected oidcInteractions: OidcInteractions;\n\n @Inject()\n protected injector: InjectorService;\n\n async use(@Context() context: Context) {\n const oidcInteraction = this.injector.invoke<OidcInteractionContext>(OidcInteractionContext, context.container);\n const interactionDetails = await oidcInteraction.interactionDetails();\n const {uid, prompt, params, session, grantId} = interactionDetails as any;\n\n context.set(INTERACTION_CONTEXT, oidcInteraction);\n context.set(INTERACTION_DETAILS, interactionDetails);\n context.set(INTERACTION_UID, uid);\n context.set(INTERACTION_PROMPT, prompt);\n context.set(INTERACTION_PARAMS, params);\n context.set(INTERACTION_GRANT_ID, grantId);\n context.set(INTERACTION_SESSION, session);\n }\n}\n"]}
1
+ {"version":3,"file":"OidcInteractionMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcInteractionMiddleware.ts"],"names":[],"mappings":";;;;AAAA,yCAAgD;AAChD,+EAA0E;AAG1E,IAAa,yBAAyB,GAAtC,MAAa,yBAAyB;IAE1B,sBAAsB,CAAyB;IAEzD,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,CAAC;IACzD,CAAC;CACF,CAAA;AALC;IADC,IAAA,eAAM,GAAE;sCACyB,+CAAsB;yEAAC;AAF9C,yBAAyB;IADrC,IAAA,mBAAU,GAAE;GACA,yBAAyB,CAOrC;AAPY,8DAAyB","sourcesContent":["import {Inject, Middleware} from \"@tsed/common\";\nimport {OidcInteractionContext} from \"../services/OidcInteractionContext\";\n\n@Middleware()\nexport class OidcInteractionMiddleware {\n @Inject()\n protected oidcInteractionContext: OidcInteractionContext;\n\n async use() {\n await this.oidcInteractionContext.interactionDetails();\n }\n}\n"]}
@@ -9,13 +9,13 @@ let OidcNoCacheMiddleware = class OidcNoCacheMiddleware {
9
9
  ctx.response.setHeader("Cache-Control", "no-cache, no-store");
10
10
  }
11
11
  };
12
- (0, tslib_1.__decorate)([
13
- (0, tslib_1.__param)(0, (0, common_1.Context)()),
14
- (0, tslib_1.__metadata)("design:type", Function),
15
- (0, tslib_1.__metadata)("design:paramtypes", [Object]),
16
- (0, tslib_1.__metadata)("design:returntype", void 0)
12
+ tslib_1.__decorate([
13
+ tslib_1.__param(0, (0, common_1.Context)()),
14
+ tslib_1.__metadata("design:type", Function),
15
+ tslib_1.__metadata("design:paramtypes", [Object]),
16
+ tslib_1.__metadata("design:returntype", void 0)
17
17
  ], OidcNoCacheMiddleware.prototype, "use", null);
18
- OidcNoCacheMiddleware = (0, tslib_1.__decorate)([
18
+ OidcNoCacheMiddleware = tslib_1.__decorate([
19
19
  (0, common_1.Middleware)()
20
20
  ], OidcNoCacheMiddleware);
21
21
  exports.OidcNoCacheMiddleware = OidcNoCacheMiddleware;
@@ -1 +1 @@
1
- {"version":3,"file":"OidcNoCacheMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcNoCacheMiddleware.ts"],"names":[],"mappings":";;;;AAAA,yCAAoE;AAGpE,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;IAChC,GAAG,CAAY,GAAY;QACzB,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC7C,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;IAChE,CAAC;CACF,CAAA;AAJC;IAAK,wBAAA,IAAA,gBAAO,GAAE,CAAA;;;;gDAGb;AAJU,qBAAqB;IADjC,IAAA,mBAAU,GAAE;GACA,qBAAqB,CAKjC;AALY,sDAAqB","sourcesContent":["import {Context, Middleware, MiddlewareMethods} from \"@tsed/common\";\n\n@Middleware()\nexport class OidcNoCacheMiddleware implements MiddlewareMethods {\n use(@Context() ctx: Context) {\n ctx.response.setHeader(\"Pragma\", \"no-cache\");\n ctx.response.setHeader(\"Cache-Control\", \"no-cache, no-store\");\n }\n}\n"]}
1
+ {"version":3,"file":"OidcNoCacheMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcNoCacheMiddleware.ts"],"names":[],"mappings":";;;;AAAA,yCAAoE;AAGpE,IAAa,qBAAqB,GAAlC,MAAa,qBAAqB;IAChC,GAAG,CAAY,GAAY;QACzB,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC7C,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC;IAChE,CAAC;CACF,CAAA;AAJC;IAAK,mBAAA,IAAA,gBAAO,GAAE,CAAA;;;;gDAGb;AAJU,qBAAqB;IADjC,IAAA,mBAAU,GAAE;GACA,qBAAqB,CAKjC;AALY,sDAAqB","sourcesContent":["import {Context, Middleware, MiddlewareMethods} from \"@tsed/common\";\n\n@Middleware()\nexport class OidcNoCacheMiddleware implements MiddlewareMethods {\n use(@Context() ctx: Context) {\n ctx.response.setHeader(\"Pragma\", \"no-cache\");\n ctx.response.setHeader(\"Cache-Control\", \"no-cache, no-store\");\n }\n}\n"]}
@@ -4,7 +4,7 @@ exports.OidcSecureMiddleware = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@tsed/common");
6
6
  const exceptions_1 = require("@tsed/exceptions");
7
- const url_1 = (0, tslib_1.__importDefault)(require("url"));
7
+ const url_1 = tslib_1.__importDefault(require("url"));
8
8
  let OidcSecureMiddleware = class OidcSecureMiddleware {
9
9
  use(ctx) {
10
10
  const req = ctx.request;
@@ -25,13 +25,13 @@ let OidcSecureMiddleware = class OidcSecureMiddleware {
25
25
  }
26
26
  }
27
27
  };
28
- (0, tslib_1.__decorate)([
29
- (0, tslib_1.__param)(0, (0, common_1.Context)()),
30
- (0, tslib_1.__metadata)("design:type", Function),
31
- (0, tslib_1.__metadata)("design:paramtypes", [Object]),
32
- (0, tslib_1.__metadata)("design:returntype", void 0)
28
+ tslib_1.__decorate([
29
+ tslib_1.__param(0, (0, common_1.Context)()),
30
+ tslib_1.__metadata("design:type", Function),
31
+ tslib_1.__metadata("design:paramtypes", [Object]),
32
+ tslib_1.__metadata("design:returntype", void 0)
33
33
  ], OidcSecureMiddleware.prototype, "use", null);
34
- OidcSecureMiddleware = (0, tslib_1.__decorate)([
34
+ OidcSecureMiddleware = tslib_1.__decorate([
35
35
  (0, common_1.Middleware)()
36
36
  ], OidcSecureMiddleware);
37
37
  exports.OidcSecureMiddleware = OidcSecureMiddleware;
@@ -1 +1 @@
1
- {"version":3,"file":"OidcSecureMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcSecureMiddleware.ts"],"names":[],"mappings":";;;;AAAA,yCAAoE;AACpE,iDAA4C;AAC5C,2DAAsB;AAGtB,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAC/B,GAAG,CAAY,GAAY;QACzB,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC;QAExB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACf,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;gBACjD,GAAG,CAAC,QAAQ,CAAC,QAAQ,CACnB,GAAG,EACH,aAAG,CAAC,MAAM,CAAC;oBACT,QAAQ,EAAE,OAAO;oBACjB,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;oBACrB,QAAQ,EAAE,GAAG,CAAC,GAAG;iBAClB,CAAC,CACH,CAAC;aACH;iBAAM;gBACL,MAAM,IAAI,uBAAU,CAAC,gBAAgB,EAAE;oBACrC,KAAK,EAAE,iBAAiB;oBACxB,iBAAiB,EAAE,wCAAwC;iBAC5D,CAAC,CAAC;aACJ;SACF;IACH,CAAC;CACF,CAAA;AArBC;IAAK,wBAAA,IAAA,gBAAO,GAAE,CAAA;;;;+CAoBb;AArBU,oBAAoB;IADhC,IAAA,mBAAU,GAAE;GACA,oBAAoB,CAsBhC;AAtBY,oDAAoB","sourcesContent":["import {Context, Middleware, MiddlewareMethods} from \"@tsed/common\";\nimport {BadRequest} from \"@tsed/exceptions\";\nimport url from \"url\";\n\n@Middleware()\nexport class OidcSecureMiddleware implements MiddlewareMethods {\n use(@Context() ctx: Context) {\n const req = ctx.request;\n\n if (!req.secure) {\n if (req.method === \"GET\" || req.method === \"HEAD\") {\n ctx.response.redirect(\n 302,\n url.format({\n protocol: \"https\",\n host: req.get(\"host\"),\n pathname: req.url\n })\n );\n } else {\n throw new BadRequest(\"InvalidRequest\", {\n error: \"invalid_request\",\n error_description: \"Do yourself a favor and only use https\"\n });\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"OidcSecureMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcSecureMiddleware.ts"],"names":[],"mappings":";;;;AAAA,yCAAoE;AACpE,iDAA4C;AAC5C,sDAAsB;AAGtB,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAC/B,GAAG,CAAY,GAAY;QACzB,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC;QAExB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACf,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;gBACjD,GAAG,CAAC,QAAQ,CAAC,QAAQ,CACnB,GAAG,EACH,aAAG,CAAC,MAAM,CAAC;oBACT,QAAQ,EAAE,OAAO;oBACjB,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;oBACrB,QAAQ,EAAE,GAAG,CAAC,GAAG;iBAClB,CAAC,CACH,CAAC;aACH;iBAAM;gBACL,MAAM,IAAI,uBAAU,CAAC,gBAAgB,EAAE;oBACrC,KAAK,EAAE,iBAAiB;oBACxB,iBAAiB,EAAE,wCAAwC;iBAC5D,CAAC,CAAC;aACJ;SACF;IACH,CAAC;CACF,CAAA;AArBC;IAAK,mBAAA,IAAA,gBAAO,GAAE,CAAA;;;;+CAoBb;AArBU,oBAAoB;IADhC,IAAA,mBAAU,GAAE;GACA,oBAAoB,CAsBhC;AAtBY,oDAAoB","sourcesContent":["import {Context, Middleware, MiddlewareMethods} from \"@tsed/common\";\nimport {BadRequest} from \"@tsed/exceptions\";\nimport url from \"url\";\n\n@Middleware()\nexport class OidcSecureMiddleware implements MiddlewareMethods {\n use(@Context() ctx: Context) {\n const req = ctx.request;\n\n if (!req.secure) {\n if (req.method === \"GET\" || req.method === \"HEAD\") {\n ctx.response.redirect(\n 302,\n url.format({\n protocol: \"https\",\n host: req.get(\"host\"),\n pathname: req.url\n })\n );\n } else {\n throw new BadRequest(\"InvalidRequest\", {\n error: \"invalid_request\",\n error_description: \"Do yourself a favor and only use https\"\n });\n }\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }