From affcaecbc9c2b36181d74a1411385161ac05b163 Mon Sep 17 00:00:00 2001 From: Stijn Taelemans Date: Mon, 10 Jan 2022 16:46:28 +0100 Subject: [PATCH] fix: disable need for username, password on pods (#547) * chore: created new registration manager implementation * chore: update html view * chore: update gitignore * chore: fixing start error WIP * fix: start errors * feat: prefill webid and pod name with query params --- .gitignore | 5 +- packages/solid-crs-pods/.componentsignore | 1 + packages/solid-crs-pods/config/file.json | 5 +- .../config/identity/registration/enabled.json | 31 +- .../registration/route/registration.json | 67 ++-- .../lib/NoCredentialRegistrationHandler.ts | 31 ++ .../lib/NoCredentialRegistrationManager.ts | 252 +++++++++++++++ packages/solid-crs-pods/lib/index.ts | 2 + packages/solid-crs-pods/package-lock.json | 293 ++++++++++++++++++ packages/solid-crs-pods/package.json | 40 ++- .../email-password/register-partial.html.ejs | 14 +- packages/solid-crs-pods/tsconfig.json | 19 ++ 12 files changed, 706 insertions(+), 54 deletions(-) create mode 100644 packages/solid-crs-pods/.componentsignore create mode 100644 packages/solid-crs-pods/lib/NoCredentialRegistrationHandler.ts create mode 100644 packages/solid-crs-pods/lib/NoCredentialRegistrationManager.ts create mode 100644 packages/solid-crs-pods/lib/index.ts create mode 100644 packages/solid-crs-pods/tsconfig.json diff --git a/.gitignore b/.gitignore index cdad5cd6..44212645 100644 --- a/.gitignore +++ b/.gitignore @@ -119,4 +119,7 @@ dist coverage-summary.json # id-proxy assets -assets \ No newline at end of file +assets + +# componentsjs error output +componentsjs-error-state.json diff --git a/packages/solid-crs-pods/.componentsignore b/packages/solid-crs-pods/.componentsignore new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/packages/solid-crs-pods/.componentsignore @@ -0,0 +1 @@ +[] diff --git a/packages/solid-crs-pods/config/file.json b/packages/solid-crs-pods/config/file.json index d28a8966..33507fed 100644 --- a/packages/solid-crs-pods/config/file.json +++ b/packages/solid-crs-pods/config/file.json @@ -1,5 +1,8 @@ { - "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld", + "@context": [ + "https://linkedsoftwaredependencies.org/bundles/npm/@netwerk-digitaal-erfgoed/solid-crs-pods/^0.0.0/components/context.jsonld", + "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld" + ], "import": [ "files-scs:config/app/main/default.json", "files-scs:config/app/init/default.json", diff --git a/packages/solid-crs-pods/config/identity/registration/enabled.json b/packages/solid-crs-pods/config/identity/registration/enabled.json index 1fc74b36..86e02d49 100644 --- a/packages/solid-crs-pods/config/identity/registration/enabled.json +++ b/packages/solid-crs-pods/config/identity/registration/enabled.json @@ -1,15 +1,18 @@ { - "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld", - "import": [ - "./../config/identity/registration/route/registration.json" - ], - "@graph": [ - { - "comment": "Enable registration by adding a registration handler to the list of interaction routes.", - "@id": "urn:solid-server:default:IdentityProviderHttpHandler", - "IdentityProviderHttpHandler:_args_interactionRoutes": [ - { "@id": "urn:solid-server:auth:password:RegistrationRoute" } - ] - } - ] - } + "@context": [ + "https://linkedsoftwaredependencies.org/bundles/npm/@netwerk-digitaal-erfgoed/solid-crs-pods/^0.0.0/components/context.jsonld", + "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld" + ], + "import": [ + "./identity/registration/route/registration.json" + ], + "@graph": [ + { + "comment": "Enable registration by adding a registration handler to the list of interaction routes.", + "@id": "urn:solid-server:default:IdentityProviderHttpHandler", + "IdentityProviderHttpHandler:_args_interactionRoutes": [ + { "@id": "urn:solid-server:auth:password:RegistrationRoute" } + ] + } + ] +} diff --git a/packages/solid-crs-pods/config/identity/registration/route/registration.json b/packages/solid-crs-pods/config/identity/registration/route/registration.json index 464baa09..45af2001 100644 --- a/packages/solid-crs-pods/config/identity/registration/route/registration.json +++ b/packages/solid-crs-pods/config/identity/registration/route/registration.json @@ -1,35 +1,38 @@ { - "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld", - "@graph": [ - { - "comment": "Handles all functionality on the register page", - "@id": "urn:solid-server:auth:password:RegistrationRoute", - "@type": "BasicInteractionRoute", - "route": "^/register/$", - "viewTemplates": { - "BasicInteractionRoute:_viewTemplates_key": "text/html", - "BasicInteractionRoute:_viewTemplates_value": "./templates/identity/email-password/register.html.ejs" - }, - "responseTemplates": { - "BasicInteractionRoute:_responseTemplates_key": "text/html", - "BasicInteractionRoute:_responseTemplates_value": "./templates/identity/email-password/register-response.html.ejs" - }, - "controls": { - "BasicInteractionRoute:_controls_key": "register", - "BasicInteractionRoute:_controls_value": "/register" - }, - "handler": { - "@type": "RegistrationHandler", - "registrationManager": { - "@type": "RegistrationManager", - "args_baseUrl": { "@id": "urn:solid-server:default:variable:baseUrl" }, - "args_webIdSuffix": "/profile/card#me", - "args_identifierGenerator": { "@id": "urn:solid-server:default:IdentifierGenerator" }, - "args_ownershipValidator": { "@id": "urn:solid-server:auth:password:OwnershipValidator" }, - "args_accountStore": { "@id": "urn:solid-server:auth:password:AccountStore" }, - "args_podManager": { "@id": "urn:solid-server:default:PodManager" } - } + "@context": [ + "https://linkedsoftwaredependencies.org/bundles/npm/@netwerk-digitaal-erfgoed/solid-crs-pods/^0.0.0/components/context.jsonld", + "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^2.0.0/components/context.jsonld" + ], + "@graph": [ + { + "comment": "Handles all functionality on the register page", + "@id": "urn:solid-server:auth:password:RegistrationRoute", + "@type": "BasicInteractionRoute", + "route": "^/register/$", + "viewTemplates": { + "BasicInteractionRoute:_viewTemplates_key": "text/html", + "BasicInteractionRoute:_viewTemplates_value": "./templates/identity/email-password/register.html.ejs" + }, + "responseTemplates": { + "BasicInteractionRoute:_responseTemplates_key": "text/html", + "BasicInteractionRoute:_responseTemplates_value": "./templates/identity/email-password/register-response.html.ejs" + }, + "controls": { + "BasicInteractionRoute:_controls_key": "register", + "BasicInteractionRoute:_controls_value": "/register" + }, + "handler": { + "@type": "NoCredentialRegistrationHandler", + "registrationManager": { + "@type": "NoCredentialRegistrationManager", + "args_baseUrl": { "@id": "urn:solid-server:default:variable:baseUrl" }, + "args_webIdSuffix": "/profile/card#me", + "args_identifierGenerator": { "@id": "urn:solid-server:default:IdentifierGenerator" }, + "args_ownershipValidator": { "@id": "urn:solid-server:auth:password:OwnershipValidator" }, + "args_accountStore": { "@id": "urn:solid-server:auth:password:AccountStore" }, + "args_podManager": { "@id": "urn:solid-server:default:PodManager" } } } - ] - } \ No newline at end of file + } + ] +} diff --git a/packages/solid-crs-pods/lib/NoCredentialRegistrationHandler.ts b/packages/solid-crs-pods/lib/NoCredentialRegistrationHandler.ts new file mode 100644 index 00000000..75e392f0 --- /dev/null +++ b/packages/solid-crs-pods/lib/NoCredentialRegistrationHandler.ts @@ -0,0 +1,31 @@ +import { InteractionHandler, getLoggerFor, InteractionHandlerInput, InteractionResponseResult, readJsonStream } from '@solid/community-server'; +import { NoCredentialRegistrationManager, RegistrationResponse } from './NoCredentialRegistrationManager'; + +/** + * Supports registration based on the `NoCredentialRegistrationManager` behaviour. + */ +export class NoCredentialRegistrationHandler extends InteractionHandler { + + protected readonly logger = getLoggerFor(this); + + private readonly registrationManager: NoCredentialRegistrationManager; + + constructor(registrationManager: NoCredentialRegistrationManager) { + + super(); + this.registrationManager = registrationManager; + + } + + async handle({ operation }: InteractionHandlerInput): + Promise> { + + const data = await readJsonStream(operation.body.data); + const validated = this.registrationManager.validateInput(data, false); + const details = await this.registrationManager.register(validated, false); + + return { type: 'response', details }; + + } + +} diff --git a/packages/solid-crs-pods/lib/NoCredentialRegistrationManager.ts b/packages/solid-crs-pods/lib/NoCredentialRegistrationManager.ts new file mode 100644 index 00000000..e9edcd7d --- /dev/null +++ b/packages/solid-crs-pods/lib/NoCredentialRegistrationManager.ts @@ -0,0 +1,252 @@ +import assert from 'assert'; +import { getLoggerFor, joinUrl } from '@solid/community-server'; +import type { AccountStore, PodSettings, PodManager, IdentifierGenerator, ResourceIdentifier, OwnershipValidator } from '@solid/community-server'; + +export interface RegistrationManagerArgs { + /** + * Used to set the `oidcIssuer` value of newly registered pods. + */ + baseUrl: string; + /** + * Appended to the generated pod identifier to create the corresponding WebID. + */ + webIdSuffix: string; + /** + * Generates identifiers for new pods. + */ + identifierGenerator: IdentifierGenerator; + /** + * Verifies the user is the owner of the WebID they provide. + */ + ownershipValidator: OwnershipValidator; + /** + * Stores all the registered account information. + */ + accountStore: AccountStore; + /** + * Creates the new pods. + */ + podManager: PodManager; +} + +/** + * The parameters expected for registration. + */ +export interface RegistrationParams { + webId?: string; + podName?: string; + template?: string; + createWebId: false; + register: false; + createPod: true; + rootPod: false; +} + +/** + * The result of a registration action. + */ +export interface RegistrationResponse { + webId?: string; + oidcIssuer?: string; + podBaseUrl?: string; + createWebId: boolean; + register: boolean; + createPod: boolean; +} + +const emailRegex = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/u; + +/** + * Supports IDP registration and pod creation based on input parameters. + * + * The above behaviour is combined in the two class functions. + * `validateInput` will make sure all incoming data is correct and makes sense. + * `register` will call all the correct handlers based on the requirements of the validated parameters. + */ +export class NoCredentialRegistrationManager { + + protected readonly logger = getLoggerFor(this); + + private readonly baseUrl: string; + private readonly webIdSuffix: string; + private readonly identifierGenerator: IdentifierGenerator; + private readonly ownershipValidator: OwnershipValidator; + private readonly accountStore: AccountStore; + private readonly podManager: PodManager; + + constructor(args: RegistrationManagerArgs) { + + this.baseUrl = args.baseUrl; + this.webIdSuffix = args.webIdSuffix; + this.identifierGenerator = args.identifierGenerator; + this.ownershipValidator = args.ownershipValidator; + this.accountStore = args.accountStore; + this.podManager = args.podManager; + + } + + /** + * Trims the input if it is a string, returns `undefined` otherwise. + */ + private trimString(input: unknown): string | undefined { + + if (typeof input === 'string') { + + return input.trim(); + + } + + } + + /** + * Makes sure the input conforms to the following requirements when relevant: + * * At least one option needs to be chosen. + * * In case a new WebID needs to be created, the other 2 steps will be set to true. + * * Valid email/WebID/password/podName when required. + * * Only create a root pod when allowed. + * + * @param input - Input parameters for the registration procedure. + * @param allowRoot - If creating a pod in the root container should be allowed. + * + * @returns A cleaned up version of the input parameters. + * Only (trimmed) parameters that are relevant to the registration procedure will be retained. + */ + validateInput(input: NodeJS.Dict, allowRoot = false): RegistrationParams { + + const { + webId, podName, template, + } = input; + + // Parse email + // const trimmedEmail = this.trimString(email); + // assert(trimmedEmail && emailRegex.test(trimmedEmail), 'Please enter a valid e-mail address.'); + + // assertPassword(password, confirmPassword); + + const validated: RegistrationParams = { + register: false, + createPod: true, + createWebId: false, + rootPod: false, + }; + + assert(validated.register || validated.createPod, 'Please register for a WebID or create a Pod.'); + assert(allowRoot || !validated.rootPod, 'Creating a root pod is not supported.'); + + // Parse WebID + if (!validated.createWebId) { + + const trimmedWebId = this.trimString(webId); + assert(trimmedWebId && /^https?:\/\/[^/]+/u.test(trimmedWebId), 'Please enter a valid WebID.'); + validated.webId = trimmedWebId; + + } + + // Parse Pod name + if (validated.createPod && !validated.rootPod) { + + const trimmedPodName = this.trimString(podName); + assert(trimmedPodName && trimmedPodName.length > 0, 'Please specify a Pod name.'); + validated.podName = trimmedPodName; + + } + + // Parse template if there is one + if (template) { + + validated.template = this.trimString(template); + + } + + return validated; + + } + + /** + * Handles the 3 potential steps of the registration process: + * 1. Generating a new WebID. + * 2. Registering a WebID with the IDP. + * 3. Creating a new pod for a given WebID. + * + * All of these steps are optional and will be determined based on the input parameters. + * + * This includes the following steps: + * * Ownership will be verified when the WebID is provided. + * * When registering and creating a pod, the base URL will be used as oidcIssuer value. + */ + async register(input: RegistrationParams, allowRoot = false): Promise { + + // This is only used when createWebId and/or createPod are true + let podBaseUrl: ResourceIdentifier | undefined; + + if (input.createPod) { + + if (input.rootPod) { + + podBaseUrl = { path: this.baseUrl }; + + } else { + + podBaseUrl = this.identifierGenerator.generate(input.podName!); + + } + + } + + // Create or verify the WebID + if (input.createWebId) { + + input.webId = joinUrl(podBaseUrl!.path, this.webIdSuffix); + + } else { + + await this.ownershipValidator.handleSafe({ webId: input.webId! }); + + } + + // Register the account + // const settings: AccountSettings = { + // useIdp: input.register, + // podBaseUrl: podBaseUrl?.path, + // }; + // await this.accountStore.create(input.email, input.webId!, input.password, settings); + + // Create the pod + if (input.createPod) { + + const podSettings: PodSettings = { + email: undefined, + webId: input.webId!, + template: input.template, + podBaseUrl: podBaseUrl!.path, + }; + + // Set the OIDC issuer to our server when registering with the IDP + if (input.register) { + + podSettings.oidcIssuer = this.baseUrl; + + } + + // Only allow overwrite for root pods + await this.podManager.createPod(podBaseUrl!, podSettings, allowRoot); + + } + + // Verify the account + // This prevents there being a small timeframe where the account can be used before the pod creation is finished. + // That timeframe could potentially be used by malicious users. + // await this.accountStore.verify(input.email); + + return { + webId: input.webId, + oidcIssuer: this.baseUrl, + podBaseUrl: podBaseUrl?.path, + createWebId: input.createWebId, + register: input.register, + createPod: input.createPod, + }; + + } + +} diff --git a/packages/solid-crs-pods/lib/index.ts b/packages/solid-crs-pods/lib/index.ts new file mode 100644 index 00000000..80651a8e --- /dev/null +++ b/packages/solid-crs-pods/lib/index.ts @@ -0,0 +1,2 @@ +export * from './NoCredentialRegistrationManager'; +export * from './NoCredentialRegistrationHandler'; diff --git a/packages/solid-crs-pods/package-lock.json b/packages/solid-crs-pods/package-lock.json index 3e12c5a8..79f8caa6 100644 --- a/packages/solid-crs-pods/package-lock.json +++ b/packages/solid-crs-pods/package-lock.json @@ -1484,6 +1484,32 @@ } } }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@panva/asn1.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@panva/asn1.js/-/asn1.js-1.0.0.tgz", @@ -1593,6 +1619,12 @@ "defer-to-connect": "^1.0.1" } }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, "@types/accepts": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz", @@ -1924,6 +1956,54 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz", "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==" }, + "@typescript-eslint/types": { + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.33.0.tgz", + "integrity": "sha512-zKp7CjQzLQImXEpLt2BUw1tvOMPfNoTAfb8l51evhYbOEEzdWyQNmHWWGPR6hwKJDAi+1VXSBmnhL9kyVTTOuQ==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz", + "integrity": "sha512-rkWRY1MPFzjwnEVHsxGemDzqqddw2QbTJlICPD9p9I9LfsO8fdmfQPOX3uKfUaGRDFJbfrtm/sXhVXN4E+bzCA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.33.0", + "@typescript-eslint/visitor-keys": "4.33.0", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "dependencies": { + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.33.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.33.0.tgz", + "integrity": "sha512-uqi/2aSz9g2ftcHWf8uLPJA70rUv6yuMW5Bohw+bwcuzaxQIHaKFZCKGoGXIrc9vkTJ3+0txM73K0Hq3d5wgIg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.33.0", + "eslint-visitor-keys": "^2.0.0" + } + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -2020,6 +2100,12 @@ "readable-stream": "^3.6.0" } }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, "arrayify-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/arrayify-stream/-/arrayify-stream-1.0.0.tgz", @@ -2076,6 +2162,15 @@ "concat-map": "0.0.1" } }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -2227,6 +2322,12 @@ "text-hex": "1.0.x" } }, + "comment-parser": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.7.6.tgz", + "integrity": "sha512-GKNxVA7/iuTnAqGADlTWX4tkhzxZKXp5fLJqKTlQLHkE65XDUKutZ3BHaJC5IGcper2tT3QRD1xr4o3jNpgXXg==", + "dev": true + }, "componentsjs": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/componentsjs/-/componentsjs-4.5.0.tgz", @@ -2254,6 +2355,23 @@ } } }, + "componentsjs-generator": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/componentsjs-generator/-/componentsjs-generator-2.6.1.tgz", + "integrity": "sha512-WA8UNWbBbTmJmC5IxP/N+TJz/XBPfpdzlnzRB5fS2vOmZbwul54/kTxl2V+jjEh/k7Nyh8oKFd/4kE9ZRFSChA==", + "dev": true, + "requires": { + "@types/lru-cache": "^5.1.0", + "@types/semver": "^7.3.4", + "@typescript-eslint/typescript-estree": "^4.6.1", + "comment-parser": "^0.7.6", + "componentsjs": "^4.4.0", + "jsonld-context-parser": "^2.0.2", + "lru-cache": "^6.0.0", + "minimist": "^1.2.5", + "semver": "^7.3.2" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2371,6 +2489,15 @@ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "dom-serializer": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", @@ -2472,6 +2599,12 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + }, "event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", @@ -2482,6 +2615,28 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "fecha": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz", @@ -2516,6 +2671,15 @@ "minimatch": "^3.0.4" } }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "fn.name": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", @@ -2621,6 +2785,29 @@ "path-is-absolute": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, "got": { "version": "9.6.0", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", @@ -2803,6 +2990,12 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, "immutable": { "version": "3.8.2", "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz", @@ -2842,6 +3035,12 @@ "has": "^1.0.3" } }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -2855,6 +3054,21 @@ "has-tostringtag": "^1.0.0" } }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, "is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -3093,6 +3307,12 @@ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, "microdata-rdf-streaming-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/microdata-rdf-streaming-parser/-/microdata-rdf-streaming-parser-1.2.0.tgz", @@ -3122,6 +3342,16 @@ } } }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + }, "mime-db": { "version": "1.51.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", @@ -3370,6 +3600,18 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true + }, "prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", @@ -3745,6 +3987,12 @@ "lowercase-keys": "^1.0.0" } }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -3753,6 +4001,15 @@ "glob": "^7.1.3" } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -3834,6 +4091,12 @@ "is-arrayish": "^0.3.1" } }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -4021,6 +4284,15 @@ "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "toidentifier": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", @@ -4041,11 +4313,26 @@ "resolved": "https://registry.npmjs.org/ts-guards/-/ts-guards-0.5.1.tgz", "integrity": "sha512-Y6P/VJnwARiPMfxO7rvaYaz5tGQ5TQ0Wnb2cWIxMpFOioYkhsT8XaCrJX6wYPNFACa4UOrN5SPqhwpM8NolAhQ==" }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, "tsscmp": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/tsscmp/-/tsscmp-1.0.6.tgz", "integrity": "sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==" }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -4055,6 +4342,12 @@ "mime-types": "~2.1.24" } }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + }, "uglify-js": { "version": "3.14.3", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.3.tgz", diff --git a/packages/solid-crs-pods/package.json b/packages/solid-crs-pods/package.json index 5bdf4e6a..145b428e 100644 --- a/packages/solid-crs-pods/package.json +++ b/packages/solid-crs-pods/package.json @@ -4,14 +4,48 @@ "description": "Pods for the demo environment of the NDE-project.", "author": "Wouter Janssens ", "license": "EUPL-1.2", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "directories": { + "lib": "lib" + }, + "files": [ + "dist", + "config", + ".componentsignore" + ], + "publishConfig": { + "registry": "https://npm.pkg.github.com/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/netwerk-digitaal-erfgoed/solid-crs.git", + "directory": "packages/solid-crs-pods" + }, "scripts": { - "start": "shx rm -rf tmp/ && shx mkdir tmp && shx cp -r data/. tmp/ && community-solid-server -c config/file.json --rootFilePath ./tmp -p 3000", - "start:watch": "npm run start" + "start": "shx rm -rf tmp/ && shx mkdir tmp && shx cp -r data/. tmp/ && community-solid-server -m . -c config/file.json --rootFilePath ./tmp -p 3000", + "start:watch": "npm run start", + "build": "npm run build:ts && npm run build:components", + "build:components": "componentsjs-generator --typeScopedContexts -s lib -c dist/components -i .componentsignore", + "build:ts": "tsc" }, "dependencies": { "@solid/community-server": "2.0.1" }, "devDependencies": { - "shx": "^0.3.3" + "@tsconfig/node12": "^1.0.9", + "componentsjs-generator": "^2.6.1", + "shx": "^0.3.3", + "typescript": "^4.3.4" + }, + "lsd:module": "https://linkedsoftwaredependencies.org/bundles/npm/@netwerk-digitaal-erfgoed/solid-crs-pods", + "lsd:components": "dist/components/components.jsonld", + "lsd:contexts": { + "https://linkedsoftwaredependencies.org/bundles/npm/@netwerk-digitaal-erfgoed/solid-crs-pods/^0.0.0/components/context.jsonld": "dist/components/context.jsonld" + }, + "lsd:importPaths": { + "https://linkedsoftwaredependencies.org/bundles/npm/@netwerk-digitaal-erfgoed/solid-crs-pods/^0.0.0/components/": "dist/components/", + "https://linkedsoftwaredependencies.org/bundles/npm/@netwerk-digitaal-erfgoed/solid-crs-pods/^0.0.0/config/": "config/", + "https://linkedsoftwaredependencies.org/bundles/npm/@netwerk-digitaal-erfgoed/solid-crs-pods/^0.0.0/dist/": "dist/" } } diff --git a/packages/solid-crs-pods/templates/identity/email-password/register-partial.html.ejs b/packages/solid-crs-pods/templates/identity/email-password/register-partial.html.ejs index 44c3a194..99a9e067 100644 --- a/packages/solid-crs-pods/templates/identity/email-password/register-partial.html.ejs +++ b/packages/solid-crs-pods/templates/identity/email-password/register-partial.html.ejs @@ -2,6 +2,7 @@ <% const isBlankForm = !('prefilled' in locals); prefilled = locals.prefilled || {}; +console.log(prefilled) %>

Jouw WebID

@@ -72,8 +73,8 @@ prefilled = locals.prefilled || {}; -

Jouw account

-
+ +