From 4a5224b3a6e3c311fbe5063950650bf464ffcee3 Mon Sep 17 00:00:00 2001 From: Matthieu Bosquet Date: Tue, 13 Jul 2021 18:06:54 +0100 Subject: [PATCH] chore: update access token verifier --- package-lock.json | 231 +----------------- package.json | 2 +- src/authentication/BearerWebIdExtractor.ts | 4 +- src/authentication/DPoPWebIdExtractor.ts | 4 +- ...n-verifier.ts => access-token-verifier.ts} | 2 +- test/integration/Identity.test.ts | 4 +- .../BearerWebIdExtractor.test.ts | 2 +- .../authentication/DPoPWebIdExtractor.test.ts | 2 +- 8 files changed, 23 insertions(+), 228 deletions(-) rename test/__mocks__/@solid/{identity-token-verifier.ts => access-token-verifier.ts} (76%) diff --git a/package-lock.json b/package-lock.json index e0c94d927..4b7d6cca0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4244,241 +4244,36 @@ "@sinonjs/commons": "^1.7.0" } }, - "@solid/identity-token-verifier": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@solid/identity-token-verifier/-/identity-token-verifier-0.8.0.tgz", - "integrity": "sha512-um05bFmoORd6nBjndN9BzAiTT91LfDA/OqHut6iXhAEzIMeMKCkrHTowFhOY1COYYjrobIPViqTaXAechaSq0Q==", + "@solid/access-token-verifier": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/@solid/access-token-verifier/-/access-token-verifier-0.9.4.tgz", + "integrity": "sha512-MCQVe3W9QAzqNrDRxfkExxXLqcHkGD25Bt4DfVYFXb+z1g8QBthlWSRSUhVQOsvlSqrf1NO7kaIEeN2GBK32xg==", "requires": { "cross-fetch": "^3.1.4", - "jose": "^3.12.3", + "jose": "^3.14.0", "lru-cache": "^6.0.0", - "n3": "^1.10.0", + "n3": "^1.11.0", "nmspc": "^0.2.4", "rdf-data-factory": "^1.0.4", "rdf-dereference": "^1.8.0", - "rdf-parse": "^1.8.0", + "rdf-parse": "^1.8.1", "rdf-store-stream": "^1.2.0", "ts-guards": "^0.5.1" }, "dependencies": { - "@comunica/actor-abstract-mediatyped": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-abstract-mediatyped/-/actor-abstract-mediatyped-1.21.1.tgz", - "integrity": "sha512-5LzWccqId3AfAeCPGqPkOiDATXrooXYLn58sNXDRdDUsRpL/jZ6be+7F000ZLTHnDRVCiLCXtb5P7984bBIzaA==" - }, - "@comunica/actor-http-native": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-http-native/-/actor-http-native-1.21.1.tgz", - "integrity": "sha512-dJlBz8/nQgxH5ARkh8/092BbvQ8vaJ38hjWinLXXakmdj8WsVHnhUJ7/D4YtqY61bjwCBFekOLSPjfxKCEMRgA==", - "requires": { - "@comunica/context-entries": "^1.21.1", - "@types/parse-link-header": "^1.0.0", - "cross-fetch": "^3.0.5", - "follow-redirects": "^1.5.1", - "parse-link-header": "^1.0.1" - } - }, - "@comunica/actor-rdf-parse-html": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-rdf-parse-html/-/actor-rdf-parse-html-1.21.1.tgz", - "integrity": "sha512-eZUExtLtC28nEMrECL2g3kmZjLmuY/Nu7S9p5NyvI60cwEjj1Rbf0aM9xqWLG5vuCiSKQz7MUobQ92WxtG6RHA==", - "requires": { - "@comunica/bus-rdf-parse-html": "^1.21.1", - "@types/rdf-js": "*", - "htmlparser2": "^6.0.0" - } - }, - "@comunica/actor-rdf-parse-html-rdfa": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-rdf-parse-html-rdfa/-/actor-rdf-parse-html-rdfa-1.21.1.tgz", - "integrity": "sha512-37whUUn3LsvCV/kj37/ztAnBjGqKdGP8fLUpD3z8vDOg3ArhktPvWn+cB0ssU0DKSzsCTnCNujS7QoVyINPxJQ==", - "requires": { - "rdfa-streaming-parser": "^1.4.0" - } - }, - "@comunica/actor-rdf-parse-html-script": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-rdf-parse-html-script/-/actor-rdf-parse-html-script-1.21.1.tgz", - "integrity": "sha512-cM06ZEVpgj4/fLFrM8alRi0a4kh1XVY3vwWOyZXnkjVkIKp36Nc17Pw4+vM10z7D+x5VI/mZc0tGMohr8u7dcw==", - "requires": { - "@comunica/bus-rdf-parse-html": "^1.21.1", - "@types/rdf-js": "*", - "relative-to-absolute-iri": "^1.0.5" - } - }, - "@comunica/actor-rdf-parse-jsonld": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-rdf-parse-jsonld/-/actor-rdf-parse-jsonld-1.21.1.tgz", - "integrity": "sha512-0pnZJUQ5bhaUwM7pQNr1afmoVKMmnYhJHdub9j/l2jAJWJFbVWucZI9z/g7r9Tek4SBS6PcM2+2sx8U9+WiiIA==", - "requires": { - "@comunica/context-entries": "^1.21.1", - "@types/rdf-js": "*", - "jsonld-context-parser": "^2.1.2", - "jsonld-streaming-parser": "^2.3.0", - "stream-to-string": "^1.2.0" - } - }, - "@comunica/actor-rdf-parse-n3": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-rdf-parse-n3/-/actor-rdf-parse-n3-1.21.1.tgz", - "integrity": "sha512-SFx/hkY0yr/TxfVdEecVg3DY2KOWPeGfM288CjDQjogx6Sxb6JuF9JaipNX8/twKVdBefGS9b1S9EyKpcr99Zg==", - "requires": { - "@types/n3": "^1.4.4", - "n3": "^1.6.3" - } - }, - "@comunica/actor-rdf-parse-rdfxml": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-rdf-parse-rdfxml/-/actor-rdf-parse-rdfxml-1.21.1.tgz", - "integrity": "sha512-fv5+DF5LagSJUayyQm7a917XQ9PNUfJVh2bqO/NlVfESXO8OFUAIySefW+j1y1JA0fpa5v1OnWTGAfdxGKnrUg==", - "requires": { - "rdfxml-streaming-parser": "^1.4.0" - } - }, - "@comunica/actor-rdf-parse-xml-rdfa": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/actor-rdf-parse-xml-rdfa/-/actor-rdf-parse-xml-rdfa-1.21.1.tgz", - "integrity": "sha512-+9qyKJS+Ab3BWqrWnFU5CSgEDGtoGJpe19TzpymSXDP0aSAM6lnkZpCvT3EKi/Y8Bmw9xRXJZwemtxQK2y4SSQ==", - "requires": { - "rdfa-streaming-parser": "^1.3.0" - } - }, - "@comunica/bus-http": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/bus-http/-/bus-http-1.21.1.tgz", - "integrity": "sha512-M6gi128ME+7uSnLPz4Bx3jgXhIb5/O7tODVHAtw9gt0z/9AAuYfmW9jqmcZ5Uwv3CCvJSvEc/m+dooCv35dTsA==", - "requires": { - "@comunica/context-entries": "^1.21.1", - "is-stream": "^2.0.0", - "web-streams-node": "^0.4.0" - } - }, - "@comunica/bus-init": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/bus-init/-/bus-init-1.21.1.tgz", - "integrity": "sha512-h8Gp/iJiyY8mbqhrbfLySwTXasjxmCX6kpM9RyXWqCBJzdx8Bfq6F/nYg2N+zpEJgyrn5zLdNgbBkcDetdeAmA==" - }, - "@comunica/bus-rdf-parse": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/bus-rdf-parse/-/bus-rdf-parse-1.21.1.tgz", - "integrity": "sha512-JQD9Cgml/W+PCSEX3WulwxiQOdULFxAFDipLk69/J9WZxOj6emufxStM8M9R+pavbLaLYRcBQWgO0KLhEn/Rnw==", - "requires": { - "@comunica/actor-abstract-mediatyped": "^1.21.1", - "@types/rdf-js": "*" - } - }, - "@comunica/bus-rdf-parse-html": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/bus-rdf-parse-html/-/bus-rdf-parse-html-1.21.1.tgz", - "integrity": "sha512-DJDFB8lxTJ1Pt+AhjOqe9hvj2nKtC23fJfEihU7DYIbz67O5pXAFgFtp9gn3gefoGB7T/CKoB8y8DcZy8N5u0A==", - "requires": { - "@types/rdf-js": "*" - } - }, - "@comunica/core": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/core/-/core-1.21.1.tgz", - "integrity": "sha512-5lY/HkyOCorY2CtxQiKUKEOcUGjIKf/YG/txJrz84SKuy+zC91zq1Zt8qWfzNihCcWrgfmk0oZuvjbYvZGK4EA==", - "requires": { - "@comunica/context-entries": "^1.21.1", - "@comunica/types": "^1.21.1", - "immutable": "^3.8.2" - } - }, - "@comunica/mediator-combine-union": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/mediator-combine-union/-/mediator-combine-union-1.21.1.tgz", - "integrity": "sha512-wp2lbViVOOeNKTBRD+6sze7TKVX71T2RD324/1Syb8vOpwT3mtaDNJYFg0Mrwer/Xs54d7nA7JGZA2wC2HaXow==" - }, - "@comunica/mediator-number": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/mediator-number/-/mediator-number-1.21.1.tgz", - "integrity": "sha512-OeuGx0R/mWI1uMMXM2V1vcR8J1DPhYXPR+Ncg4/qKHl7tSCQH1tlCgZu0+fovY2Qmc14f1tmw5YgnsE8lsikSQ==" - }, - "@comunica/mediator-race": { - "version": "1.21.1", - "resolved": "https://registry.npmjs.org/@comunica/mediator-race/-/mediator-race-1.21.1.tgz", - "integrity": "sha512-SgdtF1JmqDyhZJsAOiVMPuV1qgdXqv/hbsFCxcmDQ+8q1ObmQ+0DZvdUe5Ymf2IyFaevsOHHG7hF5hJbLZmdmQ==" - }, - "@types/node": { - "version": "13.13.52", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.52.tgz", - "integrity": "sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ==" - }, - "cross-fetch": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", - "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", - "requires": { - "node-fetch": "2.6.1" - } - }, "jose": { - "version": "3.12.3", - "resolved": "https://registry.npmjs.org/jose/-/jose-3.12.3.tgz", - "integrity": "sha512-PtT5I/omolkItXxKu+BhyrBhoYpmJAIPiG+W00BwZ4I3gT9rl8pLnK5cs2ha0LAknMxLVvM3UexcuYwNUkQ7aw==" - }, - "jsonld-context-parser": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/jsonld-context-parser/-/jsonld-context-parser-2.1.2.tgz", - "integrity": "sha512-zAhus+dz4IrXiYAiYf6M1PSdYkILVWPg4bqqGfim+rGrmVc3d0drFAriLOU2RMwQFKljM+41lJTau47sxt6YWA==", - "requires": { - "@types/http-link-header": "^1.0.1", - "@types/node": "^13.1.0", - "canonicalize": "^1.0.1", - "cross-fetch": "^3.0.6", - "http-link-header": "^1.0.2", - "relative-to-absolute-iri": "^1.0.5" - } - }, - "jsonld-streaming-parser": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/jsonld-streaming-parser/-/jsonld-streaming-parser-2.3.2.tgz", - "integrity": "sha512-C9hyL5LRb2K0eaS5biP+ixUtMjr3UPJn9WInNYAmjX9tL7NzeSw3lY7nW3GEnKETxF3I3btvEPR1Nm/+tHMWZQ==", - "requires": { - "@types/http-link-header": "^1.0.1", - "@types/rdf-js": "*", - "canonicalize": "^1.0.1", - "http-link-header": "^1.0.2", - "jsonld-context-parser": "^2.1.2", - "jsonparse": "^1.3.1", - "rdf-data-factory": "^1.0.4" - } + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/jose/-/jose-3.14.0.tgz", + "integrity": "sha512-Hk4yFVGiSTuryL0XVyRTCvCPoD9eDCvEX/t+SpHTXXeNXsoxyopPLhoCLTt90vnu7yeIYXDdJWHNgI3Ix4H1FQ==" }, "n3": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/n3/-/n3-1.10.0.tgz", - "integrity": "sha512-y+qpS0GktEBttOaDR+BF1t1G2fw4Xn4nCZWNn+7MvEmD2I4YpMH6OJF/xHKSwInCxOC9vu9eI6pluB9/RDUyZQ==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/n3/-/n3-1.11.0.tgz", + "integrity": "sha512-hdGhm7BbiesuQTm2S4Gsq2Z0J/iCRMsvtmrlLNxzXlnf1aSRsbKQk5XkFNKtX9aS54oKzyGSZUVm7F/IOhmFhg==", "requires": { "queue-microtask": "^1.1.2", "readable-stream": "^3.6.0" } - }, - "rdf-parse": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/rdf-parse/-/rdf-parse-1.8.0.tgz", - "integrity": "sha512-Pc6jvqjlJpY/ivVPbfbCJw372VhUx1dTMGLGGU/bHz6srjLL9Q4scn655afAuDI89KamDBRTDN+ZzlfiWfgbfg==", - "requires": { - "@comunica/actor-http-native": "~1.21.1", - "@comunica/actor-rdf-parse-html": "~1.21.1", - "@comunica/actor-rdf-parse-html-microdata": "~1.21.1", - "@comunica/actor-rdf-parse-html-rdfa": "~1.21.1", - "@comunica/actor-rdf-parse-html-script": "~1.21.1", - "@comunica/actor-rdf-parse-jsonld": "~1.21.1", - "@comunica/actor-rdf-parse-n3": "~1.21.1", - "@comunica/actor-rdf-parse-rdfxml": "~1.21.1", - "@comunica/actor-rdf-parse-xml-rdfa": "~1.21.1", - "@comunica/bus-http": "~1.21.1", - "@comunica/bus-init": "~1.21.1", - "@comunica/bus-rdf-parse": "~1.21.1", - "@comunica/bus-rdf-parse-html": "~1.21.1", - "@comunica/core": "~1.21.1", - "@comunica/mediator-combine-union": "~1.21.1", - "@comunica/mediator-number": "~1.21.1", - "@comunica/mediator-race": "~1.21.1", - "@types/rdf-js": "*", - "stream-to-string": "^1.2.0" - } } } }, diff --git a/package.json b/package.json index 757050336..4798a5ff1 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "@comunica/actor-init-sparql": "^1.21.3", "@rdfjs/data-model": "^1.2.0", "@rdfjs/fetch": "^2.1.0", - "@solid/identity-token-verifier": "^0.8.0", + "@solid/access-token-verifier": "^0.9.4", "@types/arrayify-stream": "^1.0.0", "@types/async-lock": "^1.1.2", "@types/bcrypt": "^5.0.0", diff --git a/src/authentication/BearerWebIdExtractor.ts b/src/authentication/BearerWebIdExtractor.ts index 167347e8f..6b98f3095 100644 --- a/src/authentication/BearerWebIdExtractor.ts +++ b/src/authentication/BearerWebIdExtractor.ts @@ -1,5 +1,5 @@ -import type { SolidTokenVerifierFunction } from '@solid/identity-token-verifier'; -import { createSolidTokenVerifier } from '@solid/identity-token-verifier'; +import type { SolidTokenVerifierFunction } from '@solid/access-token-verifier'; +import { createSolidTokenVerifier } from '@solid/access-token-verifier'; import { getLoggerFor } from '../logging/LogUtil'; import type { HttpRequest } from '../server/HttpRequest'; import { BadRequestHttpError } from '../util/errors/BadRequestHttpError'; diff --git a/src/authentication/DPoPWebIdExtractor.ts b/src/authentication/DPoPWebIdExtractor.ts index 5cdd69cd3..68c7eb5a6 100644 --- a/src/authentication/DPoPWebIdExtractor.ts +++ b/src/authentication/DPoPWebIdExtractor.ts @@ -1,5 +1,5 @@ -import type { RequestMethod } from '@solid/identity-token-verifier'; -import { createSolidTokenVerifier } from '@solid/identity-token-verifier'; +import type { RequestMethod } from '@solid/access-token-verifier'; +import { createSolidTokenVerifier } from '@solid/access-token-verifier'; import type { TargetExtractor } from '../ldp/http/TargetExtractor'; import { getLoggerFor } from '../logging/LogUtil'; import type { HttpRequest } from '../server/HttpRequest'; diff --git a/test/__mocks__/@solid/identity-token-verifier.ts b/test/__mocks__/@solid/access-token-verifier.ts similarity index 76% rename from test/__mocks__/@solid/identity-token-verifier.ts rename to test/__mocks__/@solid/access-token-verifier.ts index 1390124b6..7d628a972 100644 --- a/test/__mocks__/@solid/identity-token-verifier.ts +++ b/test/__mocks__/@solid/access-token-verifier.ts @@ -1,4 +1,4 @@ -import type { SolidTokenVerifierFunction } from '@solid/identity-token-verifier'; +import type { SolidTokenVerifierFunction } from '@solid/access-token-verifier'; const solidTokenVerifier = jest.fn().mockResolvedValue({ aud: 'solid', exp: 1234, iat: 1234, iss: 'example.com/idp', webid: 'http://alice.example/card#me' }); export const createSolidTokenVerifier = jest.fn((): SolidTokenVerifierFunction => solidTokenVerifier); diff --git a/test/integration/Identity.test.ts b/test/integration/Identity.test.ts index 247857d49..652435daf 100644 --- a/test/integration/Identity.test.ts +++ b/test/integration/Identity.test.ts @@ -13,8 +13,8 @@ import { IdentityTestState } from './IdentityTestState'; const port = getPort('Identity'); const baseUrl = `http://localhost:${port}/`; -// Undo the global identity token verifier mock -jest.unmock('@solid/identity-token-verifier'); +// Undo the global access token verifier mock +jest.unmock('@solid/access-token-verifier'); // Don't send actual e-mails jest.mock('nodemailer'); diff --git a/test/unit/authentication/BearerWebIdExtractor.test.ts b/test/unit/authentication/BearerWebIdExtractor.test.ts index 4392df0f8..3a434261d 100644 --- a/test/unit/authentication/BearerWebIdExtractor.test.ts +++ b/test/unit/authentication/BearerWebIdExtractor.test.ts @@ -1,4 +1,4 @@ -import { createSolidTokenVerifier } from '@solid/identity-token-verifier'; +import { createSolidTokenVerifier } from '@solid/access-token-verifier'; import { BearerWebIdExtractor } from '../../../src/authentication/BearerWebIdExtractor'; import type { HttpRequest } from '../../../src/server/HttpRequest'; import { BadRequestHttpError } from '../../../src/util/errors/BadRequestHttpError'; diff --git a/test/unit/authentication/DPoPWebIdExtractor.test.ts b/test/unit/authentication/DPoPWebIdExtractor.test.ts index 792cff334..d9cfb097e 100644 --- a/test/unit/authentication/DPoPWebIdExtractor.test.ts +++ b/test/unit/authentication/DPoPWebIdExtractor.test.ts @@ -1,4 +1,4 @@ -import { createSolidTokenVerifier } from '@solid/identity-token-verifier'; +import { createSolidTokenVerifier } from '@solid/access-token-verifier'; import { DPoPWebIdExtractor } from '../../../src/authentication/DPoPWebIdExtractor'; import type { HttpRequest } from '../../../src/server/HttpRequest'; import { BadRequestHttpError } from '../../../src/util/errors/BadRequestHttpError';