-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
12 changed files
with
706 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 17 additions & 14 deletions
31
packages/solid-crs-pods/config/identity/registration/enabled.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" } | ||
] | ||
} | ||
] | ||
} |
67 changes: 35 additions & 32 deletions
67
packages/solid-crs-pods/config/identity/registration/route/registration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" } | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
31 changes: 31 additions & 0 deletions
31
packages/solid-crs-pods/lib/NoCredentialRegistrationHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<InteractionResponseResult<RegistrationResponse>> { | ||
|
||
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 }; | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.