@tsed/oidc-provider-plugin-wildcard-redirect-uri 8.0.0-alpha.8 → 8.0.0-beta.1
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.
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { __decorate, __metadata
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Constant, Inject, Module } from "@tsed/di";
|
|
3
3
|
import { Logger } from "@tsed/logger";
|
|
4
|
-
import {
|
|
4
|
+
import { errors } from "oidc-provider";
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import psl from "psl";
|
|
7
7
|
import { wildcardRedirectUriAllowed } from "./utils/wildcardRedirectUriAllowed.js";
|
|
8
8
|
let OidcWildcardRedirectUriModule = class OidcWildcardRedirectUriModule {
|
|
9
|
-
constructor(module) {
|
|
10
|
-
this.module = module;
|
|
11
|
-
}
|
|
12
9
|
$onCreateOIDC(provider) {
|
|
13
10
|
if (this.enabled) {
|
|
14
11
|
const { redirectUriAllowed, postLogoutRedirectUriAllowed } = provider.Client.prototype;
|
|
@@ -33,13 +30,13 @@ let OidcWildcardRedirectUriModule = class OidcWildcardRedirectUriModule {
|
|
|
33
30
|
if (redirectUri.includes("*")) {
|
|
34
31
|
const { hostname, href } = new URL(redirectUri);
|
|
35
32
|
if (href.split("*").length !== 2) {
|
|
36
|
-
throw new
|
|
33
|
+
throw new errors.InvalidClientMetadata("redirect_uris with a wildcard may only contain a single one");
|
|
37
34
|
}
|
|
38
35
|
if (!hostname.includes("*")) {
|
|
39
|
-
throw new
|
|
36
|
+
throw new errors.InvalidClientMetadata("redirect_uris may only have a wildcard in the hostname");
|
|
40
37
|
}
|
|
41
38
|
if (!psl.get(hostname.split("*.")[1])) {
|
|
42
|
-
throw new
|
|
39
|
+
throw new errors.InvalidClientMetadata("redirect_uris with a wildcard must not match an eTLD+1 of a known public suffix domain");
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
}
|
|
@@ -49,13 +46,13 @@ let OidcWildcardRedirectUriModule = class OidcWildcardRedirectUriModule {
|
|
|
49
46
|
if (postLogoutRedirectUri.includes("*")) {
|
|
50
47
|
const { hostname, href } = new URL(postLogoutRedirectUri);
|
|
51
48
|
if (href.split("*").length !== 2) {
|
|
52
|
-
throw new
|
|
49
|
+
throw new errors.InvalidClientMetadata("post_logout_redirect_uris with a wildcard may only contain a single one");
|
|
53
50
|
}
|
|
54
51
|
if (!hostname.includes("*")) {
|
|
55
|
-
throw new
|
|
52
|
+
throw new errors.InvalidClientMetadata("post_logout_redirect_uris may only have a wildcard in the hostname");
|
|
56
53
|
}
|
|
57
54
|
if (!psl.get(hostname.split("*.")[1])) {
|
|
58
|
-
throw new
|
|
55
|
+
throw new errors.InvalidClientMetadata("post_logout_redirect_uris with a wildcard must not match an eTLD+1 of a known public suffix domain");
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
58
|
}
|
|
@@ -71,9 +68,7 @@ __decorate([
|
|
|
71
68
|
__metadata("design:type", Logger)
|
|
72
69
|
], OidcWildcardRedirectUriModule.prototype, "logger", void 0);
|
|
73
70
|
OidcWildcardRedirectUriModule = __decorate([
|
|
74
|
-
Module()
|
|
75
|
-
__param(0, Inject(OIDC_PROVIDER_NODE_MODULE)),
|
|
76
|
-
__metadata("design:paramtypes", [Object])
|
|
71
|
+
Module()
|
|
77
72
|
], OidcWildcardRedirectUriModule);
|
|
78
73
|
export { OidcWildcardRedirectUriModule };
|
|
79
74
|
//# sourceMappingURL=OidcWildcardRedirectUriModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OidcWildcardRedirectUriModule.js","sourceRoot":"","sources":["../../src/OidcWildcardRedirectUriModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAClD,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,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AAM,CAAC,qBAAqB,CAAC,yEAAyE,CAAC,CAAC;oBACpH,CAAC;oBAED,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;wBAC5B,MAAM,IAAI,MAAM,CAAC,qBAAqB,CAAC,oEAAoE,CAAC,CAAC;oBAC/G,CAAC;oBAED,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;wBACtC,MAAM,IAAI,MAAM,CAAC,qBAAqB,CACpC,oGAAoG,CACrG,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AA1EU;IADR,QAAQ,CAAC,+BAA+B,EAAE,KAAK,CAAC;;8DACvB;AAGhB;IADT,MAAM,CAAC,MAAM,CAAC;8BACG,MAAM;6DAAC;AALd,6BAA6B;IADzC,MAAM,EAAE;GACI,6BAA6B,CA4EzC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logger } from "@tsed/logger";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { OidcSettings } from "@tsed/oidc-provider";
|
|
3
|
+
import Provider, { type KoaContextWithOIDC } from "oidc-provider";
|
|
4
4
|
declare global {
|
|
5
5
|
namespace TsED {
|
|
6
6
|
interface OIDCPluginSettings {
|
|
@@ -11,10 +11,8 @@ declare global {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
export declare class OidcWildcardRedirectUriModule {
|
|
14
|
-
protected module: OIDC_PROVIDER_NODE_MODULE;
|
|
15
14
|
readonly enabled: boolean;
|
|
16
15
|
protected logger: Logger;
|
|
17
|
-
constructor(module: OIDC_PROVIDER_NODE_MODULE);
|
|
18
16
|
$onCreateOIDC(provider: Provider): void;
|
|
19
17
|
$alterOidcConfiguration(config: OidcSettings): Promise<OidcSettings>;
|
|
20
18
|
validator(ctx: KoaContextWithOIDC, key: string, value: any): void;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/oidc-provider-plugin-wildcard-redirect-uri",
|
|
3
3
|
"description": "A plugin to support wildcard in the redirect uri whitelist",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.0.0-
|
|
5
|
+
"version": "8.0.0-beta.1",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./lib/types/index.d.ts",
|
|
13
13
|
"import": "./lib/esm/index.js",
|
|
14
|
-
"default": "./lib/
|
|
14
|
+
"default": "./lib/esm/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
@@ -24,25 +24,25 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"psl": "1.9.0",
|
|
27
|
-
"wildcard": "2.0.
|
|
27
|
+
"wildcard": "2.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@tsed/barrels": "8.0.0-
|
|
31
|
-
"@tsed/core": "8.0.0-
|
|
32
|
-
"@tsed/di": "8.0.0-
|
|
33
|
-
"@tsed/oidc-provider": "8.0.0-
|
|
34
|
-
"@tsed/typescript": "8.0.0-
|
|
30
|
+
"@tsed/barrels": "8.0.0-beta.1",
|
|
31
|
+
"@tsed/core": "8.0.0-beta.1",
|
|
32
|
+
"@tsed/di": "8.0.0-beta.1",
|
|
33
|
+
"@tsed/oidc-provider": "8.0.0-beta.1",
|
|
34
|
+
"@tsed/typescript": "8.0.0-beta.1",
|
|
35
35
|
"@types/psl": "^1.1.3",
|
|
36
|
-
"@types/uuid": "
|
|
37
|
-
"eslint": "9.
|
|
36
|
+
"@types/uuid": "10.0.0",
|
|
37
|
+
"eslint": "9.12.0",
|
|
38
38
|
"typescript": "5.4.5",
|
|
39
|
-
"vitest": "2.
|
|
39
|
+
"vitest": "2.1.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@tsed/core": "8.0.0-
|
|
43
|
-
"@tsed/di": "8.0.0-
|
|
42
|
+
"@tsed/core": "8.0.0-beta.1",
|
|
43
|
+
"@tsed/di": "8.0.0-beta.1",
|
|
44
44
|
"@tsed/logger": ">=6.7.5",
|
|
45
|
-
"@tsed/oidc-provider": "8.0.0-
|
|
45
|
+
"@tsed/oidc-provider": "8.0.0-beta.1",
|
|
46
46
|
"oidc-provider": ">=8.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependenciesMeta": {
|
|
@@ -64,6 +64,6 @@
|
|
|
64
64
|
"author": "Romain Lenzotti",
|
|
65
65
|
"license": "MIT",
|
|
66
66
|
"publishConfig": {
|
|
67
|
-
"tag": "
|
|
67
|
+
"tag": "beta"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/vitest.config.mts
CHANGED
|
@@ -10,12 +10,12 @@ export default defineConfig(
|
|
|
10
10
|
coverage: {
|
|
11
11
|
...presets.test.coverage,
|
|
12
12
|
thresholds: {
|
|
13
|
-
statements: 98.
|
|
14
|
-
branches: 86.
|
|
13
|
+
statements: 98.76,
|
|
14
|
+
branches: 86.36,
|
|
15
15
|
functions: 100,
|
|
16
|
-
lines: 98.
|
|
16
|
+
lines: 98.76
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
);
|
|
21
|
+
);
|