Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e setup (Vienna 2.0) #41

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
860f8aa
feat: demo with file backend instead of templates
termontwouter Mar 12, 2024
3e91364
feat: clean up demo css config
termontwouter Mar 12, 2024
87c967e
feat: setup componentsjs build for UCP package
termontwouter Mar 12, 2024
89a19c3
feat: make rulestorage configurable
termontwouter Mar 12, 2024
add12cd
chore: restructure startup and demo scripts
termontwouter Mar 13, 2024
da9ad0d
chore: some remaining demo setup
termontwouter Mar 13, 2024
b444753
feat: ucp changes for demo (#37)
termontwouter Mar 13, 2024
ba3defa
feat: made N3 ruleset configurable
termontwouter Mar 13, 2024
246cf53
chore: cleanup & align n3 rules a bit
termontwouter Mar 13, 2024
bc4528d
chore: debugging & cleaunup
termontwouter Mar 14, 2024
6e9fd94
fix: last fixes to flow
termontwouter Mar 15, 2024
61d1ff7
docs: reasoning problem
termontwouter Mar 15, 2024
fdee9c4
feat: maxe policies container if it does not exist yet
woutslabbinck Mar 15, 2024
93412a3
docs: add instructions to run demo
woutslabbinck Mar 15, 2024
cfc36df
feat: check purpose constraints in negotiation (#38)
termontwouter Mar 25, 2024
e524c16
Added empty .meta file to make sure directory is picked up by github
Dexagod Mar 26, 2024
2acab7b
fix: cors
termontwouter Mar 26, 2024
1592ae0
Feat: finished demo store page
Dexagod Mar 26, 2024
ea3b54c
Merge branch 'demo/setup' of github.com:SolidLabResearch/user-managed…
Dexagod Mar 26, 2024
9d541ae
Authorization companion app
Dexagod Mar 27, 2024
b030dc6
feat: enabled selection and display of policy content
Dexagod Mar 27, 2024
13ab2eb
Feat: form-based policy creation
Dexagod Mar 27, 2024
c8e73ab
Feat: added search bar functionality to store and better error messaging
Dexagod Mar 28, 2024
5b6e954
chore: demo sites cleanup
termontwouter Mar 30, 2024
79ab69a
chore: comment out forgotten degug log
termontwouter Mar 31, 2024
25dbf94
Cleanup: removed unused files
Dexagod Apr 2, 2024
7275b26
docs: Add requirements to README
Dexagod Apr 3, 2024
d6594f8
feat: Add log route. Something wrong with config
Dexagod Apr 3, 2024
f54817a
feat: added example OperationLogger component
Dexagod Apr 3, 2024
aaaa9d0
docs: added requirements list
Dexagod Apr 4, 2024
ab2b691
docs: updated requirements
Dexagod Apr 4, 2024
39c304a
feat: added routes for contract and vc endpoints
Dexagod Apr 4, 2024
59b6a9f
feat: Added VC stuff from Gertjan. We can probably remove all inrupt …
Dexagod Apr 4, 2024
1550ee1
fix: fixed double function call
Dexagod Apr 8, 2024
2c5fe09
feat: skeleton for instantiation actors
Dexagod Apr 8, 2024
09ae73a
cleanup: removed unused code
Dexagod Apr 8, 2024
16b8144
feat: Added contracts to the flow, embedded in the access token
Dexagod Apr 8, 2024
9e244a8
chore: merge from main
termontwouter Apr 9, 2024
102d247
fix: fixed double token route created by merge
Dexagod Apr 16, 2024
2cc90fd
update: requirements list
Dexagod Apr 16, 2024
3816d91
feat: store backend
Dexagod Apr 17, 2024
ca0010b
feat: cleaner version of store site
Dexagod Apr 17, 2024
f4b59e2
feat: Requirement listing + misc
Dexagod Apr 17, 2024
e32a1ae
feat: government vc issue and verify service
Dexagod Apr 23, 2024
87c67a3
feat: update store backend to integrate verifiable credentials
Dexagod Apr 23, 2024
af4d32a
feat: update websites to integrate verifiable credentials
Dexagod Apr 23, 2024
83f2a1b
feat: general credential updates
Dexagod Apr 23, 2024
3ad81dd
update: requirements
Dexagod Apr 24, 2024
4f4d130
feat: added token verification and updated contract storage in store …
Dexagod Apr 25, 2024
83137ce
feat: verify VCs in store backend using API call to gov issuer
Dexagod Apr 25, 2024
2dfe9ce
feat: Added auditing site
Dexagod Apr 29, 2024
266fe6a
feat: added verification checks to auditing site
Dexagod Apr 29, 2024
c7d9191
Fix: fixed vendor webId
Dexagod Apr 30, 2024
f896074
update: Requirements.md
Dexagod Apr 30, 2024
68295da
update: sites CSS updates
Dexagod Apr 30, 2024
e218b6e
Final touches demo + add pages to pod view
Dexagod May 14, 2024
69a63c1
fix: Re-enabled oidc config to allow for login
Dexagod May 14, 2024
30d0391
Fix: Stabilized enabling OIDC with full happy flow and credential ver…
Dexagod May 14, 2024
9ec0a0c
misc: Added profile picture
Dexagod May 15, 2024
f21522e
Misc: Fixing up last things before screencast
Dexagod May 21, 2024
68f7f7b
Update: brought README up to date
Dexagod May 22, 2024
9a96c76
misc: small changes before screencast
Dexagod May 22, 2024
90ab554
update: Update policy to represent a more generic policy modelling vi…
Dexagod Jun 6, 2024
8313c92
fix: Make sure the demo subfolder is installed as well before executi…
Dexagod Jun 6, 2024
485332d
update: Moved the demonstrator README into the main folder
Dexagod Jun 6, 2024
9de76ed
fix: Update lockfile
Dexagod Jun 6, 2024
8cc4c23
Update: update README.md
Dexagod Jun 6, 2024
793b342
add: screencast
Dexagod Jun 6, 2024
1c73c0d
update: changed screencast from mkv to mp4
Dexagod Jun 10, 2024
4e5fb08
Update: Add clone instructions to README.md
Dexagod Jun 10, 2024
288368c
Update package.json
Dexagod Jun 10, 2024
1990fee
feat: Added docker setup
Dexagod Jun 11, 2024
135fc6b
Merge branch 'e2e/setup' of github.com:SolidLabResearch/user-managed-…
Dexagod Jun 11, 2024
e3ea8ca
Update: update README file with docker info and screencast link
Dexagod Jun 11, 2024
4db4fd3
Fix: change absolute path to relative path
Dexagod Jun 11, 2024
f83fcb8
fix: Added network=host flag to docker build
Dexagod Jun 11, 2024
7ed8691
Misc: Warning to make sure people are on the correct branch
Dexagod Jun 11, 2024
c8fa40e
Fix: Set yarn workspaces jobs to unlimited to prevent deadlock and mo…
Dexagod Jun 13, 2024
f0b9654
Feat: Making docker setup more visible in README
Dexagod Jun 13, 2024
1513401
Misc: remove unnecessary bold text
Dexagod Jun 13, 2024
f2b9b38
Update README.md
Dexagod Jun 13, 2024
29595d2
Fix: update links to new URLs
Dexagod Jun 13, 2024
0fdfe31
Merge branch 'e2e/setup' of github.com:SolidLabResearch/user-managed-…
Dexagod Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ tmp

# Misc
.DS_Store
.vscode/
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:20.0.0
ENV NODE_ENV=production
WORKDIR /usr/src/app
# COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
# RUN npm install -g yarn

COPY . .

ENV YARN_VERSION 4.0.0
RUN yarn policies set-version $YARN_VERSION

RUN corepack enable yarn
RUN yarn install
# COPY . .

RUN yarn build
RUN yarn install:demo
RUN yarn build:demo

EXPOSE 3000
EXPOSE 4000
EXPOSE 4444
EXPOSE 5123
EXPOSE 8201
EXPOSE 8202
EXPOSE 8203

RUN chown -R node /usr/src/app
USER node
CMD ["yarn", "start:demo"]
199 changes: 169 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,179 @@

# SolidLab's User Managed Access

This repository contains SolidLab research artefacts on use of UMA in the Solid ecosystem.
This repository contains a demonstrator for the [SolidLab project](https://solidlab.be/) on managing trust-flows in decentralized data storage systems such as Solid.


## Packages
## Cloning the repository

- [`@solidlab/uma`](packages/uma): Experimental and opinionated implementation of [UMA Grants](https://docs.kantarainitiative.org/uma/wg/rec-oauth-uma-grant-2.0.html) and [UMA Federation](https://docs.kantarainitiative.org/uma/wg/rec-oauth-uma-federated-authz-2.0.html).

- [`@solidlab/uma-css`](packages/css): UMA modules for the [Community Solid Server](https://github.com/CommunitySolidServer/CommunitySolidServer/).

- [`@solidlab/ucp`](packages/ucp): Usage Control Policy decision/enforcement component.
To run the demonstrator, you will have to clone the repository.
```
git clone -b e2e/setup [email protected]:SolidLabResearch/user-managed-access.git

cd user-managed-access/
```

## Getting started

In order to run this project you need to perform the following steps.

1. Ensure that you are using Node.js 20 or higher, e.g. by running `nvm use`. (see [.nvmrc](./.nvmrc))
1. Enable Node.js Corepack with `corepack enable`.
1. Run `yarn install` in the project root (this will automatically call `yarn build:all`).
1. Run `yarn start:all`.

This will boot up a UMA server and compatible Community Solid Server instance.

You can then execute the following flows:

- `yarn script:public`: `GET` the public `/alice/profile/card` without redirection to the UMA server;
- `yarn script:private`: `PUT` some text to the private `/alice/private/resource.txt`, protected by a simple WebID check;
- `yarn script:uma-ucp`: `PUT` some text to the private `/alice/other/resource.txt`, protected by a UCP enforcer checking WebIDs according to policies in `packages/uma/config/rules/policy/`.
- `yarn script:registration`: `POST`, `GET` and `DELETE` some text to/from `/alice/public/resource.txt` to test the correct creation and deletion of resource registrations on the UNA server.
- `yarn script:ucp-enforcement`: Run the UCP enforcer in a script (`scripts/test-ucp-enforcement.ts`). This does not need the servers to be started.
### Setting up the project yourself

`yarn script:flow` runs all flows in sequence.
Before starting, make sure you are on the correct branch (e2e/setup).
See the above command to clone only the relevant branch for the demonstrator.

In order to run the demonstrator you need to perform the following steps.

## Demonstration

A more extensive example of a real life use case has been implemented as described in [./demo/README.md](./demo/README.md).
1. Ensure that you are using Node.js 20 or higher, e.g. by running `nvm use`. (see [.nvmrc](./.nvmrc))
2. Enable Node.js Corepack with `corepack enable`.
3. Run `yarn install` in the project root to install the requirements for the Solid server .
4. Run `yarn build` in the project root to build the Solid server.
5. Run `yarn install:demo` in the project root to install the requirements for the demonstrator sites and services .
6. Run `yarn build:demo` in the project root to build the demonstrator sites and services .
7. Run `yarn start:demo` to start both the Solid server and all demonstrator sites and services.

This will boot up a UMA server and compatible Community Solid Server instance, as well as all sites and services for the demonstrator.


### Using docker
There is also a `docker` setup available, for which you need to have docker installed:
```
docker pull raddecke/solidlab-trust-flows-demo
docker run -p 3000:3000 -p 4000:4000 -p 4444:4444 -p 5123:5123 -p 8201:8201 -p 8202:8202 -p 8203:8203 --net=host raddecke/solidlab-trust-flows-demo:latest
```

This will start up the same services as the above system installation.


## Screencast

A screencast of the demonstrator can be found here: https://pod.rubendedecker.be/scholar/screencasts/trust-flows-demo.mp4
or the video file can be found in the [github repository](https://github.com/SolidLabResearch/user-managed-access/tree/e2e/setup/screencast)



# Demonstrator

## The user data space with CSS and UMA

- Ruben V., a.k.a. `<http://localhost:3000/ruben/profile/card#me>`, has retrieved a credential containing their birth date from a government service at `<http://localhost:4444/credential?webid=http://localhost:3000/ruben/profile/card#me>`, and this credential has been stored at `<http://localhost:3000/ruben/credentials/age-credential>` as a private resource.
- Additionally, an accompanying policy was also retrieved and stored in the policy directory at `<http://localhost:3000/ruben/settings/policies/generic/age-policy>`. This ODRL policy governs the access and usage requirements for the age credential resource.
- This can be checked on the companion app at `<http://localhost:8201/>`.
- Using the login email `[email protected]` with the password `abc123`, the companion app shows an overview of the available credentials (the birth date credential) en policies in the data space (one policy managing read access for the user, and another one providing access to the age credential for the purpose of age-verification).

- 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:5123/id"
}
```

- 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.

## The web store

- The store use-case starts out with the user navigating to a webshop 'The Drinks Center' located at `http://localhost:8202`.
- In here, the user decides to buy a mix of alcoholic and non-alcoholic drinks.
- Before checkout, the user has to first verify their age when alcoholic drinks were added to the cart.
- The list of options here is currently limited to only WebID.
- Upon continuing, we can provide a new WebID, or continue with Ruben's WebID that was stored from some previous interaction. Note that this does not authenticate the user, but only links their WebID to allow the store to negotiate with their system.
- Here, the web store calls their backend service with the WebID value to try and negotiate with the WebID system to find a valid age-credential.

- In the store backend, a negotiation is setup with the UMA authorization server indicated by the WebID at `<http://localhost:4000>`.
- The location of the target resource `<http://localhost:3000/credentials/age-credential>` is assumed to be known as an agreed well known path.
- Having discovered both the location of the UMA server and the target resource, the store agent requests access to the latter.

- As an policy is set for the credential, 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`.
- The store now re-sends the request, passing the following claims 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:5123/id"
}
```
- The UMA server responds on this request by providing an signed JWT containing both an access token that the store agent can use to go retrieve the age credential resource, as well as a usage agreement for what can be done with the data in the following format:
```
{
"permissions": [
{
"resource_id": "http://localhost:3000/ruben/credentials/age-credential",
"resource_scopes": [ "read", "use" ]
}
],
"contract": {
"@context": [
"http://www.w3.org/ns/odrl.jsonld",
{
"prov": "http://www.w3.org/ns/prov#"
}
],
"@type": "Agreement",
"target": "http://localhost:3000/ruben/credentials/age-credential",
"uid": "urn:solidlab:uma:contract:55cfc913-24a3-4134-9895-2fa969a07181",
"assigner": "http://localhost:3000/ruben/profile/card#me",
"assignee": "http://localhost:5123/id",
"permission": [
{
"action": [ "read", "use" ],
"constraint": [
{
"leftOperand": "dateTime",
"operator": "gt",
"rightOperand": "2024-05-22T13:42:45.397Z"
},
{
"leftOperand": "dateTime",
"operator": "lt",
"rightOperand": "2024-05-28T22:00:00.000Z"
},
{
"leftOperand": "purpose",
"operator": "eq",
"rightOperand": "urn:solidlab:uma:claims:purpose:age-verification"
}
]
}
]
}
}
```

- Using the provided token, the store can now retrieve the age credential using this token, after which the age is verified to be over 18, and both the data and contract are stored for auditing purposes. (this storage for auditing purposes is currently not yet negotiated)
- Based on the OK from the back-end, the store allows the user to go forward to the payment screen, where the transaction can be completed.

## The auditing platform
To complete our trust interaction, we now need a way to check how the web store uses our data in their back-end.
Here, the auditing process can make use of the usage agreement that was obtained by the store backend during the negotiation for the age credential resource.

- The auditor navigates to the auditing platform located at `<http://localhost:8203>`
- Here, 'The Drinks Central' is registered as a store audited by the platform.
- The platform retrieves all auditing information from the store from the store backend via `<http://localhost:5123/audit>`.
- For each entry, the auditing platform can automatically verify:
- the signature of the token containing the usage agreement coming from the user data space.
- the signature of the age credential coming form a trusted government instance.
- the provided age in the credential being over 18 years old.
- For each entry, both the retrieved resource and the usage agreement are displayed on the interface.


## Implemented features
The demonstrator contains a demonstration that partially or fully includes the following features.

### The Solid Server
The demonstrator uses the [Community Solid Server](https://github.com/CommunitySolidServer/CommunitySolidServer) to represent a user data storage location and to host the user WebID.

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 ...
### UMA Redirects for Solid

This codebase makes use of a Solid Server that can redirect to an Authorization server based on an adaptation of the [UMA protocol](https://docs.kantarainitiative.org/uma/wg/rec-oauth-uma-grant-2.0.html).

### Usage control policy enforcement

Expand All @@ -57,9 +187,18 @@ For more information, you can check out its [own repository](https://github.com/

A test script is provided for a CRUD ODRL engine: `yarn script:ucp-enforcement`.
In the [script](./scripts/test-ucp-enforcement.ts) a read Usage Control Rule (in ODRL) is present together with N3 interpretation rules.
Then a read request is performed using the engine, which results in a list of grants. This list is then printed to the console.
Then a read request is performed using the engine, which results in a list of grants.
These are then used as the basis of an agreement that is exchanged with the access token, that represents the usage agreement for the data exchange.

### Verifiable Credential issuing and verification

The demonstrator provides a mock government service that can issue a credential (currently manually copied in place), and allows the verification of this credential using their WebID.

### Auditing

The demonstrator presents an auditing platform, that can read and automatically partially verify the grounds of data exchanges happening in the network.

## Next steps

Have a look at the [milestones](https://github.com/SolidLabResearch/user-managed-access/milestones) we set for ourselves, and other [issues](https://github.com/SolidLabResearch/user-managed-access/issues) we would like to solve.
The next step for the demonstrator is going in the direction of [Europe's Digital Identity Wallets](https://ec.europa.eu/digital-building-blocks/sites/display/EUDIGITALIDENTITYWALLET/EU+Digital+Identity+Wallet+Home)
where we will try to demonstrate how decentralized storage such as Solid can form a strong basis for the storage and sharing of digital crendentials.
Loading