@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.
- package/coverage.json +6 -0
- package/jest.config.js +9 -0
- package/lib/cjs/OidcModule.js +28 -18
- package/lib/cjs/OidcModule.js.map +1 -1
- package/lib/cjs/constants/{index.js → constants.js} +1 -1
- package/lib/cjs/constants/constants.js.map +1 -0
- package/lib/cjs/decorators/grantId.js +1 -1
- package/lib/cjs/decorators/grantId.js.map +1 -1
- package/lib/cjs/decorators/interaction.js +1 -1
- package/lib/cjs/decorators/interaction.js.map +1 -1
- package/lib/cjs/decorators/interactions.js +1 -1
- package/lib/cjs/decorators/interactions.js.map +1 -1
- package/lib/cjs/decorators/oidcCtx.js +1 -1
- package/lib/cjs/decorators/oidcCtx.js.map +1 -1
- package/lib/cjs/decorators/oidcSession.js +1 -1
- package/lib/cjs/decorators/oidcSession.js.map +1 -1
- package/lib/cjs/decorators/params.js +1 -1
- package/lib/cjs/decorators/params.js.map +1 -1
- package/lib/cjs/decorators/prompt.js +1 -1
- package/lib/cjs/decorators/prompt.js.map +1 -1
- package/lib/cjs/decorators/uid.js +1 -1
- package/lib/cjs/decorators/uid.js.map +1 -1
- package/lib/cjs/domain/OidcAccountsMethods.js.map +1 -1
- package/lib/cjs/domain/OidcBadInteractionName.js +8 -0
- package/lib/cjs/domain/OidcBadInteractionName.js.map +1 -0
- package/lib/cjs/domain/OidcInteractionPromptProps.js +3 -0
- package/lib/cjs/domain/OidcInteractionPromptProps.js.map +1 -0
- package/lib/cjs/domain/OidcSettings.js.map +1 -1
- package/lib/cjs/domain/interfaces.js +3 -0
- package/lib/cjs/domain/interfaces.js.map +1 -0
- package/lib/cjs/index.js +31 -11
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/middlewares/OidcInteractionMiddleware.js +7 -27
- package/lib/cjs/middlewares/OidcInteractionMiddleware.js.map +1 -1
- package/lib/cjs/middlewares/OidcNoCacheMiddleware.js +6 -6
- package/lib/cjs/middlewares/OidcNoCacheMiddleware.js.map +1 -1
- package/lib/cjs/middlewares/OidcSecureMiddleware.js +7 -7
- package/lib/cjs/middlewares/OidcSecureMiddleware.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/services/OidcAdapters.js +25 -3
- package/lib/cjs/services/OidcAdapters.js.map +1 -1
- package/lib/cjs/services/OidcInteractionContext.js +70 -25
- package/lib/cjs/services/OidcInteractionContext.js.map +1 -1
- package/lib/cjs/services/OidcInteractions.js +16 -15
- package/lib/cjs/services/OidcInteractions.js.map +1 -1
- package/lib/cjs/services/OidcJwks.js +8 -5
- package/lib/cjs/services/OidcJwks.js.map +1 -1
- package/lib/cjs/services/OidcProvider.js +43 -31
- package/lib/cjs/services/OidcProvider.js.map +1 -1
- package/lib/cjs/utils/debug.js +1 -1
- package/lib/cjs/utils/debug.js.map +1 -1
- package/lib/esm/OidcModule.js +20 -10
- package/lib/esm/OidcModule.js.map +1 -1
- package/lib/esm/constants/{index.js → constants.js} +1 -1
- package/lib/esm/constants/constants.js.map +1 -0
- package/lib/esm/decorators/grantId.js +1 -1
- package/lib/esm/decorators/grantId.js.map +1 -1
- package/lib/esm/decorators/interaction.js +1 -1
- package/lib/esm/decorators/interaction.js.map +1 -1
- package/lib/esm/decorators/interactions.js +3 -3
- package/lib/esm/decorators/interactions.js.map +1 -1
- package/lib/esm/decorators/noCache.js +1 -1
- package/lib/esm/decorators/oidcCtx.js +1 -1
- package/lib/esm/decorators/oidcCtx.js.map +1 -1
- package/lib/esm/decorators/oidcSession.js +1 -1
- package/lib/esm/decorators/oidcSession.js.map +1 -1
- package/lib/esm/decorators/params.js +1 -1
- package/lib/esm/decorators/params.js.map +1 -1
- package/lib/esm/decorators/prompt.js +1 -1
- package/lib/esm/decorators/prompt.js.map +1 -1
- package/lib/esm/decorators/uid.js +1 -1
- package/lib/esm/decorators/uid.js.map +1 -1
- package/lib/esm/domain/OidcAccountsMethods.js.map +1 -1
- package/lib/esm/domain/OidcBadInteractionName.js +4 -0
- package/lib/esm/domain/OidcBadInteractionName.js.map +1 -0
- package/lib/esm/domain/OidcInteractionPromptProps.js +2 -0
- package/lib/esm/domain/OidcInteractionPromptProps.js.map +1 -0
- package/lib/esm/domain/OidcSettings.js.map +1 -1
- package/lib/esm/domain/interfaces.js +2 -0
- package/lib/esm/domain/interfaces.js.map +1 -0
- package/lib/esm/index.js +31 -11
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/middlewares/OidcInteractionMiddleware.js +8 -28
- package/lib/esm/middlewares/OidcInteractionMiddleware.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/OidcAdapters.js +22 -0
- package/lib/esm/services/OidcAdapters.js.map +1 -1
- package/lib/esm/services/OidcInteractionContext.js +65 -20
- package/lib/esm/services/OidcInteractionContext.js.map +1 -1
- package/lib/esm/services/OidcInteractions.js +9 -8
- package/lib/esm/services/OidcInteractions.js.map +1 -1
- package/lib/esm/services/OidcJwks.js +3 -0
- package/lib/esm/services/OidcJwks.js.map +1 -1
- package/lib/esm/services/OidcProvider.js +24 -12
- package/lib/esm/services/OidcProvider.js.map +1 -1
- package/lib/types/OidcModule.d.ts +5 -5
- package/lib/types/constants/{index.d.ts → constants.d.ts} +0 -0
- package/lib/types/decorators/interaction.d.ts +1 -1
- package/lib/types/domain/OidcAccountsMethods.d.ts +2 -2
- package/lib/types/domain/OidcBadInteractionName.d.ts +3 -0
- package/lib/types/domain/OidcInteractionPromptProps.d.ts +9 -0
- package/lib/types/domain/OidcSettings.d.ts +9 -1
- package/lib/types/domain/interfaces.d.ts +3 -0
- package/lib/types/index.d.ts +24 -4
- package/lib/types/middlewares/OidcInteractionMiddleware.d.ts +3 -5
- package/lib/types/services/OidcAdapters.d.ts +3 -2
- package/lib/types/services/OidcInteractionContext.d.ts +9 -4
- package/lib/types/services/OidcInteractions.d.ts +1 -1
- package/lib/types/services/OidcProvider.d.ts +3 -3
- package/package.json +26 -23
- package/readme.md +31 -35
- package/tsconfig.compile.esm.json +1 -12
- package/.mocharc.js +0 -5
- package/.nycrc +0 -27
- package/lib/cjs/constants/index.js.map +0 -1
- package/lib/cjs/decorators/index.js +0 -13
- package/lib/cjs/decorators/index.js.map +0 -1
- package/lib/cjs/domain/index.js +0 -9
- package/lib/cjs/domain/index.js.map +0 -1
- package/lib/esm/constants/index.js.map +0 -1
- package/lib/esm/decorators/index.js +0 -10
- package/lib/esm/decorators/index.js.map +0 -1
- package/lib/esm/domain/index.js +0 -6
- package/lib/esm/domain/index.js.map +0 -1
- package/lib/types/decorators/index.d.ts +0 -9
- package/lib/types/domain/index.d.ts +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../src/utils/debug.ts"],"names":[],"mappings":";;;;AAAA,qCAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../src/utils/debug.ts"],"names":[],"mappings":";;;;AAAA,qCAAmC;AACnC,sEAA6B;AAC7B,+BAA6B;AAE7B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;AAEvB,SAAS,SAAS,CAAC,GAAQ;IACzB,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC3D,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEd,IAAI,IAAA,cAAO,EAAC,KAAK,CAAC,EAAE;YAClB,OAAO,GAAG,CAAC;SACZ;QAED,GAAG,CAAC,GAAG,CAAC,GAAG,IAAA,cAAO,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAEM,MAAM,KAAK,GAAG,CAAC,GAAQ,EAAE,EAAE,CAChC,qBAAE,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1C,kBAAkB,CAAC,KAAK;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,CAAC;CACF,CAAC,CAAC;AALQ,QAAA,KAAK,SAKb","sourcesContent":["import {isEmpty} from \"@tsed/core\";\nimport qs from \"querystring\";\nimport {inspect} from \"util\";\n\nconst keys = new Set();\n\nfunction serialize(obj: any) {\n return Object.entries(obj).reduce((acc: any, [key, value]) => {\n keys.add(key);\n\n if (isEmpty(value)) {\n return acc;\n }\n\n acc[key] = inspect(value, {depth: null});\n return acc;\n }, {});\n}\n\nexport const debug = (obj: any) =>\n qs.stringify(serialize(obj), \"<br/>\", \": \", {\n encodeURIComponent(value) {\n return keys.has(value) ? `<strong>${value}</strong>` : value;\n }\n });\n"]}
|
package/lib/esm/OidcModule.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Inject, InjectorService, PlatformApplication } from "@tsed/common";
|
|
3
3
|
import { Constant, Module } from "@tsed/di";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import koaMount from "koa-mount";
|
|
5
|
+
import { OidcAdapters } from "./services/OidcAdapters.js";
|
|
6
|
+
import { OidcJwks } from "./services/OidcJwks.js";
|
|
7
|
+
import { OidcProvider } from "./services/OidcProvider.js";
|
|
7
8
|
let OidcModule = class OidcModule {
|
|
9
|
+
app;
|
|
10
|
+
platformName;
|
|
11
|
+
basePath;
|
|
12
|
+
oidcProvider;
|
|
13
|
+
injector;
|
|
8
14
|
async $onInit() {
|
|
9
15
|
if (this.oidcProvider.hasConfiguration()) {
|
|
10
16
|
await this.oidcProvider.create();
|
|
@@ -12,7 +18,7 @@ let OidcModule = class OidcModule {
|
|
|
12
18
|
}
|
|
13
19
|
async $onRoutesInit() {
|
|
14
20
|
if (this.basePath !== "/") {
|
|
15
|
-
this.app.use(this.getRewriteMiddleware());
|
|
21
|
+
this.app.use(await this.getRewriteMiddleware());
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
async $afterRoutesInit() {
|
|
@@ -24,26 +30,30 @@ let OidcModule = class OidcModule {
|
|
|
24
30
|
this.app.use(this.basePath, provider.callback());
|
|
25
31
|
break;
|
|
26
32
|
case "koa":
|
|
27
|
-
this.app.use(
|
|
33
|
+
this.app.use(koaMount(this.basePath, provider.app));
|
|
28
34
|
break;
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
38
|
$onReady() {
|
|
33
|
-
if (this.oidcProvider.hasConfiguration() && this.injector.settings
|
|
39
|
+
if (this.oidcProvider.hasConfiguration() && "getBestHost" in this.injector.settings) {
|
|
34
40
|
const { injector } = this;
|
|
41
|
+
// @ts-ignore
|
|
35
42
|
const host = injector.settings.getBestHost();
|
|
36
43
|
const url = host.toString();
|
|
37
44
|
injector.logger.info(`WellKnown is available on ${url}/.well-known/openid-configuration`);
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
|
-
getRewriteMiddleware() {
|
|
47
|
+
async getRewriteMiddleware() {
|
|
41
48
|
switch (this.platformName) {
|
|
42
49
|
default:
|
|
43
50
|
case "express":
|
|
44
|
-
|
|
51
|
+
const { default: expressUrlRewrite } = await import("express-urlrewrite");
|
|
52
|
+
return expressUrlRewrite("/.well-known/*", `${this.basePath}/.well-known/$1`);
|
|
45
53
|
case "koa":
|
|
46
|
-
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
const { default: koaUrlRewrite } = await import("koa-rewrite");
|
|
56
|
+
return koaUrlRewrite("/.well-known/(.*)", `${this.basePath}/.well-known/$1`);
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
};
|
|
@@ -56,7 +66,7 @@ __decorate([
|
|
|
56
66
|
__metadata("design:type", String)
|
|
57
67
|
], OidcModule.prototype, "platformName", void 0);
|
|
58
68
|
__decorate([
|
|
59
|
-
Constant("oidc.path", "/"),
|
|
69
|
+
Constant("oidc.path", "/oidc"),
|
|
60
70
|
__metadata("design:type", String)
|
|
61
71
|
], OidcModule.prototype, "basePath", void 0);
|
|
62
72
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcModule.js","sourceRoot":"","sources":["../../src/OidcModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAE,eAAe,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAKrD,IAAa,UAAU,GAAvB,MAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"OidcModule.js","sourceRoot":"","sources":["../../src/OidcModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAE,eAAe,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;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;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BAAoB;QAChC,QAAQ,IAAI,CAAC,YAAY,EAAE;YACzB,QAAQ;YACR,KAAK,SAAS;gBACZ,MAAM,EAAC,OAAO,EAAE,iBAAiB,EAAC,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,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,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;gBAC7D,OAAO,aAAa,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC,QAAQ,iBAAiB,CAAC,CAAC;SAChF;IACH,CAAC;CACF,CAAA;AAjEC;IADC,MAAM,EAAE;8BACM,mBAAmB;uCAAC;AAGnC;IADC,QAAQ,CAAC,eAAe,CAAC;;gDACK;AAG/B;IADC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;;4CACJ;AAG3B;IADC,MAAM,EAAE;8BACe,YAAY;gDAAC;AAGrC;IADC,MAAM,EAAE;8BACW,eAAe;4CAAC;AAdzB,UAAU;IAHtB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC;KAChD,CAAC;GACW,UAAU,CAmEtB;SAnEY,UAAU","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"]}
|
|
@@ -8,4 +8,4 @@ export const INTERACTION_DETAILS = "interactionDetails";
|
|
|
8
8
|
export const INTERACTION_OPTIONS = "interactionOptions";
|
|
9
9
|
export const INTERACTION = "interaction";
|
|
10
10
|
export const INTERACTIONS = "interactions";
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "@tsed/common";
|
|
2
2
|
import { useDecorators } from "@tsed/core";
|
|
3
|
-
import { INTERACTION_GRANT_ID } from "../constants";
|
|
3
|
+
import { INTERACTION_GRANT_ID } from "../constants/constants.js";
|
|
4
4
|
export function GrantId() {
|
|
5
5
|
return useDecorators(Context(INTERACTION_GRANT_ID));
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grantId.js","sourceRoot":"","sources":["../../../src/decorators/grantId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,oBAAoB,EAAqB,MAAM,
|
|
1
|
+
{"version":3,"file":"grantId.js","sourceRoot":"","sources":["../../../src/decorators/grantId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,oBAAoB,EAAqB,MAAM,wBAAwB,CAAC;AAEhF,MAAM,UAAU,OAAO;IACrB,OAAO,aAAa,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;AACtD,CAAC","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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Controller } from "@tsed/common";
|
|
2
2
|
import { StoreMerge, useDecorators } from "@tsed/core";
|
|
3
|
-
import { INTERACTION, INTERACTION_OPTIONS } from "../constants";
|
|
3
|
+
import { INTERACTION, INTERACTION_OPTIONS } from "../constants/constants.js";
|
|
4
4
|
/**
|
|
5
5
|
* @Oidc
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../../src/decorators/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"interaction.js","sourceRoot":"","sources":["../../../src/decorators/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAGxE;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAA+B;IACzD,OAAO,aAAa,CAClB,UAAU,CAAC;QACT,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,WAAW;KACrB,CAAC,EACF,UAAU,CAAC,mBAAmB,EAAE,OAAO,CAAC,CACzC,CAAC;AACJ,CAAC","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"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Controller, UseBefore } from "@tsed/common";
|
|
2
2
|
import { useDecorators } from "@tsed/core";
|
|
3
|
-
import { INTERACTIONS } from "../constants";
|
|
4
|
-
import { OidcInteractionMiddleware } from "../middlewares/OidcInteractionMiddleware";
|
|
5
|
-
import { NoCache } from "./noCache";
|
|
3
|
+
import { INTERACTIONS } from "../constants/constants.js";
|
|
4
|
+
import { OidcInteractionMiddleware } from "../middlewares/OidcInteractionMiddleware.js";
|
|
5
|
+
import { NoCache } from "./noCache.js";
|
|
6
6
|
export function Interactions(options) {
|
|
7
7
|
const { path } = options;
|
|
8
8
|
return useDecorators(Controller({ path, children: options.children, subType: INTERACTIONS }), NoCache(), UseBefore(OidcInteractionMiddleware));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactions.js","sourceRoot":"","sources":["../../../src/decorators/interactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAO,aAAa,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"interactions.js","sourceRoot":"","sources":["../../../src/decorators/interactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAO,aAAa,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAC,yBAAyB,EAAC,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAOlC,MAAM,UAAU,YAAY,CAAC,OAA4B;IACvD,MAAM,EAAC,IAAI,EAAC,GAAG,OAAO,CAAC;IACvB,OAAO,aAAa,CAClB,UAAU,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAC,CAAC,EACrE,OAAO,EAAE,EACT,SAAS,CAAC,yBAAyB,CAAC,CACrC,CAAC;AACJ,CAAC","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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseBefore } from "@tsed/common";
|
|
2
|
-
import { OidcNoCacheMiddleware } from "../middlewares/OidcNoCacheMiddleware";
|
|
2
|
+
import { OidcNoCacheMiddleware } from "../middlewares/OidcNoCacheMiddleware.js";
|
|
3
3
|
export function NoCache() {
|
|
4
4
|
return UseBefore(OidcNoCacheMiddleware);
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "@tsed/common";
|
|
2
2
|
import { useDecorators } from "@tsed/core";
|
|
3
|
-
import { INTERACTION_CONTEXT } from "../constants";
|
|
3
|
+
import { INTERACTION_CONTEXT } from "../constants/constants.js";
|
|
4
4
|
export function OidcCtx() {
|
|
5
5
|
return useDecorators(Context(INTERACTION_CONTEXT));
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidcCtx.js","sourceRoot":"","sources":["../../../src/decorators/oidcCtx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"oidcCtx.js","sourceRoot":"","sources":["../../../src/decorators/oidcCtx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAG3D,MAAM,UAAU,OAAO;IACrB,OAAO,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC;AACrD,CAAC","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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidcSession.js","sourceRoot":"","sources":["../../../src/decorators/oidcSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"oidcSession.js","sourceRoot":"","sources":["../../../src/decorators/oidcSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAE3D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,UAAmB;IAC7C,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC","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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "@tsed/common";
|
|
2
2
|
import { useDecorators } from "@tsed/core";
|
|
3
|
-
import { INTERACTION_PARAMS } from "../constants";
|
|
3
|
+
import { INTERACTION_PARAMS } from "../constants/constants.js";
|
|
4
4
|
export function Params(expression) {
|
|
5
5
|
return useDecorators(Context([INTERACTION_PARAMS, expression].filter(Boolean).join(".")));
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.js","sourceRoot":"","sources":["../../../src/decorators/params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"params.js","sourceRoot":"","sources":["../../../src/decorators/params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAE1D,MAAM,UAAU,MAAM,CAAC,UAAmB;IACxC,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC","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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "@tsed/common";
|
|
2
2
|
import { useDecorators } from "@tsed/core";
|
|
3
|
-
import { INTERACTION_PROMPT } from "../constants";
|
|
3
|
+
import { INTERACTION_PROMPT } from "../constants/constants.js";
|
|
4
4
|
export function Prompt() {
|
|
5
5
|
return useDecorators(Context(INTERACTION_PROMPT));
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/decorators/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/decorators/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAE1D,MAAM,UAAU,MAAM;IACpB,OAAO,aAAa,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;AACpD,CAAC","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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "@tsed/common";
|
|
2
2
|
import { useDecorators } from "@tsed/core";
|
|
3
|
-
import { INTERACTION_UID } from "../constants";
|
|
3
|
+
import { INTERACTION_UID } from "../constants/constants.js";
|
|
4
4
|
export function Uid() {
|
|
5
5
|
return useDecorators(Context(INTERACTION_UID));
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uid.js","sourceRoot":"","sources":["../../../src/decorators/uid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"uid.js","sourceRoot":"","sources":["../../../src/decorators/uid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAEvD,MAAM,UAAU,GAAG;IACjB,OAAO,aAAa,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;AACjD,CAAC","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 {
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"OidcBadInteractionName.js","sourceRoot":"","sources":["../../../src/domain/OidcBadInteractionName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAE5C,MAAM,OAAO,sBAAuB,SAAQ,UAAU;CAAG","sourcesContent":["import {BadRequest} from \"@tsed/exceptions\";\n\nexport class OidcBadInteractionName extends BadRequest {}\n"]}
|
|
@@ -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 *
|
|
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 @@
|
|
|
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/esm/index.js
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./OidcModule.js";
|
|
5
|
+
export * from "./constants/constants.js";
|
|
6
|
+
export * from "./decorators/grantId.js";
|
|
7
|
+
export * from "./decorators/interaction.js";
|
|
8
|
+
export * from "./decorators/interactions.js";
|
|
9
|
+
export * from "./decorators/noCache.js";
|
|
10
|
+
export * from "./decorators/oidcCtx.js";
|
|
11
|
+
export * from "./decorators/oidcSession.js";
|
|
12
|
+
export * from "./decorators/params.js";
|
|
13
|
+
export * from "./decorators/prompt.js";
|
|
14
|
+
export * from "./decorators/uid.js";
|
|
15
|
+
export * from "./domain/OidcAccountsMethods.js";
|
|
16
|
+
export * from "./domain/OidcBadInteractionName.js";
|
|
17
|
+
export * from "./domain/OidcInteraction.js";
|
|
18
|
+
export * from "./domain/OidcInteractionMethods.js";
|
|
19
|
+
export * from "./domain/OidcInteractionOptions.js";
|
|
20
|
+
export * from "./domain/OidcInteractionPromptProps.js";
|
|
21
|
+
export * from "./domain/OidcSettings.js";
|
|
22
|
+
export * from "./domain/interfaces.js";
|
|
23
|
+
export * from "./middlewares/OidcInteractionMiddleware.js";
|
|
24
|
+
export * from "./middlewares/OidcNoCacheMiddleware.js";
|
|
25
|
+
export * from "./middlewares/OidcSecureMiddleware.js";
|
|
26
|
+
export * from "./services/OidcAdapters.js";
|
|
27
|
+
export * from "./services/OidcInteractionContext.js";
|
|
28
|
+
export * from "./services/OidcInteractions.js";
|
|
29
|
+
export * from "./services/OidcJwks.js";
|
|
30
|
+
export * from "./services/OidcProvider.js";
|
|
31
|
+
export * from "./utils/debug.js";
|
|
12
32
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC","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"]}
|
|
@@ -1,36 +1,16 @@
|
|
|
1
|
-
import { __decorate, __metadata
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { OidcInteractionContext } from "../services/OidcInteractionContext";
|
|
5
|
-
import { OidcInteractions } from "../services/OidcInteractions";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Inject, Middleware } from "@tsed/common";
|
|
3
|
+
import { OidcInteractionContext } from "../services/OidcInteractionContext.js";
|
|
6
4
|
let OidcInteractionMiddleware = class OidcInteractionMiddleware {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { uid, prompt, params, session, grantId } = interactionDetails;
|
|
11
|
-
context.set(INTERACTION_CONTEXT, oidcInteraction);
|
|
12
|
-
context.set(INTERACTION_DETAILS, interactionDetails);
|
|
13
|
-
context.set(INTERACTION_UID, uid);
|
|
14
|
-
context.set(INTERACTION_PROMPT, prompt);
|
|
15
|
-
context.set(INTERACTION_PARAMS, params);
|
|
16
|
-
context.set(INTERACTION_GRANT_ID, grantId);
|
|
17
|
-
context.set(INTERACTION_SESSION, session);
|
|
5
|
+
oidcInteractionContext;
|
|
6
|
+
async use() {
|
|
7
|
+
await this.oidcInteractionContext.interactionDetails();
|
|
18
8
|
}
|
|
19
9
|
};
|
|
20
10
|
__decorate([
|
|
21
11
|
Inject(),
|
|
22
|
-
__metadata("design:type",
|
|
23
|
-
], OidcInteractionMiddleware.prototype, "
|
|
24
|
-
__decorate([
|
|
25
|
-
Inject(),
|
|
26
|
-
__metadata("design:type", InjectorService)
|
|
27
|
-
], OidcInteractionMiddleware.prototype, "injector", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
__param(0, Context()),
|
|
30
|
-
__metadata("design:type", Function),
|
|
31
|
-
__metadata("design:paramtypes", [Object]),
|
|
32
|
-
__metadata("design:returntype", Promise)
|
|
33
|
-
], OidcInteractionMiddleware.prototype, "use", null);
|
|
12
|
+
__metadata("design:type", OidcInteractionContext)
|
|
13
|
+
], OidcInteractionMiddleware.prototype, "oidcInteractionContext", void 0);
|
|
34
14
|
OidcInteractionMiddleware = __decorate([
|
|
35
15
|
Middleware()
|
|
36
16
|
], OidcInteractionMiddleware);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcInteractionMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcInteractionMiddleware.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"OidcInteractionMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcInteractionMiddleware.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,sBAAsB,EAAC,MAAM,oCAAoC,CAAC;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,MAAM,EAAE;8BACyB,sBAAsB;yEAAC;AAF9C,yBAAyB;IADrC,UAAU,EAAE;GACA,yBAAyB,CAOrC;SAPY,yBAAyB","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"]}
|
|
@@ -2,9 +2,11 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { Adapters } from "@tsed/adapters";
|
|
3
3
|
import { Inject, Injectable } from "@tsed/di";
|
|
4
4
|
let OidcAdapters = class OidcAdapters {
|
|
5
|
+
adapters;
|
|
5
6
|
createAdapterClass() {
|
|
6
7
|
const self = this;
|
|
7
8
|
return class CustomAdapter {
|
|
9
|
+
adapter;
|
|
8
10
|
constructor(name) {
|
|
9
11
|
this.adapter = self.adapters.invokeAdapter({
|
|
10
12
|
collectionName: name,
|
|
@@ -22,22 +24,42 @@ let OidcAdapters = class OidcAdapters {
|
|
|
22
24
|
return this.adapter.findById(id);
|
|
23
25
|
}
|
|
24
26
|
async findByUserCode(userCode) {
|
|
27
|
+
// istanbul ignore next
|
|
28
|
+
if (this.adapter.findByUserCode) {
|
|
29
|
+
return this.adapter.findByUserCode(userCode);
|
|
30
|
+
}
|
|
25
31
|
return this.adapter.findOne({
|
|
26
32
|
userCode
|
|
27
33
|
});
|
|
28
34
|
}
|
|
29
35
|
async findByUid(uid) {
|
|
36
|
+
// istanbul ignore next
|
|
37
|
+
if (this.adapter.findByUid) {
|
|
38
|
+
return this.adapter.findByUid(uid);
|
|
39
|
+
}
|
|
30
40
|
return this.adapter.findOne({
|
|
31
41
|
uid
|
|
32
42
|
});
|
|
33
43
|
}
|
|
34
44
|
async destroy(id) {
|
|
45
|
+
// istanbul ignore next
|
|
46
|
+
if (this.adapter.destroy) {
|
|
47
|
+
return this.adapter.destroy(id);
|
|
48
|
+
}
|
|
35
49
|
await this.adapter.deleteById(id);
|
|
36
50
|
}
|
|
37
51
|
async revokeByGrantId(grantId) {
|
|
52
|
+
// istanbul ignore next
|
|
53
|
+
if (this.adapter.revokeByGrantId) {
|
|
54
|
+
return this.adapter.revokeByGrantId(grantId);
|
|
55
|
+
}
|
|
38
56
|
await this.adapter.deleteMany({ grantId });
|
|
39
57
|
}
|
|
40
58
|
async consume(grantId) {
|
|
59
|
+
// istanbul ignore next
|
|
60
|
+
if (this.adapter.consume) {
|
|
61
|
+
return this.adapter.consume(grantId);
|
|
62
|
+
}
|
|
41
63
|
await this.adapter.update(grantId, { consumed: Math.floor(Date.now() / 1000) });
|
|
42
64
|
}
|
|
43
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcAdapters.js","sourceRoot":"","sources":["../../../src/services/OidcAdapters.ts"],"names":[],"mappings":";AAAA,OAAO,EAAU,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"OidcAdapters.js","sourceRoot":"","sources":["../../../src/services/O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ter, Adapters} from \"@tsed/adapters\";\nimport {Inject, Injectable} from \"@tsed/di\";\nimport {Adapter as OidcAdapter, AdapterConstructor} from \"oidc-provider\";\n\nexport type OidcAdapterMethods<Model = any> = Adapter<Model> & Partial<Omit<OidcAdapter, \"upsert\">>;\n\n@Injectable()\nexport class OidcAdapters {\n @Inject()\n protected adapters: Adapters;\n\n createAdapterClass(): AdapterConstructor {\n const self = this;\n\n return class CustomAdapter implements OidcAdapter {\n adapter: OidcAdapterMethods;\n\n constructor(name: string) {\n this.adapter = self.adapters.invokeAdapter<any>({\n collectionName: name,\n model: Object\n }) as OidcAdapterMethods;\n }\n\n async upsert(id: string, payload: any, expiresIn: number): Promise<void> {\n let expiresAt;\n\n if (expiresIn) {\n expiresAt = new Date(Date.now() + expiresIn * 1000);\n }\n\n await this.adapter.upsert(id, payload, expiresAt);\n }\n\n async find(id: string) {\n return this.adapter.findById(id);\n }\n\n async findByUserCode(userCode: string) {\n // istanbul ignore next\n if (this.adapter.findByUserCode) {\n return this.adapter.findByUserCode(userCode);\n }\n\n return this.adapter.findOne({\n userCode\n });\n }\n\n async findByUid(uid: string) {\n // istanbul ignore next\n if (this.adapter.findByUid) {\n return this.adapter.findByUid(uid);\n }\n\n return this.adapter.findOne({\n uid\n });\n }\n\n async destroy(id: string) {\n // istanbul ignore next\n if (this.adapter.destroy) {\n return this.adapter.destroy(id);\n }\n\n await this.adapter.deleteById(id);\n }\n\n async revokeByGrantId(grantId: string) {\n // istanbul ignore next\n if (this.adapter.revokeByGrantId) {\n return this.adapter.revokeByGrantId(grantId);\n }\n\n await this.adapter.deleteMany({grantId});\n }\n\n async consume(grantId: string) {\n // istanbul ignore next\n if (this.adapter.consume) {\n return this.adapter.consume(grantId);\n }\n\n await this.adapter.update(grantId, {consumed: Math.floor(Date.now() / 1000)});\n }\n };\n }\n}\n"]}
|