541 Commits

Author SHA1 Message Date
Jasper Vaneessen
668d0a331f
feat: Only accept NamedNodes as predicates for metadata
* refactor: move toCachedNamedNode (private)

* chore: only NamedNodes predicates in removes

* feat: enforce NamedNode predicates in most cases

* feat: getAll only accepts NamedNodes

* feat: toCachedNamedNode only accepts string arg

* tests: use NamedNodes for getAll calls

* test: remove unnecessary string check for coverage

* tests: fix NamedNodes in new tests after rebase

* feat: metadatawriters store NamedNodes

* refactor: toCachedNamedNode as utility function

* fix: double write of linkRelMap

* test: use the CONTENT_TYPE constant
2022-04-15 09:53:39 +02:00
Wannes Kerckhove
283c301f08 feat: new helper functions to replace regexes #807
Implemented new StringUtil helper functions: splitCommaSeparated, sanitizeUrlPart, isValidFileName.
Added helper functions to HeaderUtil: matchesAuthorizationScheme, hasScheme.
Added unit tests for the new helper functions.
Refactored codebase to use helper functions instead of regexes if applicable.
2022-04-13 11:26:07 +02:00
Joachim Van Herwegen
1b7cc1ea3a Merge branch 'main' into versions/4.0.0
# Conflicts:
#	test/unit/util/errors/RedirectHttpError.test.ts
2022-04-11 10:21:49 +02:00
Wouter Termont
468e11d906
feat: Add RedirectingHttpHandler
* feat: redirect handler

Signed-off-by: Wouter Termont <woutermont@gmail.com>

* chore: rewrite reduction as loop

Signed-off-by: Wouter Termont <woutermont@gmail.com>

* chore: remove example import

Signed-off-by: Wouter Termont <woutermont@gmail.com>

* feat: add more redirect flavours

Signed-off-by: Wouter Termont <woutermont@gmail.com>

* chore: RedirectingHttpHandler with RedirectAllHttpHandler

Signed-off-by: Wouter Termont <woutermont@gmail.com>

* chore: replace RedirectAllHttpHandler with RedirectingHttpHandler

* chore: revert 5956385 (chore: replace RedirectAllHttpHandler with RedirectingHttpHandler)

This reverts commit 5956385c4180e8e8914b9199c4ed6ca8ae7d39fb.

* docs: complete constructor params

Signed-off-by: Wouter Termont <woutermont@gmail.com>
2022-04-11 09:49:36 +02:00
wkerckho
d42125a91d
fix: Throw error when accessing URLs out of scope
* feat: allow OriginalUrlExtractor to be configured with an identifierStrategy. Included the existing parameter 'includeQueryString' in the OriginalUrlExtractorArgs type.

* test: fixed OriginalUrlExtractor instantiation in OriginalUrlExtractor and RequestParser tests

* fix: Server no longer warns when accessing a URL out of scope #1148

* test: updated tests broken by #1148 fix

* test: ensuring 100% coverage

Co-authored-by: Wannes Kerckhove <wannes.kerckhove@ugent.be>
2022-04-08 09:33:22 +02:00
Joachim Van Herwegen
97e600bf4f fix: Undo authorization on OPTIONS requests 2022-04-04 13:35:15 +02:00
Thomas Dupont
48efc6fae1
feat: Create MetadataParser that detects JSON with Context link and throws an error
* feat: add PlainJsonLdFilter to reject JSON with context link

* refactor: abstract parseLinkHeader into HeaderUtils

* docs: typo in comment field

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>

* refactor: Replace BadRequestHttpError with NotImplementedError

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>

* refactor: incorporate requested changes

* refactor: requested changes incorporated

* refactor: remove obsolete code lines

Co-authored-by: Ruben Verborgh <ruben@verborgh.org>
2022-04-01 14:25:09 +02:00
Ruben Verborgh
3685b7c659 refactor: Make Logger an interface. 2022-04-01 14:18:58 +02:00
Ruben Verborgh
238570b3d2 feat: Make LazyLoggerFactory buffer messages. 2022-04-01 14:18:58 +02:00
Ruben Verborgh
2c6167e0cb feat: Remove meta parameter from logging. 2022-04-01 14:18:58 +02:00
Joachim Van Herwegen
f08cdf75f7 fix: Prevent expired storage cleanup from crashing the server 2022-03-31 17:00:09 +02:00
Joachim Van Herwegen
16e9368734 test: Add flushPromises utility function 2022-03-31 17:00:09 +02:00
Joachim Van Herwegen
76548011f2 fix: Support entries function in JsonResourceStorage 2022-03-31 17:00:09 +02:00
Joachim Van Herwegen
641d39d4bc Merge branch 'main' into versions/4.0.0 2022-03-29 14:54:59 +02:00
Joachim Van Herwegen
6e98c6aae4 feat: Dynamically generate Allow and Accept-* headers 2022-03-29 14:52:36 +02:00
Joachim Van Herwegen
effc20a270 feat: Store methods in MethodNotAllowedHttpError 2022-03-29 14:52:36 +02:00
Joachim Van Herwegen
f3dedf4e27 feat: Add utility functions for generating error classes 2022-03-29 14:52:36 +02:00
Ruben Verborgh
e4688e12a1 chore: Simplify test mocks. 2022-03-29 14:41:31 +02:00
Arthur Joppart
4a37f8c879 chore: replace redis library with ioredis 2022-03-29 14:41:31 +02:00
Joachim Van Herwegen
a1a6ce01fa feat: Create separate storage to generate keys 2022-03-28 11:43:14 +02:00
Joachim Van Herwegen
027e3707fd feat: Parse content-type more strictly 2022-03-28 10:45:05 +02:00
Joachim Van Herwegen
7152897b89 fix: Add IANA type to child metadata in FileDataAccessor 2022-03-28 10:45:05 +02:00
Joachim Van Herwegen
7d3320dea6 chore: Update links for new repository 2022-03-28 10:20:22 +02:00
Joachim Van Herwegen
ad3edcf1a8 feat: Handle OPTIONS requests in OperationHandler 2022-03-18 14:15:12 +01:00
Joachim Van Herwegen
d908374364 feat: Check parent ACL permissions for create/delete requests 2022-03-18 14:15:12 +01:00
Joachim Van Herwegen
e86e0cf36b feat: Return 404 for read/delete requests if there is no resource 2022-03-18 14:15:12 +01:00
Joachim Van Herwegen
9a29cc2257 fix: Extract correct access modes from request 2022-03-18 14:15:12 +01:00
Joachim Van Herwegen
0e4d012086 feat: Add CachedResourceSet
Uses a WeakMap on the identifier to cache resource existence.
2022-03-18 14:15:12 +01:00
Joachim Van Herwegen
4404fa07d9 refactor: Rename resourceExists to hasResource
The function was also moved to the smaller interface ResourceSet.
2022-03-18 14:15:12 +01:00
Joachim Van Herwegen
2ae5924dde feat: Pass access modes to PermissionReaders
This allows PermissionReaders to potentially only check the necessary access modes
for potential performance optimization.
2022-03-18 14:15:12 +01:00
Thomas Dupont
a8602055e6
feat: Store content type parameters
* feat: support storage and retrievel of content-type parameters

* test: extra unit tests for parseContentTypeWithParameters

* refactor: simplify set contentType()

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: simplify for loop because of unique blankNodes

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: ContentTypeParameter should be contentTypeParameter

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: remove undefined type in favor of var? syntax

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: use new parseContentType internally

* chore: remove commented code

* docs: code documentation line changed

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: Check for faulty metadata in contentType rdf structure

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: remove all instances of blanknodes

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: use full contentType when parsing header

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* refactor: use quads() method instead of store.getQuads()

* refactor: .value needed for type correctness

* feat: ReprMetadata constructor now supports full content-type string

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>
2022-03-14 10:27:34 +01:00
Adler Faulkner
c8d4bfec39
feat: Support seeding pods and accounts
* feat(seeding): seed accounts and pods with seeded-pod-config.json

* feat(seeding): dry up SeededPodInitializer by using RegistrationManager directly and make compatible with version/3.0.0

* feat(seeding): update seed config files to version 3.0.0 context

* feat(seeding): simplify seeded-root config by importing pre-existing prefilled-root config

* feat(seeding): Add seeding as a default initializer, update seeded pod copy and guide, change seeded pod config to array

* feat(seeding): remove template info from seeded pod guide, use mockFs, code style nit, fix redlock test

* feat(seeding): remove old config file
2022-03-10 10:16:05 +01:00
Joachim Van Herwegen
e4f1e2aa0c chore(deps): update arrayify-stream to v2 2022-03-10 09:01:53 +01:00
Thomas Dupont
5965268ebf
fix: Prevent slugs with trailing slashes for non-container resources
* fix: slugs ending on slash with link header cannot create containers

* refactor(DataAccessorBasedStore): removing duplicate code and errors

* test(ServerFetch): fix integration tests that create a container

* fix: Reinstate original checks in setResource to let tests succeed

* test: change to container paths to end in / on POST only

* refactor: incorporate review changes

* fix: Error check was too strict

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>

* test: make testcase to test allowed slash behaviour

* test: removed unnecessary code from tests

* test: remove metadata line and duplicate tests

Co-authored-by: Joachim Van Herwegen <joachimvh@gmail.com>
2022-02-23 14:35:02 +01:00
Ruben Verborgh
6306090114 refactor: Add resolveModulePath. 2022-02-22 09:31:24 +01:00
Joachim Van Herwegen
2dc20fe3bc feat: Store the server version on start 2022-02-22 09:31:24 +01:00
Joachim Van Herwegen
62e2210023 feat: Warn users when they change the base URL 2022-02-22 09:31:24 +01:00
Joachim Van Herwegen
e604c0c2e4 feat: Return client information from consent handler 2022-02-21 10:04:57 +01:00
Joachim Van Herwegen
e9e3c6df3c fix: Improve OIDC error descriptions 2022-02-21 10:04:57 +01:00
Joachim Van Herwegen
c9ed90aeeb fix: Update OIDC provider dependency to v7
The biggest resulting change is that the consent page always appears
after logging in.
Some minor fixes to be closer to the spec are included
together with some minor structural refactors.
2022-02-21 10:04:57 +01:00
Joachim Van Herwegen
1769b799df fix: Make IDP routes independent of handlers 2022-02-16 12:47:45 +01:00
Thomas Dupont
ce754c119f
fix: Add content-negotiation when fetching dataset from url
* Solution works but tests don't

* refactor(FetchUtil): use arrayifyStream

* refactor(FetchUtil): split fetchDataset into 2 separate functions

* style(FetchUtil): onelining instead of declaring new local var

* test: trying to mock rdfDereferencer

* refactor: promise can't have async function as arg

* test(FetchUtil): pass Quad array to mockDereference instead

* test: all tests should pass now and coverage is back to 100%

* style: comment typo

* chore: make package.json and package-lock.json compatible with main

* chore: fix package.json double entries

* chore: updated package.json to be alfabetical again

* refactor(AgentGroupAccessChecker): Remove converter from contructor and config

* refactor(TokenOwnerShipValidator): Remove converter from constructor and config

* refactor(FetchUtil): Return BadRequestHttpError instead of generic Error

* test(FetchUtil): return Response object instead of mocking fetch

* style: typos and newlines
2022-02-15 13:44:03 +01:00
Joachim Van Herwegen
c5052625d1 Merge branch 'main' into versions/3.0.0
# Conflicts:
#	package-lock.json
#	package.json
#	src/storage/patch/SparqlUpdatePatcher.ts
#	test/unit/init/AppRunner.test.ts
#	test/unit/util/QuadUtil.test.ts
2022-02-11 15:30:45 +01:00
Joachim Van Herwegen
d2870e5c8b fix(deps): Update dependencies 2022-02-11 15:28:50 +01:00
Joachim Van Herwegen
9ceb62b8b6 refactor: Remove @rdfjs/data-model dependency
We already have N3.js for term generation.
No need to have two solutions there.
2022-02-11 15:28:50 +01:00
Joachim Van Herwegen
9577791472 feat: Simplify setup to be more in line with IDP behaviour 2022-02-11 10:52:45 +01:00
Joachim Van Herwegen
a684b2ead7 feat: Update IDP templates to work with new API format 2022-02-11 10:52:45 +01:00
Joachim Van Herwegen
bc0eeb1012 feat: Split up IDP HTML, routing, and handler behaviour 2022-02-11 10:52:45 +01:00
Joachim Van Herwegen
8f8e8e6df4 feat: Send reset password recordId as query parameter
This is a revert of a previous change
but is now possible due to the use of JSON bodies.
This does mean JavaScript is required in the HTML page,
but that will be required for future changes anyway.
2022-02-11 10:52:45 +01:00
Joachim Van Herwegen
c216efd62f
feat: Allow for custom CLI and variable options
* feat: (AppRunner) Mechanism to configure cli args and derive componentsjs vars from them implemented

* fix: (AppRunner) tidying

* fix: (AppRunner) tidying up

* fix: (AppRunner) runCli method made sync

* fix; (VarResolver) refactored to multiple files, and other stylistic fixes.

* chore: (AppRunner) Uses builder pattern for yargs base arguments setup to enable better typescript inference

* fix(AppRunner): refactoring AppRunner and VarResolver

* fix(AppRunner): refactoring AppRunner promise handling

* fix(AppRunner): verror dependency removal

* fix: Simplify CLI error handling

* feat: Use same config for both CLI and app instantiation

* fix: Update typings and imports

* feat: Split VariableResolver behaviour to 2 classes

* feat: Move default value behaviour from CLI to ValueComputers

* test: Add unit tests for new CLI classes

* feat: Integrate new CLI configuration with all default configurations

* feat: Add createApp function to AppRunner

* docs: Update comments in CLI-related classes

* fix: Various fixes and refactors

Co-authored-by: damooo <damodara@protonmail.com>
2022-02-11 10:00:12 +01:00