Skip to content

Commit

Permalink
chore: process all changes for demo (#39)
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Termont <[email protected]>
Co-authored-by: woutslabbinck <[email protected]>
Co-authored-by: Ruben D <[email protected]>
  • Loading branch information
3 people authored Apr 9, 2024
1 parent 0c0bbf6 commit c502489
Show file tree
Hide file tree
Showing 143 changed files with 22,262 additions and 619 deletions.
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ npm-debug.log*
.yarn/build-state.yml
.yarn/install-state.gz
.yarn-integrity
.pnp/
.pnp.*
.pnpm-debug.log*
yarn-debug.log*
Expand All @@ -44,7 +45,10 @@ componentsjs-error-state.json

# Logs
logs
*.log
*.log*

# Build data
build/

# Runtime data
pids
Expand All @@ -56,3 +60,10 @@ pids
.env
.env.local
.env.*.local

# Temporary folders & files
tmp
*.tmp

# Misc
.DS_Store
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ You can then execute the following flows:
`yarn script:flow` runs all flows in sequence.


## Demonstration

A more extensive example of a real life use case has been implemented as described in [./demo/README.md](./demo/README.md).


## Implemented features

The packages in this project currently only support a fixed UMA AS per CSS RS, and contain only the trivial [AllAuthorizer](packages/uma/src/models/AllAuthorizer.ts) that allows all access. More useful features are coming soon ...
Expand Down
36 changes: 36 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

# Demonstration

Using the UMA server implemented in this repository, we set up an extensive demonstration of a real life use case: age verification for online shops selling age-restricted goods, such as alcoholic beverages.

To experiment with the demo, first build the necessary extra code with `build:demo`, then start the demo by running `start:demo`. This starts the CSS and UMA servers with the right configurations, and spins up two websites: an online shop on `http://localhost:5001`, and a policy manager on `http://localhost:5002`.

The context "story" of the demonstration is the following. This "story" can be either run through via the graphical interfaces of the websites, or by running the script `yarn script:demo`.

- Ruben V., a.k.a. `<http://localhost:3000/ruben/profile/card#me>`, has some private data in `<http://localhost:3000/ruben/private/data>`. Of course, he does not want everyone to be able to see all of his private data when they need just one aspect of it. Therefore, Ruben has installed two **Views** on his data, based on SPARQL filters from a public **Catalog**. (When and how this is done is out-of-scope for now.)

- Discovery of views is currently a very crude mechanism based on a public index in the WebID document. (A cleaner mechanism using the UMA server as central hub is underway.) Using this discovery mechanism, we can find the following views on Ruben's private data:

1. `<http://localhost:3000/ruben/private/derived/bday>` filters out his birth date, according to the `<http://localhost:3000/catalog/public/filters/bday>` filter;
2. `<http://localhost:3000/ruben/private/derived/age>` derives his age, according to the `<http://localhost:3000/catalog/public/filters/age>` filter.

- Access to Ruben's data is based on policies, which he manages through his Authz Companion app, and which are stored in `<http://localhost:3000/ruben/settings/policies/>`. (This is, of course, not publicly known.) To request access to Ruben's data, an agent will need to negotiate with Ruben's UMA Authorization Server, which his WebID document identifies as `<http://localhost:4000/>`. Via the Well-Known endpoint `<http://localhost:4000/.well-known/uma2-configuration>`, we can discover the Token Endpoint `<http://localhost:4000/token>`.

- Having discovered both the location of the UMA server and of the desired data, an agent can request the former for access to the latter. We get different results depending on the situation:

- Without a policy allowing the access, the access is denied.

However, the UMA server enables multiple flows in which such a policy can be added, for example by notifying the resource owner. (This is out-of-scope for this demo.) Having been notified in some way of the access request, Ruben could go to his Authz Companion app, and add a policy allowing the requested access.`

- If a policy has been set (and perhaps the agent has been notified in some way to retry the access request), the UMA server will request the following claims from the agent, based on that policy: `http://www.w3.org/ns/odrl/2/purpose` and `urn:solidlab:uma:claims:types:webid`.

- When the agent has gathered the necessary claims (the manner in which is out-of-scope for this demo), it can send them to the UMA server as a JWT:

```
{
"http://www.w3.org/ns/odrl/2/purpose": "urn:solidlab:uma:claims:purpose:age-verification",
"urn:solidlab:uma:claims:types:webid": "http://localhost:3000/demo/public/vendor"
}
```
- Only when a policy is in place and the agent provides the UMA server with the relevant claims, an access token is produced, with which the agent can access the desired data at the Resource Server.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/data/c5b28411-2340-4820-8f4f-62c209c20172","payload":{"linkedLoginsCount":1,"id":"c5b28411-2340-4820-8f4f-62c209c20172","authzServer":"http://localhost:4000/uma","**password**":{"934434d8-d44e-49c2-9618-694594059554":{"accountId":"c5b28411-2340-4820-8f4f-62c209c20172","email":"[email protected]","password":"$2a$10$8El17QwKSx3XaHjm.puBiOiNdNQv5t6JHPOVSvPnl8meQFE63CWo6","verified":true,"id":"934434d8-d44e-49c2-9618-694594059554"}},"**clientCredentials**":{},"**pod**":{"f1d42d48-8b96-4122-9e5d-f5803863a243":{"baseUrl":"http://localhost:3000/catalog/","accountId":"c5b28411-2340-4820-8f4f-62c209c20172","id":"f1d42d48-8b96-4122-9e5d-f5803863a243","**owner**":{"6bf4fe03-20c1-419d-9934-2b7533296edf":{"podId":"f1d42d48-8b96-4122-9e5d-f5803863a243","webId":"http://localhost:3000/catalog/profile/card#me","visible":false,"id":"6bf4fe03-20c1-419d-9934-2b7533296edf"}}}},"**webIdLink**":{"0c9522ea-b362-4991-bc72-fd1516834770":{"webId":"http://localhost:3000/catalog/profile/card#me","accountId":"c5b28411-2340-4820-8f4f-62c209c20172","id":"0c9522ea-b362-4991-bc72-fd1516834770"}}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/data/d3156f11-ffb2-42f3-b928-b9752a9873ce","payload":{"linkedLoginsCount":1,"id":"d3156f11-ffb2-42f3-b928-b9752a9873ce","authzServer":"http://localhost:4000/uma","**password**":{"084fd63e-faf3-4169-a917-0cdeb768710d":{"accountId":"d3156f11-ffb2-42f3-b928-b9752a9873ce","email":"[email protected]","password":"$2a$10$CRQGngKyURJztvqyDIdXfOuZMiE43z1kuV7BDwAJCmi/gL4TCcPJ2","verified":true,"id":"084fd63e-faf3-4169-a917-0cdeb768710d"}},"**clientCredentials**":{},"**pod**":{"eb3898e1-d409-41d7-b928-f11a2116f218":{"baseUrl":"http://localhost:3000/demo/","accountId":"d3156f11-ffb2-42f3-b928-b9752a9873ce","id":"eb3898e1-d409-41d7-b928-f11a2116f218","**owner**":{"63f475ea-e87c-472c-a224-1b918a9ae059":{"podId":"eb3898e1-d409-41d7-b928-f11a2116f218","webId":"http://localhost:3000/demo/profile/card#me","visible":false,"id":"63f475ea-e87c-472c-a224-1b918a9ae059"}}}},"**webIdLink**":{"ccd6dcae-8e4c-4e43-9888-cc3bdf49acbd":{"webId":"http://localhost:3000/demo/profile/card#me","accountId":"d3156f11-ffb2-42f3-b928-b9752a9873ce","id":"ccd6dcae-8e4c-4e43-9888-cc3bdf49acbd"}}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/data/f644f883-ef0f-4986-b5ff-df6866707cf6","payload":{"linkedLoginsCount":1,"id":"f644f883-ef0f-4986-b5ff-df6866707cf6","authzServer":"http://localhost:4000/uma","**password**":{"126fe0d0-8189-4a51-954a-79e09ff88e18":{"accountId":"f644f883-ef0f-4986-b5ff-df6866707cf6","email":"[email protected]","password":"$2a$10$76sVaHi0nDwl46jKtXZR1uxwwIg8hp6gcfzgT7GCzEdKaOVZSnd1e","verified":true,"id":"126fe0d0-8189-4a51-954a-79e09ff88e18"}},"**clientCredentials**":{},"**pod**":{"b79c41e7-a00d-421d-9b57-009c99e7b0d5":{"baseUrl":"http://localhost:3000/ruben/","accountId":"f644f883-ef0f-4986-b5ff-df6866707cf6","id":"b79c41e7-a00d-421d-9b57-009c99e7b0d5","**owner**":{"173cb7a2-2b22-4b25-b4fb-6f61e0adbd35":{"podId":"b79c41e7-a00d-421d-9b57-009c99e7b0d5","webId":"http://localhost:3000/ruben/profile/card#me","visible":false,"id":"173cb7a2-2b22-4b25-b4fb-6f61e0adbd35"}}}},"**webIdLink**":{"fd6d91cf-4b8c-4769-962f-d9f667ee6ee9":{"webId":"http://localhost:3000/ruben/profile/card#me","accountId":"f644f883-ef0f-4986-b5ff-df6866707cf6","id":"fd6d91cf-4b8c-4769-962f-d9f667ee6ee9"}}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/owner/173cb7a2-2b22-4b25-b4fb-6f61e0adbd35","payload":["f644f883-ef0f-4986-b5ff-df6866707cf6"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/owner/63f475ea-e87c-472c-a224-1b918a9ae059","payload":["d3156f11-ffb2-42f3-b928-b9752a9873ce"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/owner/6bf4fe03-20c1-419d-9934-2b7533296edf","payload":["c5b28411-2340-4820-8f4f-62c209c20172"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/password/084fd63e-faf3-4169-a917-0cdeb768710d","payload":["d3156f11-ffb2-42f3-b928-b9752a9873ce"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/password/126fe0d0-8189-4a51-954a-79e09ff88e18","payload":["f644f883-ef0f-4986-b5ff-df6866707cf6"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/password/934434d8-d44e-49c2-9618-694594059554","payload":["c5b28411-2340-4820-8f4f-62c209c20172"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/password/email/catalog%40example.org","payload":["c5b28411-2340-4820-8f4f-62c209c20172"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/password/email/demo%40example.org","payload":["d3156f11-ffb2-42f3-b928-b9752a9873ce"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/password/email/ruben%40example.org","payload":["f644f883-ef0f-4986-b5ff-df6866707cf6"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/pod/b79c41e7-a00d-421d-9b57-009c99e7b0d5","payload":["f644f883-ef0f-4986-b5ff-df6866707cf6"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/pod/baseUrl/http%3A%2F%2Flocalhost%3A3000%2Fcatalog%2F","payload":["c5b28411-2340-4820-8f4f-62c209c20172"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/pod/baseUrl/http%3A%2F%2Flocalhost%3A3000%2Fdemo%2F","payload":["d3156f11-ffb2-42f3-b928-b9752a9873ce"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/pod/baseUrl/http%3A%2F%2Flocalhost%3A3000%2Fruben%2F","payload":["f644f883-ef0f-4986-b5ff-df6866707cf6"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/pod/eb3898e1-d409-41d7-b928-f11a2116f218","payload":["d3156f11-ffb2-42f3-b928-b9752a9873ce"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/pod/f1d42d48-8b96-4122-9e5d-f5803863a243","payload":["c5b28411-2340-4820-8f4f-62c209c20172"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/webIdLink/0c9522ea-b362-4991-bc72-fd1516834770","payload":["c5b28411-2340-4820-8f4f-62c209c20172"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/webIdLink/ccd6dcae-8e4c-4e43-9888-cc3bdf49acbd","payload":["d3156f11-ffb2-42f3-b928-b9752a9873ce"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/webIdLink/fd6d91cf-4b8c-4769-962f-d9f667ee6ee9","payload":["f644f883-ef0f-4986-b5ff-df6866707cf6"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/webIdLink/webId/http%3A%2F%2Flocalhost%3A3000%2Fcatalog%2Fprofile%2Fcard%23me","payload":["c5b28411-2340-4820-8f4f-62c209c20172"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/webIdLink/webId/http%3A%2F%2Flocalhost%3A3000%2Fdemo%2Fprofile%2Fcard%23me","payload":["d3156f11-ffb2-42f3-b928-b9752a9873ce"]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"accounts/index/webIdLink/webId/http%3A%2F%2Flocalhost%3A3000%2Fruben%2Fprofile%2Fcard%23me","payload":["f644f883-ef0f-4986-b5ff-df6866707cf6"]}
1 change: 1 addition & 0 deletions demo/data/.internal/idp/keys/jwks$.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"idp/keys/jwks","payload":{"keys":[{"kty":"EC","x":"jmoT4I178SCHrtwUu2bFWG0my0o5zQkPhZyDPEyLE6g","y":"nDlReyfF7eyba7XmHXWTs_4Tlzs4ZL94WPaJii7gE90","crv":"P-256","d":"EdprrF79V4LHd5XkO8MHeFyYcXFAgZ_aXmFcuR6lNeU","alg":"ES256"}]}}
1 change: 1 addition & 0 deletions demo/data/.internal/setup/current-base-url$.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"setup/current-base-url","payload":"http://localhost:3000/"}
1 change: 1 addition & 0 deletions demo/data/.internal/setup/current-server-version$.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"setup/current-server-version","payload":"7.0.2"}
1 change: 1 addition & 0 deletions demo/data/.internal/setup/rootInitialized$.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"setup/rootInitialized","payload":true}
1 change: 1 addition & 0 deletions demo/data/.internal/setup/v6-migration$.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"key":"setup/v6-migration","payload":true}
1 change: 1 addition & 0 deletions demo/data/.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://localhost:3000/> a <http://www.w3.org/ns/pim/space#Storage>.
1 change: 1 addition & 0 deletions demo/data/catalog/.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://localhost:3000/catalog/> a <http://www.w3.org/ns/pim/space#Storage>.
97 changes: 97 additions & 0 deletions demo/data/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Community Solid Server</title>
<link rel="stylesheet" href="./.well-known/css/styles/main.css" type="text/css">
</head>
<body>
<header>
<a href=".."><img src="./.well-known/css/images/solid.svg" alt="[Solid logo]" /></a>
<h1>Community Solid Server</h1>
</header>
<main>
<h1>Welcome to Solid</h1>
<p>
This server implements
the <a href="https://solid.github.io/specification/protocol">Solid protocol</a>
so you can create your own <a href="https://solidproject.org/about">Solid Pod</a>
and identity.
</p>

<h2 id="users">Getting started as a <em>user</em></h2>
<p>
<a id="registration-link" href="./.account/login/password/register/">Sign up for an account</a>
to get started with your own Pod and WebID.
</p>
<p>
The default configuration stores data only in memory.
If you want to keep data permanently,
choose a configuration that saves data to disk instead.
</p>
<p>
To learn more about how this server can be used,
have a look at the
<a href="https://github.com/CommunitySolidServer/tutorials/blob/main/getting-started.md">getting started tutorial</a>.
</p>

<h2 id="developers">Getting started as a <em>developer</em></h2>
<p>
The default configuration includes
the <strong>ready-to-use root Pod</strong> you're currently looking at.
<br>
You can use any of the configurations in the <code>config</code> folder of the server
to set up an instance of this server with different features.
Besides the provided configurations,
you can also fine-tune your own custom configuration using the
<a href="https://communitysolidserver.github.io/configuration-generator/">configuration generator</a>.
</p>
<p>
You can easily choose any folder on your disk
to expose as the root Pod with file-based configurations.
<br>
Use the <code>--help</code> switch to learn more.
</p>
<p>
Due to certain restrictions in the Solid specification it is usually not allowed
to both allow data to be written to the root of the server,
and to enable the creation of new pods.
This configuration does allow both these options to allow a quick exploration of Solid,
but other configurations provided will only allow one of those two to be enabled.
</p>

<h2>Have a wonderful Solid experience</h2>
<p>
<strong>Learn more about Solid
at <a href="https://solidproject.org/">solidproject.org</a>.</strong>
</p>
<p>
You are warmly invited
to <a href="https://github.com/CommunitySolidServer/CommunitySolidServer/discussions">share your experiences</a>
and to <a href="https://github.com/CommunitySolidServer/CommunitySolidServer/issues">report any bugs</a> you encounter.
</p>
</main>
<footer>
<p>
©2019–2023 <a href="https://inrupt.com/">Inrupt Inc.</a>
and <a href="https://www.imec-int.com/">imec</a>
</p>
</footer>
</body>

<script>
(async() => {
// Since this page is in the root of the server, we can determine other URLs relative to the current URL
const res = await fetch('.account/');
const registrationUrl = (await res.json())?.controls?.html?.password?.register;
// We specifically want to check if the HTML page that we link to exists
const resRegistrationPage = await fetch(registrationUrl, { headers: { accept: 'text/html' } });
const registrationEnabled = registrationUrl && resRegistrationPage.status === 200;

document.getElementById('registration-enabled').classList[registrationEnabled ? 'remove' : 'add']('hidden');
document.getElementById('registration-disabled').classList[registrationEnabled ? 'add' : 'remove']('hidden');
document.getElementById('registration-link').href = registrationUrl;
})();
</script>
</html>
1 change: 1 addition & 0 deletions demo/data/ruben/.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<http://localhost:3000/ruben/> a <http://www.w3.org/ns/pim/space#Storage>.
13 changes: 13 additions & 0 deletions demo/data/ruben/private/.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@prefix derived: <urn:npm:solid:derived-resources:> .

<> derived:derivedResource [
derived:template "derived/bday";
derived:selector <./data>;
derived:filter <http://localhost:3000/catalog/public/filters/bday>
].

<> derived:derivedResource [
derived:template "derived/age";
derived:selector <./data>;
derived:filter <http://localhost:3000/catalog/public/filters/age>
].
14 changes: 14 additions & 0 deletions demo/data/ruben/private/data$.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@prefix ruben: <https://ruben.verborgh.org/profile/#me>.
@prefix con: <http://www.w3.org/2000/10/swap/pim/contact#>.
@prefix dbo: <http://dbpedia.org/ontology/>.
@prefix dbp: <http://dbpedia.org/resource/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.

ruben: a foaf:Person;
con:preferredURI "https://ruben.verborgh.org/profile/#me";
foaf:familyName "Verborgh"@en, "Verborgh"@nl ;
foaf:givenName "Ruben"@en, "Ruben"@nl ;
dbo:birthDate "1987-02-28"^^xsd:date ;
dbo:birthPlace dbp:Ostend ;
foaf:gender "male"@en .
27 changes: 27 additions & 0 deletions demo/data/ruben/profile/card$.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix solid: <http://www.w3.org/ns/solid/terms#>.
@prefix filters: <http://localhost:3000/catalog/public/filters/> .
@prefix views: <http://localhost:3000/ruben/private/derived/> .
@prefix ruben: <http://localhost:3000/ruben/profile/card#me> .

<> a foaf:PersonalProfileDocument;
foaf:maker ruben:;
foaf:primaryTopic ruben:.

ruben: a foaf:Person ;
foaf:name "Ruben Verborgh"@en, "Ruben Verborgh"@nl;
rdfs:label "Ruben Verborgh"@en, "Ruben Verborgh"@nl;
solid:umaServer "http://localhost:4000/uma/" ;
solid:oidcIssuer <http://localhost:3000/> ;
solid:viewIndex <#index> .

<#index> a solid:ViewIndex ;
solid:entry [
solid:filter filters:bday ;
solid:location views:bday
] ;
solid:entry [
solid:filter filters:age ;
solid:location views:age
] .
Empty file.
Loading

0 comments on commit c502489

Please sign in to comment.