@tsed/oidc-provider 7.0.0-beta.3 → 7.0.0-beta.6
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/.mocharc.js +2 -2
- package/lib/cjs/OidcModule.js +20 -16
- 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/interfaces.js +3 -0
- package/lib/cjs/domain/interfaces.js.map +1 -0
- package/lib/cjs/index.js +29 -11
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/middlewares/OidcInteractionMiddleware.js +11 -11
- 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 +3 -3
- package/lib/cjs/services/OidcAdapters.js.map +1 -1
- package/lib/cjs/services/OidcInteractionContext.js +9 -9
- package/lib/cjs/services/OidcInteractionContext.js.map +1 -1
- package/lib/cjs/services/OidcInteractions.js +8 -8
- package/lib/cjs/services/OidcInteractions.js.map +1 -1
- package/lib/cjs/services/OidcJwks.js +5 -5
- package/lib/cjs/services/OidcProvider.js +24 -24
- 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 +12 -8
- 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/interfaces.js +2 -0
- package/lib/esm/domain/interfaces.js.map +1 -0
- package/lib/esm/index.js +29 -11
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/middlewares/OidcInteractionMiddleware.js +3 -3
- package/lib/esm/middlewares/OidcInteractionMiddleware.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/OidcInteractionContext.js +3 -3
- package/lib/esm/services/OidcInteractionContext.js.map +1 -1
- package/lib/esm/services/OidcInteractions.js +1 -1
- package/lib/esm/services/OidcInteractions.js.map +1 -1
- package/lib/esm/services/OidcProvider.js +4 -4
- package/lib/esm/services/OidcProvider.js.map +1 -1
- 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 -1
- package/lib/types/domain/interfaces.d.ts +3 -0
- package/lib/types/index.d.ts +22 -4
- package/lib/types/services/OidcInteractionContext.d.ts +3 -2
- package/lib/types/services/OidcInteractions.d.ts +1 -1
- package/lib/types/services/OidcProvider.d.ts +1 -1
- package/package.json +21 -21
- package/readme.md +27 -33
- package/tsconfig.compile.esm.json +1 -12
- 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
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("@tsed/common");
|
|
6
6
|
const core_1 = require("@tsed/core");
|
|
7
7
|
const di_1 = require("@tsed/di");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
8
|
+
const constants_1 = require("../constants/constants");
|
|
9
9
|
let OidcInteractions = class OidcInteractions {
|
|
10
10
|
constructor() {
|
|
11
11
|
this.interactions = new Map();
|
|
@@ -45,19 +45,19 @@ let OidcInteractions = class OidcInteractions {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
tslib_1.__decorate([
|
|
49
49
|
(0, di_1.Inject)(),
|
|
50
|
-
|
|
50
|
+
tslib_1.__metadata("design:type", di_1.InjectorService)
|
|
51
51
|
], OidcInteractions.prototype, "injector", void 0);
|
|
52
|
-
|
|
52
|
+
tslib_1.__decorate([
|
|
53
53
|
(0, common_1.Constant)("env"),
|
|
54
|
-
|
|
54
|
+
tslib_1.__metadata("design:type", String)
|
|
55
55
|
], OidcInteractions.prototype, "env", void 0);
|
|
56
|
-
|
|
56
|
+
tslib_1.__decorate([
|
|
57
57
|
(0, common_1.Constant)("oidc"),
|
|
58
|
-
|
|
58
|
+
tslib_1.__metadata("design:type", Object)
|
|
59
59
|
], OidcInteractions.prototype, "oidcSettings", void 0);
|
|
60
|
-
OidcInteractions =
|
|
60
|
+
OidcInteractions = tslib_1.__decorate([
|
|
61
61
|
(0, di_1.Injectable)()
|
|
62
62
|
], OidcInteractions);
|
|
63
63
|
exports.OidcInteractions = OidcInteractions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcInteractions.js","sourceRoot":"","sources":["../../../src/services/OidcInteractions.ts"],"names":[],"mappings":";;;;AAAA,yCAAmH;AACnH,qCAA+B;AAC/B,iCAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"OidcInteractions.js","sourceRoot":"","sources":["../../../src/services/OidcInteractions.ts"],"names":[],"mappings":";;;;AAAA,yCAAmH;AACnH,qCAA+B;AAC/B,iCAA6D;AAC7D,sDAAsF;AAKtF,IAAa,gBAAgB,GAA7B,MAAa,gBAAgB;IAA7B;QAUY,iBAAY,GAA0B,IAAI,GAAG,EAAE,CAAC;IA4C5D,CAAC;IA1CC,OAAO;QACL,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAkB,wBAAe,CAAE,CAAC;QAE7E,IAAI,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC,CAAC,QAAkB,EAAE,EAAE;;YACpD,MAAM,EAAC,IAAI,EAAC,G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BAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;gBAErE,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC;YAC/C,CAAC,CAAC;SACH;IACH,CAAC;CACF,CAAA;AApDC;IADC,IAAA,WAAM,GAAE;sCACC,oBAAe;kDAAC;AAG1B;IADC,IAAA,iBAAQ,EAAC,KAAK,CAAC;;6CACP;AAGT;IADC,IAAA,iBAAQ,EAAC,MAAM,CAAC;;sDACU;AARhB,gBAAgB;IAD5B,IAAA,eAAU,GAAE;GACA,gBAAgB,CAsD5B;AAtDY,4CAAgB","sourcesContent":["import {Constant, EndpointMetadata, PlatformContext, PlatformHandler, Provider, TokenProvider} from \"@tsed/common\";\nimport {Env} from \"@tsed/core\";\nimport {Inject, Injectable, InjectorService} from \"@tsed/di\";\nimport {INTERACTION, INTERACTION_OPTIONS, INTERACTIONS} from \"../constants/constants\";\nimport {OidcInteractionOptions} from \"../domain/OidcInteractionOptions\";\nimport {OidcSettings} from \"../domain/OidcSettings\";\n\n@Injectable()\nexport class OidcInteractions {\n @Inject()\n injector: InjectorService;\n\n @Constant(\"env\")\n env: Env;\n\n @Constant(\"oidc\")\n oidcSettings: OidcSettings;\n\n protected interactions: Map<string, Provider> = new Map();\n\n $onInit(): void {\n const platformHandler = this.injector.get<PlatformHandler>(PlatformHandler)!;\n\n this.getInteractions().forEach((provider: Provider) => {\n const {name} = provider.store.get<OidcInteractionOptions>(INTERACTION_OPTIONS);\n this.interactions.set(name, provider);\n\n if (this.injector.get(provider.token)?.$prompt) {\n provider.store.set(\"$prompt\", platformHandler.createCustomHandler(provider, \"$prompt\"));\n }\n });\n }\n\n getInteractions(): Provider[] {\n const interactionsProvider = this.injector.getProviders().find((provider) => provider.subType === INTERACTIONS);\n\n /* istanbul ignore next */\n if (!interactionsProvider) {\n return [];\n }\n\n return interactionsProvider.children\n .map((token: TokenProvider) => this.injector.getProvider(token)!)\n .filter((provider: Provider) => provider?.subType === INTERACTION);\n }\n\n getInteractionProvider(name: string): Provider | undefined {\n return this.interactions.get(name);\n }\n\n getInteractionHandler(name: string) {\n const interaction = this.getInteractionProvider(name);\n\n if (interaction) {\n return (ctx: PlatformContext) => {\n // Add current endpoint metadata to ctx\n ctx.endpoint = EndpointMetadata.get(interaction.useClass, \"$prompt\");\n\n return interaction.store.get(\"$prompt\")(ctx);\n };\n }\n }\n}\n"]}
|
|
@@ -16,15 +16,15 @@ let OidcJwks = class OidcJwks {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
tslib_1.__decorate([
|
|
20
20
|
(0, di_1.Constant)("oidc.jwksPath", (0, path_1.join)(process.cwd(), "keys", "jwks.json")),
|
|
21
|
-
|
|
21
|
+
tslib_1.__metadata("design:type", String)
|
|
22
22
|
], OidcJwks.prototype, "jwksPath", void 0);
|
|
23
|
-
|
|
23
|
+
tslib_1.__decorate([
|
|
24
24
|
(0, di_1.Constant)("oidc.certificates"),
|
|
25
|
-
|
|
25
|
+
tslib_1.__metadata("design:type", Array)
|
|
26
26
|
], OidcJwks.prototype, "certificates", void 0);
|
|
27
|
-
OidcJwks =
|
|
27
|
+
OidcJwks = tslib_1.__decorate([
|
|
28
28
|
(0, di_1.Injectable)()
|
|
29
29
|
], OidcJwks);
|
|
30
30
|
exports.OidcJwks = OidcJwks;
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const core_1 = require("@tsed/core");
|
|
6
6
|
const di_1 = require("@tsed/di");
|
|
7
7
|
const oidc_provider_1 = require("oidc-provider");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
8
|
+
const constants_1 = require("../constants/constants");
|
|
9
9
|
const OidcAdapters_1 = require("./OidcAdapters");
|
|
10
10
|
const OidcInteractions_1 = require("./OidcInteractions");
|
|
11
11
|
const OidcJwks_1 = require("./OidcJwks");
|
|
@@ -125,51 +125,51 @@ let OidcProvider = class OidcProvider {
|
|
|
125
125
|
return this.injector.alter("$alterOidcPolicy", policy);
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
|
|
128
|
+
tslib_1.__decorate([
|
|
129
129
|
(0, di_1.Constant)("env"),
|
|
130
|
-
|
|
130
|
+
tslib_1.__metadata("design:type", String)
|
|
131
131
|
], OidcProvider.prototype, "env", void 0);
|
|
132
|
-
|
|
132
|
+
tslib_1.__decorate([
|
|
133
133
|
(0, di_1.Constant)("httpPort"),
|
|
134
|
-
|
|
134
|
+
tslib_1.__metadata("design:type", Object)
|
|
135
135
|
], OidcProvider.prototype, "httpPort", void 0);
|
|
136
|
-
|
|
136
|
+
tslib_1.__decorate([
|
|
137
137
|
(0, di_1.Constant)("httpsPort"),
|
|
138
|
-
|
|
138
|
+
tslib_1.__metadata("design:type", Object)
|
|
139
139
|
], OidcProvider.prototype, "httpsPort", void 0);
|
|
140
|
-
|
|
140
|
+
tslib_1.__decorate([
|
|
141
141
|
(0, di_1.Constant)("oidc.issuer", ""),
|
|
142
|
-
|
|
142
|
+
tslib_1.__metadata("design:type", String)
|
|
143
143
|
], OidcProvider.prototype, "issuer", void 0);
|
|
144
|
-
|
|
144
|
+
tslib_1.__decorate([
|
|
145
145
|
(0, di_1.Constant)("oidc"),
|
|
146
|
-
|
|
146
|
+
tslib_1.__metadata("design:type", Object)
|
|
147
147
|
], OidcProvider.prototype, "oidc", void 0);
|
|
148
|
-
|
|
148
|
+
tslib_1.__decorate([
|
|
149
149
|
(0, di_1.Constant)("PLATFORM_NAME"),
|
|
150
|
-
|
|
150
|
+
tslib_1.__metadata("design:type", String)
|
|
151
151
|
], OidcProvider.prototype, "platformName", void 0);
|
|
152
|
-
|
|
152
|
+
tslib_1.__decorate([
|
|
153
153
|
(0, di_1.Inject)(),
|
|
154
|
-
|
|
154
|
+
tslib_1.__metadata("design:type", OidcJwks_1.OidcJwks)
|
|
155
155
|
], OidcProvider.prototype, "oidcJwks", void 0);
|
|
156
|
-
|
|
156
|
+
tslib_1.__decorate([
|
|
157
157
|
(0, di_1.Inject)(),
|
|
158
|
-
|
|
158
|
+
tslib_1.__metadata("design:type", OidcInteractions_1.OidcInteractions)
|
|
159
159
|
], OidcProvider.prototype, "oidcInteractions", void 0);
|
|
160
|
-
|
|
160
|
+
tslib_1.__decorate([
|
|
161
161
|
(0, di_1.Inject)(),
|
|
162
|
-
|
|
162
|
+
tslib_1.__metadata("design:type", OidcAdapters_1.OidcAdapters)
|
|
163
163
|
], OidcProvider.prototype, "adapters", void 0);
|
|
164
|
-
|
|
164
|
+
tslib_1.__decorate([
|
|
165
165
|
(0, di_1.Inject)(),
|
|
166
|
-
|
|
166
|
+
tslib_1.__metadata("design:type", di_1.InjectorService)
|
|
167
167
|
], OidcProvider.prototype, "injector", void 0);
|
|
168
|
-
|
|
168
|
+
tslib_1.__decorate([
|
|
169
169
|
(0, di_1.Inject)(),
|
|
170
|
-
|
|
170
|
+
tslib_1.__metadata("design:type", common_1.PlatformApplication)
|
|
171
171
|
], OidcProvider.prototype, "app", void 0);
|
|
172
|
-
OidcProvider =
|
|
172
|
+
OidcProvider = tslib_1.__decorate([
|
|
173
173
|
(0, di_1.Injectable)()
|
|
174
174
|
], OidcProvider);
|
|
175
175
|
exports.OidcProvider = OidcProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcProvider.js","sourceRoot":"","sources":["../../../src/services/OidcProvider.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AACzC,iCAAuE;AACvE,iDAAyF;AACzF,
|
|
1
|
+
{"version":3,"file":"OidcProvider.js","sourceRoot":"","sources":["../../../src/services/OidcProvider.ts"],"names":[],"mappings":";;;;AAAA,qCAAyC;AACzC,iCAAuE;AACvE,iDAAyF;AACzF,sDAAoD;AACpD,iDAA4C;AAC5C,yDAAoD;AACpD,yCAAoC;AACpC,yCAAiD;AAKjD,IAAa,YAAY,GAAzB,MAAa,YAAY;IAoCvB,gBA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AAE;sCACM,4BAAmB;yCAAC;AAlCxB,YAAY;IADxB,IAAA,eAAU,GAAE;GACA,YAAY,CAqLxB;AArLY,oCAAY","sourcesContent":["import {Env, setValue} from \"@tsed/core\";\nimport {Constant, Inject, Injectable, InjectorService} from \"@tsed/di\";\nimport {Provider as OIDCProvider, Configuration, interactionPolicy} from \"oidc-provider\";\nimport {INTERACTIONS} from \"../constants/constants\";\nimport {OidcAdapters} from \"./OidcAdapters\";\nimport {OidcInteractions} from \"./OidcInteractions\";\nimport {OidcJwks} from \"./OidcJwks\";\nimport {PlatformApplication} from \"@tsed/common\";\nimport {OidcSettings} from \"../domain/OidcSettings\";\nimport {OidcAccountsMethods} from \"../domain/OidcAccountsMethods\";\n\n@Injectable()\nexport class OidcProvider {\n raw: OIDCProvider;\n\n @Constant(\"env\")\n protected env: Env;\n\n @Constant(\"httpPort\")\n protected httpPort: number | string;\n\n @Constant(\"httpsPort\")\n protected httpsPort: number | string;\n\n @Constant(\"oidc.issuer\", \"\")\n protected issuer: string;\n\n @Constant(\"oidc\")\n protected oidc: OidcSettings;\n\n @Constant(\"PLATFORM_NAME\")\n protected platformName: string;\n\n @Inject()\n protected oidcJwks: OidcJwks;\n\n @Inject()\n protected oidcInteractions: OidcInteractions;\n\n @Inject()\n protected adapters: OidcAdapters;\n\n @Inject()\n protected injector: InjectorService;\n\n @Inject()\n protected app: PlatformApplication;\n\n hasConfiguration() {\n return !!this.oidc;\n }\n\n async getConfiguration(): Promise<Configuration> {\n const [jwks, adapter] = await Promise.all([this.oidcJwks.getJwks(), this.adapters.createAdapterClass()]);\n const {issuer, jwksPath, secureKey, proxy, Accounts, ...options} = this.oidc;\n\n const configuration: Configuration = {\n interactions: {\n /* istanbul ignore next */\n url: (ctx, interaction) => `interaction/${interaction.uid}`\n },\n ...options,\n adapter,\n jwks\n };\n\n if (Accounts) {\n configuration.findAccount = (ctx, id, token) =>\n this.injector.get<OidcAccountsMethods>(Accounts)!.findAccount(id, token, (ctx.req as any).$ctx);\n }\n\n if (this.env === Env.PROD) {\n setValue(configuration, \"cookies.short.secure\", true);\n setValue(configuration, \"cookies.long.secure\", true);\n }\n\n const policy = this.getPolicy();\n if (policy) {\n setValue(configuration, \"interactions.policy\", policy);\n }\n\n const url = this.getInteractionsUrl();\n if (url) {\n setValue(configuration, \"interactions.url\", url);\n }\n\n return configuration;\n }\n\n getIssuer() {\n if (this.issuer) {\n return this.issuer;\n }\n\n // istanbul ignore next\n if (this.httpsPort) {\n return `https://localhost:${this.httpsPort}`;\n }\n\n return `http://localhost:${this.httpPort}`;\n }\n\n get(): OIDCProvider {\n return this.raw;\n }\n\n /**\n * Create a new instance of OidcProvider\n */\n async create(): Promise<void | OIDCProvider> {\n const {proxy, secureKey} = this.oidc;\n const configuration = await this.getConfiguration();\n const oidcProvider = new OIDCProvider(this.getIssuer(), configuration);\n\n if (proxy || this.env === Env.PROD) {\n // istanbul ignore next\n switch (this.platformName) {\n default:\n case \"express\":\n oidcProvider.proxy = true;\n break;\n case \"koa\":\n (this.app.rawApp as any).proxy = true;\n break;\n }\n }\n\n if (secureKey) {\n oidcProvider.app.keys = secureKey;\n }\n\n this.raw = oidcProvider;\n\n if (this.env !== Env.PROD) {\n this.allowHttpLocalhost();\n }\n\n await this.injector.emit(\"$onCreateOIDC\", this.raw);\n\n return this.raw;\n }\n\n private getInteractionsUrl() {\n const provider = this.injector.getProviders().find((provider) => provider.subType === INTERACTIONS);\n\n if (provider) {\n return (ctx: any, interaction: any) => {\n // eslint-disable-line no-unused-vars\n return provider.path.replace(/:uid/, interaction.uid);\n };\n }\n }\n\n private allowHttpLocalhost() {\n const {invalidate: orig} = (this.raw.Client as any).Schema.prototype;\n\n (this.raw.Client as any).Schema.prototype.invalidate = function invalidate(message: string, code: string) {\n if (code === \"implicit-force-https\" || code === \"implicit-forbid-localhost\") {\n return;\n }\n\n /* istanbul ignore next */\n return orig.call(this, message);\n };\n }\n\n private getPolicy() {\n const policy = interactionPolicy.base();\n const interactions = this.oidcInteractions.getInteractions();\n\n if (interactions.length) {\n interactions.forEach((provider) => {\n const {name, ...options} = provider.store.get(\"interactionOptions\");\n\n if (!policy.get(name)) {\n policy.add(\n new interactionPolicy.Prompt({\n name,\n ...options\n })\n );\n }\n\n const instance = this.injector.get(provider.token);\n\n if (instance.$onCreate) {\n instance.$onCreate(policy.get(name));\n }\n });\n }\n\n return this.injector.alter(\"$alterOidcPolicy\", policy);\n }\n}\n"]}
|
package/lib/cjs/utils/debug.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.debug = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("@tsed/core");
|
|
6
|
-
const querystring_1 =
|
|
6
|
+
const querystring_1 = tslib_1.__importDefault(require("querystring"));
|
|
7
7
|
const util_1 = require("util");
|
|
8
8
|
const keys = new Set();
|
|
9
9
|
function serialize(obj) {
|
|
@@ -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,9 +1,10 @@
|
|
|
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 {
|
|
8
9
|
async $onInit() {
|
|
9
10
|
if (this.oidcProvider.hasConfiguration()) {
|
|
@@ -12,7 +13,7 @@ let OidcModule = class OidcModule {
|
|
|
12
13
|
}
|
|
13
14
|
async $onRoutesInit() {
|
|
14
15
|
if (this.basePath !== "/") {
|
|
15
|
-
this.app.use(this.getRewriteMiddleware());
|
|
16
|
+
this.app.use(await this.getRewriteMiddleware());
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
async $afterRoutesInit() {
|
|
@@ -24,7 +25,7 @@ let OidcModule = class OidcModule {
|
|
|
24
25
|
this.app.use(this.basePath, provider.callback());
|
|
25
26
|
break;
|
|
26
27
|
case "koa":
|
|
27
|
-
this.app.use(
|
|
28
|
+
this.app.use(koaMount(this.basePath, provider.app));
|
|
28
29
|
break;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
@@ -37,13 +38,16 @@ let OidcModule = class OidcModule {
|
|
|
37
38
|
injector.logger.info(`WellKnown is available on ${url}/.well-known/openid-configuration`);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
getRewriteMiddleware() {
|
|
41
|
+
async getRewriteMiddleware() {
|
|
41
42
|
switch (this.platformName) {
|
|
42
43
|
default:
|
|
43
44
|
case "express":
|
|
44
|
-
|
|
45
|
+
const { default: expressUrlRewrite } = await import("express-urlrewrite");
|
|
46
|
+
return expressUrlRewrite("/.well-known/*", `${this.basePath}/.well-known/$1`);
|
|
45
47
|
case "koa":
|
|
46
|
-
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
const { default: koaUrlRewrite } = await import("koa-rewrite");
|
|
50
|
+
return koaUrlRewrite("/.well-known/(.*)", `${this.basePath}/.well-known/$1`);
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
};
|
|
@@ -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,OA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AAI,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;AAhEC;IADC,MAAM,EAAE;8BACJ,mBAAmB;uCAAC;AAGzB;IADC,QAAQ,CAAC,eAAe,CAAC;;gDACL;AAGrB;IADC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC;;4CACV;AAGjB;IADC,MAAM,EAAE;8BACK,YAAY;gDAAC;AAG3B;IADC,MAAM,EAAE;8BACC,eAAe;4CAAC;AAdf,UAAU;IAHtB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC;KAChD,CAAC;GACW,UAAU,CAkEtB;SAlEY,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 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(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() && 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 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 {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 {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\"]>;\nexport type BackchannelAuthenticationRequest = InstanceType<Provider[\"BackchannelAuthenticationRequest\"]>;\n\nexport interface OidcAccountsMethods {\n findAccount(\n id: string,\n token: AuthorizationCode | AccessToken | DeviceCode | BackchannelAuthenticationRequest | undefined,\n ctx: PlatformContext\n ): Promise<Account | undefined>;\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,30 @@
|
|
|
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/OidcInteraction.js";
|
|
17
|
+
export * from "./domain/OidcInteractionMethods.js";
|
|
18
|
+
export * from "./domain/OidcInteractionOptions.js";
|
|
19
|
+
export * from "./domain/OidcSettings.js";
|
|
20
|
+
export * from "./domain/interfaces.js";
|
|
21
|
+
export * from "./middlewares/OidcInteractionMiddleware.js";
|
|
22
|
+
export * from "./middlewares/OidcNoCacheMiddleware.js";
|
|
23
|
+
export * from "./middlewares/OidcSecureMiddleware.js";
|
|
24
|
+
export * from "./services/OidcAdapters.js";
|
|
25
|
+
export * from "./services/OidcInteractionContext.js";
|
|
26
|
+
export * from "./services/OidcInteractions.js";
|
|
27
|
+
export * from "./services/OidcJwks.js";
|
|
28
|
+
export * from "./services/OidcProvider.js";
|
|
29
|
+
export * from "./utils/debug.js";
|
|
12
30
|
//# 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,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,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/OidcInteraction\";\nexport * from \"./domain/OidcInteractionMethods\";\nexport * from \"./domain/OidcInteractionOptions\";\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,8 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { Context, Inject, InjectorService, Middleware } from "@tsed/common";
|
|
3
|
-
import { INTERACTION_CONTEXT, INTERACTION_DETAILS, INTERACTION_PARAMS, INTERACTION_GRANT_ID, INTERACTION_PROMPT, INTERACTION_SESSION, INTERACTION_UID } from "../constants";
|
|
4
|
-
import { OidcInteractionContext } from "../services/OidcInteractionContext";
|
|
5
|
-
import { OidcInteractions } from "../services/OidcInteractions";
|
|
3
|
+
import { INTERACTION_CONTEXT, INTERACTION_DETAILS, INTERACTION_PARAMS, INTERACTION_GRANT_ID, INTERACTION_PROMPT, INTERACTION_SESSION, INTERACTION_UID } from "../constants/constants.js";
|
|
4
|
+
import { OidcInteractionContext } from "../services/OidcInteractionContext.js";
|
|
5
|
+
import { OidcInteractions } from "../services/OidcInteractions.js";
|
|
6
6
|
let OidcInteractionMiddleware = class OidcInteractionMiddleware {
|
|
7
7
|
async use(context) {
|
|
8
8
|
const oidcInteraction = this.injector.invoke(OidcInteractionContext, context.container);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcInteractionMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcInteractionMiddleware.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC1E,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"OidcInteractionMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/OidcInteractionMiddleware.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAC1E,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,sBAAsB,EAAC,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D,IAAa,yBAAyB,GAAtC,MAAa,yBAAyB;IAOpC,KAAK,CAAC,GAAG,CAAY,OAAgB;QACnC,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAyB,sBAAsB,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,mBAAmB,EAAE,eAAe,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF,CAAA;AAlBC;IADC,MAAM,EAAE;8BACmB,gBAAgB;mEAAC;AAG7C;IADC,MAAM,EAAE;8BACW,eAAe;2DAAC;AAEpC;IAAW,WAAA,OAAO,EAAE,CAAA;;;;oDAYnB;AAnBU,yBAAyB;IADrC,UAAU,EAAE;GACA,yBAAyB,CAoBrC;SApBY,yBAAyB","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/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"]}
|
|
@@ -2,9 +2,9 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { Constant, PlatformContext, ProviderScope, Scope } from "@tsed/common";
|
|
3
3
|
import { Env } from "@tsed/core";
|
|
4
4
|
import { Inject, Injectable } from "@tsed/di";
|
|
5
|
-
import { debug } from "../utils/debug";
|
|
6
|
-
import { OidcInteractions } from "./OidcInteractions";
|
|
7
|
-
import { OidcProvider } from "./OidcProvider";
|
|
5
|
+
import { debug } from "../utils/debug.js";
|
|
6
|
+
import { OidcInteractions } from "./OidcInteractions.js";
|
|
7
|
+
import { OidcProvider } from "./OidcProvider.js";
|
|
8
8
|
let OidcInteractionContext = class OidcInteractionContext {
|
|
9
9
|
get session() {
|
|
10
10
|
return this.raw.session;
|