feat: Update oidc-provider to v8

The new version is an ESM package,
so we need to do a dynamic import as our package is CJS.
To correctly transpile the dynamic import,
moduleResolution needs to be set to node16.
See https://github.com/microsoft/TypeScript/issues/43329
This commit is contained in:
Joachim Van Herwegen 2023-06-16 10:34:32 +02:00
parent b0d7342b39
commit 7024ee9a58
5 changed files with 597 additions and 604 deletions

View File

@ -4,7 +4,6 @@
{
"comment": [
"Sets all the relevant Solid-OIDC parameters.",
"dPoP is draft-01 since that is the latest version v6 of the OIDC library supports."
],
"@id": "urn:solid-server:default:IdentityProviderFactory",
"@type": "IdentityProviderFactory",
@ -32,7 +31,7 @@
"claimsParameter": { "enabled": true },
"clientCredentials": { "enabled": true },
"devInteractions": { "enabled": false },
"dPoP": { "enabled": true, "ack": "draft-03" },
"dPoP": { "enabled": true },
"introspection": { "enabled": true },
"registration": { "enabled": true },
"revocation": { "enabled": true },

1179
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -108,7 +108,7 @@
"@types/n3": "^1.10.4",
"@types/node": "^14.18.43",
"@types/nodemailer": "^6.4.7",
"@types/oidc-provider": "^7.11.1",
"@types/oidc-provider": "^8.4.0",
"@types/proper-lockfile": "^4.1.2",
"@types/pump": "^1.1.1",
"@types/punycode": "^2.1.0",
@ -139,7 +139,7 @@
"mime-types": "^2.1.35",
"n3": "^1.16.4",
"nodemailer": "^6.9.1",
"oidc-provider": "7.10.6",
"oidc-provider": "^8.4.0",
"proper-lockfile": "^4.1.2",
"pump": "^3.0.0",
"punycode": "^2.1.1",
@ -161,8 +161,8 @@
"devDependencies": {
"@commitlint/cli": "^17.6.1",
"@commitlint/config-conventional": "^17.6.1",
"@inrupt/solid-client-authn-core": "1.14.0",
"@inrupt/solid-client-authn-node": "1.14.0",
"@inrupt/solid-client-authn-core": "^1.16.0",
"@inrupt/solid-client-authn-node": "^1.16.0",
"@microsoft/tsdoc-config": "^0.16.2",
"@tsconfig/node18": "^2.0.1",
"@types/cheerio": "^0.22.31",

View File

@ -2,6 +2,7 @@
// import/no-unresolved can't handle jose imports
// tsdoc/syntax can't handle {json} parameter
import { randomBytes } from 'crypto';
import type Provider from 'oidc-provider';
import type { Account,
Adapter,
AsymmetricSigningAlgorithm,
@ -11,7 +12,6 @@ import type { Account,
ResourceServer,
UnknownObject,
errors } from 'oidc-provider';
import { Provider } from 'oidc-provider';
import type { Operation } from '../../http/Operation';
import type { ErrorHandler } from '../../http/output/error/ErrorHandler';
import type { ResponseWriter } from '../../http/output/ResponseWriter';
@ -146,7 +146,7 @@ export class IdentityProviderFactory implements ProviderFactory {
this.configureErrors(config);
// Allow provider to interpret reverse proxy headers
const provider = new Provider(this.baseUrl, config);
const provider = new (await import('oidc-provider')).default(this.baseUrl, config);
provider.proxy = true;
this.captureErrorResponses(provider);

View File

@ -9,7 +9,8 @@
"outDir": "dist",
"preserveConstEnums": true,
"sourceMap": true,
"stripInternal": true
"stripInternal": true,
"moduleResolution": "node16"
},
"include": [
"src"