Skip to content

Commit

Permalink
fix: disable need for username, password on pods (#547)
Browse files Browse the repository at this point in the history
* 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
lem-onade authored Jan 10, 2022
1 parent 2f0a2ba commit affcaec
Show file tree
Hide file tree
Showing 12 changed files with 706 additions and 54 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,7 @@ dist
coverage-summary.json

# id-proxy assets
assets
assets

# componentsjs error output
componentsjs-error-state.json
1 change: 1 addition & 0 deletions packages/solid-crs-pods/.componentsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
5 changes: 4 additions & 1 deletion packages/solid-crs-pods/config/file.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
31 changes: 17 additions & 14 deletions packages/solid-crs-pods/config/identity/registration/enabled.json
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" }
]
}
]
}
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 packages/solid-crs-pods/lib/NoCredentialRegistrationHandler.ts
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 };

}

}
Loading

0 comments on commit affcaec

Please sign in to comment.