From 916dce5bd5eb28bfeacfc294cb689614b2386c36 Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Mon, 26 Jul 2021 14:32:55 +0200 Subject: [PATCH] feat: Allow registration to be disabled --- config/default.json | 1 + config/dynamic.json | 1 + config/example-https-file.json | 1 + config/file.json | 1 + config/identity/README.md | 5 +++++ config/identity/handler/interaction/handler.json | 2 -- config/identity/registration/disabled.json | 8 ++++++++ config/identity/registration/enabled.json | 15 +++++++++++++++ .../handler}/registration.json | 0 config/memory-subdomains.json | 1 + config/path-routing.json | 1 + .../integration/config/server-dynamic-unsafe.json | 1 + test/integration/config/server-memory.json | 1 + .../config/server-subdomains-unsafe.json | 1 + 14 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 config/identity/registration/disabled.json create mode 100644 config/identity/registration/enabled.json rename config/identity/{handler/interaction/handlers => registration/handler}/registration.json (100%) diff --git a/config/default.json b/config/default.json index cfe4bd369e..6a213cd474 100644 --- a/config/default.json +++ b/config/default.json @@ -11,6 +11,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/token.json", "files-scs:config/identity/pod/static.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/dpop-bearer.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json", diff --git a/config/dynamic.json b/config/dynamic.json index 21dbabb24b..eb1429a157 100644 --- a/config/dynamic.json +++ b/config/dynamic.json @@ -11,6 +11,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/token.json", "files-scs:config/identity/pod/dynamic.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/dpop-bearer.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json", diff --git a/config/example-https-file.json b/config/example-https-file.json index f5e510defa..bb913f216c 100644 --- a/config/example-https-file.json +++ b/config/example-https-file.json @@ -11,6 +11,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/token.json", "files-scs:config/identity/pod/static.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/dpop-bearer.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json", diff --git a/config/file.json b/config/file.json index 262a8fd960..befd58868b 100644 --- a/config/file.json +++ b/config/file.json @@ -11,6 +11,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/token.json", "files-scs:config/identity/pod/static.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/dpop-bearer.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json", diff --git a/config/identity/README.md b/config/identity/README.md index 12ff67e968..80fd6d1872 100644 --- a/config/identity/README.md +++ b/config/identity/README.md @@ -23,3 +23,8 @@ What to use for pod creation. * *dynamic*: Every created pod has its own Components.js config for its ResourceStore, which can differ from the others. * *static*: All pod data is stored in separate containers in the same ResourceStore. + +## Registration +If users should be able to register on the server. +* *enabled*: Enables registration. +* *disabled*: Disables registration. diff --git a/config/identity/handler/interaction/handler.json b/config/identity/handler/interaction/handler.json index 94e2b95535..02de864c8e 100644 --- a/config/identity/handler/interaction/handler.json +++ b/config/identity/handler/interaction/handler.json @@ -4,7 +4,6 @@ "files-scs:config/identity/handler/interaction/handlers/forgot-password.json", "files-scs:config/identity/handler/interaction/handlers/initial.json", "files-scs:config/identity/handler/interaction/handlers/login.json", - "files-scs:config/identity/handler/interaction/handlers/registration.json", "files-scs:config/identity/handler/interaction/handlers/reset-password.json", "files-scs:config/identity/handler/interaction/handlers/session.json" ], @@ -15,7 +14,6 @@ "@type": "WaterfallHandler", "handlers": [ { "@id": "urn:solid-server:auth:password:InitialInteractionHandler" }, - { "@id": "urn:solid-server:auth:password:RegistrationInteractionHandler" }, { "@id": "urn:solid-server:auth:password:LoginInteractionHandler" }, { "@id": "urn:solid-server:auth:password:SessionInteractionHandler" }, { "@id": "urn:solid-server:auth:password:ForgotPasswordInteractionHandler" }, diff --git a/config/identity/registration/disabled.json b/config/identity/registration/disabled.json new file mode 100644 index 0000000000..e4627517a2 --- /dev/null +++ b/config/identity/registration/disabled.json @@ -0,0 +1,8 @@ +{ + "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^1.0.0/components/context.jsonld", + "@graph": [ + { + "comment": "Disable registration by not attaching a registration handler." + } + ] +} diff --git a/config/identity/registration/enabled.json b/config/identity/registration/enabled.json new file mode 100644 index 0000000000..8c5194b3c7 --- /dev/null +++ b/config/identity/registration/enabled.json @@ -0,0 +1,15 @@ +{ + "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^1.0.0/components/context.jsonld", + "import": [ + "files-scs:config/identity/registration/handler/registration.json" + ], + "@graph": [ + { + "comment": "Enable registration by adding a registration handler to the list of interaction handlers.", + "@id": "urn:solid-server:auth:password:InteractionHttpHandler", + "WaterfallHandler:_handlers": [ + { "@id": "urn:solid-server:auth:password:RegistrationInteractionHandler" } + ] + } + ] +} diff --git a/config/identity/handler/interaction/handlers/registration.json b/config/identity/registration/handler/registration.json similarity index 100% rename from config/identity/handler/interaction/handlers/registration.json rename to config/identity/registration/handler/registration.json diff --git a/config/memory-subdomains.json b/config/memory-subdomains.json index 0b167817a1..2a495e03d3 100644 --- a/config/memory-subdomains.json +++ b/config/memory-subdomains.json @@ -11,6 +11,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/token.json", "files-scs:config/identity/pod/static.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/dpop-bearer.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json", diff --git a/config/path-routing.json b/config/path-routing.json index 231a5647fe..67e3df9175 100644 --- a/config/path-routing.json +++ b/config/path-routing.json @@ -11,6 +11,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/token.json", "files-scs:config/identity/pod/static.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/dpop-bearer.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json", diff --git a/test/integration/config/server-dynamic-unsafe.json b/test/integration/config/server-dynamic-unsafe.json index 2d50642261..0e5cdef138 100644 --- a/test/integration/config/server-dynamic-unsafe.json +++ b/test/integration/config/server-dynamic-unsafe.json @@ -11,6 +11,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/unsafe-no-check.json", "files-scs:config/identity/pod/dynamic.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/debug-auth-header.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json", diff --git a/test/integration/config/server-memory.json b/test/integration/config/server-memory.json index 4bc3bf1f64..122c004c6c 100644 --- a/test/integration/config/server-memory.json +++ b/test/integration/config/server-memory.json @@ -10,6 +10,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/token.json", "files-scs:config/identity/pod/static.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/dpop-bearer.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json", diff --git a/test/integration/config/server-subdomains-unsafe.json b/test/integration/config/server-subdomains-unsafe.json index 0c972c83e4..741180e259 100644 --- a/test/integration/config/server-subdomains-unsafe.json +++ b/test/integration/config/server-subdomains-unsafe.json @@ -11,6 +11,7 @@ "files-scs:config/identity/handler/default.json", "files-scs:config/identity/ownership/unsafe-no-check.json", "files-scs:config/identity/pod/static.json", + "files-scs:config/identity/registration/enabled.json", "files-scs:config/ldp/authentication/debug-auth-header.json", "files-scs:config/ldp/authorization/webacl.json", "files-scs:config/ldp/handler/default.json",