Skip to content

Commit 9347cb2

Browse files
committed
Update text
1 parent a2ee722 commit 9347cb2

File tree

1 file changed

+99
-11
lines changed

1 file changed

+99
-11
lines changed

README.md

Lines changed: 99 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -576,60 +576,148 @@ curl -L 'localhost:3000/vc/verify' \
576576
```
577577

578578

579-
### Verifying a Verifiable Credential
579+
### Using a Verifiable Credentials within a Data Space
580+
581+
Now that Alice has been given a Verifiable credential, she can use it to claim the role of Operator within the Data Space and gain Access to the Vetenary Records. A First attempt to access the records without holding a token results in an error, indicating that the verifier is present on port `1030`
580582

581-
#### ### Verifying a Verifiable Credential
583+
#### Accessing the Vetenary Records without a Veriable Credential
582584

583585
#### 5️⃣ Request:
584586

585587
```console
586-
588+
curl -L 'localhost:1030/ngsi-ld/v1/entities?local=true' \
589+
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
587590
```
588591

589592
#### Response:
590-
Request:
591593

592-
```console
594+
The response is a **401 - Unauthorized** error code with the following response
593595

596+
```json
597+
{
598+
"type": "urn:dx:as:MissingAuthenticationToken",
599+
"title": "Unauthorized",
600+
"detail": "message"
601+
}
594602
```
595603

596-
#### Response:
597604

605+
### Accessing the Vetenary Records with an invalid Veriable Credential
598606

599-
### Verifying a Verifiable Credential
607+
The Verifiable Credential is added as a Bearer token to the Authorization header. The bearer token is a JWT which is then decoded and verified - if the content of the Bearer token does not match the claimed issuer, then the token is rejected.
600608

601609
#### 6️⃣ Request:
602610

603611
```console
612+
curl -L 'localhost:1030/ngsi-ld/v1/entities?local=true' \
613+
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
614+
-H 'Authorization: Bearer eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ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JbTVpWmlJNmJuVnNiQ3dpYVhOeklqb2laR2xrT25kbFlqcG1hWGRoY21VdVoybDBhSFZpTG1sdk9uUjFkRzl5YVdGc2N5NVRkR1Z3TFdKNUxWTjBaWEE2WjI5MkluMC5peUxJaG5Bd3ZzbU90QnVXd3Jid0FSRXVPY0plblZYeUNVQ1dlNk1qakl6NDJqNi1XcVhseE05bk1xV25QeXQwVG92MGFSeTBqSG5KVUFPRVU0TjlaUSJdfSwiaXNzIjoiZGlkOndlYjpmaXdhcmUuZ2l0aHViLmlvOnR1dG9yaWFscy5TdGVwLWJ5LVN0ZXA6Z292In0.PTHHUoGjAT9n_DQukoxYCVZ0o9yjZJGiTBWQ3kI9QxdO1D-TkbBdBRfhzo4-ezRnW4BFpKkse1fsdb_FymtgCw' \
615+
-H 'Cookie: connect.sid=s%3AfQyNTuX_bUcm7dPusUIRHehr0myIcchy.DvjkMq2W94uKRAIAtCjrz5ZCB52ulI8jB2rMbiWnvwc'
616+
604617

605618
```
606619

607620
#### Response:
608621

622+
```json
623+
{
624+
"type": "urn:dx:as:InvalidAuthenticationToken",
625+
"title": "Unauthorized",
626+
"detail": "invalid_signature: no matching public key found"
627+
}
628+
```
629+
630+
In the case of a rejected credentila The response is a **401 - Unauthorized** error code with the following response.
609631

610-
### Verifying a Verifiable Credential
632+
Note that a real Credential Verifier would not only check that all the claimed issuers of credentials had really signed each verifiable credential, but also ensure that the `exp` and `nbf` are also in range.
633+
634+
### Accessing the Vetenary Records with a valid Veriable Credential
635+
636+
With a proper Verifiable Presentation, the **Animal** records can be accessed:
611637

612638
#### 7️⃣ Request:
613639

614640
```console
641+
curl -L 'localhost:1030/ngsi-ld/v1/entities?local=true' \
642+
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
643+
-H 'Authorization: Bearer eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3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1aGciXX0sImlzcyI6ImRpZDp3ZWI6Zml3YXJlLmdpdGh1Yi5pbzp0dXRvcmlhbHMuU3RlcC1ieS1TdGVwOmFsaWNlIn0.6_wuCNurZV5zawDKsPfJEEqWcmTpoTMG7r58HxAKJUkQB2bkRza2C7UoWOFu7DgHqDx9moSrQqrQ0n1Yp9JDDA'
615644

616645
```
617646

618647
#### Response:
619648

649+
```json
650+
[
651+
{
652+
"id": "urn:ngsi-ld:Animal:cow006",
653+
"type": "Animal",
654+
"fedWith": { "type": "Property", "value": "Oats"},
655+
"species": { "type": "Property", "value": "dairy cattle"},
656+
"name": { "type": "Property", "value": "Twilight"},
657+
"sex": { "type": "VocabProperty", "vocab": "Female"},
658+
"phenologicalCondition": { "type": "VocabProperty", "vocab": "femaleAdult"},
659+
"healthCondition": {
660+
"type": "VocabProperty",
661+
"vocab": "healthy",
662+
"observedAt": "2024-02-02T15:00:00.000Z"
663+
},
664+
"reproductiveCondition": {
665+
"type": "VocabProperty",
666+
"vocab": "noStatus",
667+
"observedAt": "2024-02-02T15:00:00.000Z"
668+
}
669+
},
670+
... etc
671+
]
672+
```
673+
674+
The response contains a series of **Animal** records, however checking the output within the
675+
[Verifiable Presentation Monitor](http://localhost:3000/vp/monitor) at `http://localhost:3000/vp/monitor`, you will find the
676+
following output:
620677

621-
### Verifying a Verifiable Credential
678+
```
679+
OperatorCredential issued by did:web:fiware.github.io:tutorials.Step-by-Step:animal-welfare was NOT TRUSTED
680+
```
681+
682+
This is because a further check is required. Not only must the Verifiable Credential be signed by the issuer, but the issuer must be a valid issuer of credentials within the data space. The way that a verifier checks this, is that it must contact a trusted issuers list. The location of this list is defined within the configuration service associated to the Verifiable Credentials verifier.
683+
684+
### Checking for trusted issuers
685+
686+
The configuration service is running on port 8081, a listing of valid issuers for the vet can be found by making a service request.
622687

623688
#### 8️⃣ Request:
624689

625690
```console
626-
691+
curl -L 'localhost:8081/service/vet'
627692
```
628693

629694
#### Response:
630695

696+
```json
697+
{
698+
"id": "vet",
699+
"defaultOidcScope": "default",
700+
"oidcScopes": {
701+
"default": [
702+
{
703+
"type": "VerifiableCredential",
704+
"trustedParticipantsLists": [],
705+
"trustedIssuersLists": [
706+
"http://trusted-issuers-list:8080"
707+
],
708+
"holderVerification": {
709+
"enabled": false,
710+
"claim": "subject"
711+
}
712+
}
713+
]
714+
}
715+
}
716+
```
717+
718+
The response indicates that VerifiableCredentials can be checked against the trusted issuers list found at `http://trusted-issuers-list:8080`
631719

632-
### Verifying a Verifiable Credential
720+
### Reading a trusted issuers list
633721

634722
#### 9️⃣ Request:
635723

0 commit comments

Comments
 (0)