Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

Commit 7523b16

Browse files
author
elf Pavlik
committed
syntax highlighting for code snippets
1 parent 58e7510 commit 7523b16

10 files changed

Lines changed: 144 additions & 125 deletions

UserStories/PrivateSharing.md

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ This story has a privacy aspect so we will use [WebID+TLS authentication](http:/
1616

1717
Ian has WebID `<https://ian.name/card#me>` with a public key.
1818

19-
```
19+
```http
2020
GET /card HTTP/1.1
2121
Host: ian.name:443
2222
Accept: text/turtle, application/ld+json
2323
```
24-
```
24+
```http
2525
HTTP/1.1 200 Ok
2626
Accept-Patch: application/sparql-update
2727
Access-Control-Allow-Origin: *
@@ -33,14 +33,15 @@ Content-Type: text/turtle
3333
Content-Length: 545
3434
Link: <card.acl>; rel=acl
3535
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
36-
36+
```
37+
```ttl
3738
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
3839
@prefix cert: <http://www.w3.org/ns/auth/cert#> .
3940
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
4041
4142
<card> a foaf:PersonalProfileDocument;
4243
foaf:primaryTopic <card#me> .
43-
44+
4445
<card#me> a foaf:Person ;
4546
foaf:name "Ian;
4647
foaf:knows <https://jane.org/profile#me> ;
@@ -53,21 +54,22 @@ Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
5354

5455

5556
In order to be able to do command line curl demos, we will assume that
56-
Ian has saved his certificate and private key in the [`cert.pem`](#ians-ssl-certificate) file locally. (Of course it is not needed to do this in browsers...)
57+
Ian has saved his certificate and private key in the [`cert.pem`](#ians-ssl-certificate) file locally. (Of course it is not needed to do this in browsers...)
5758

5859
The certificate public key is the one in the profile.
5960

6061

61-
### Ian posts the file
62+
### Ian posts the file
6263

6364
Here curl makes the connection, and authenticates Ian with his Certificate. As a result the content is created.
6465

65-
```bash
66+
```sh
6667
$ curl -X POST -k -i -H "Content-Type: text/turtle" \
6768
--cert ../eg/cert.pem:password \
6869
-H "Slug: financials" \
6970
--data-binary @financials.ttl https://ian.name/2014/
70-
71+
```
72+
```http
7173
HTTP/1.1 201 Created
7274
Accept-Patch: application/sparql-update
7375
Access-Control-Allow-Origin: *
@@ -82,13 +84,14 @@ Link: <financials.acl>; rel=acl
8284

8385
So the `<financials>` resource is created in the LDP container `</2014/>` . Let us imagine that the `<financials.acl>` resource indeed limits it currently to only be viewed by the owner Ian.
8486

85-
```
87+
```sh
8688
$ curl -X GET -k -H "Content-Type: text/turtle" \
8789
--cert ../eg/IanCert:password \
8890
https://ian.name/2014/financials.acl
89-
90-
@prefix acl: <http://www.w3.org/ns/auth/acl#> .
91-
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
91+
```
92+
```ttl
93+
@prefix acl: <http://www.w3.org/ns/auth/acl#> .
94+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
9295
9396
[] acl:accessTo </2014/financials>, <>;
9497
acl:mode acl:Read, acl:Write;
@@ -97,17 +100,18 @@ $ curl -X GET -k -H "Content-Type: text/turtle" \
97100

98101
### Allow Access to Jane
99102

100-
To allow access to the resource to Jan, Ian must send the following
103+
To allow access to the resource to Jan, Ian must send the following
101104
PATCH, using his certificate as he is the only one authorised to patch the resource.
102105

103-
```
106+
```http
104107
PATCH /2014/financials.acl HTTP/1.1
105108
Host: ian.name:443
106109
Content-Type: application/sparql-update; utf-8
107110
Content-Length: 120
108-
111+
```
112+
```sparql
109113
Prefix acl: <http://www.w3.org/ns/auth/acl#> .
110-
INSERT DATA {
114+
INSERT DATA {
111115
[] acl:accessTo </2014/financials>;
112116
acl:mode acl:Read;
113117
acl:agent <https://jane.org/profile#me> .
@@ -122,13 +126,14 @@ Ian's software ( server or client - it does not matter ) somehow needs to find o
122126

123127
Given that we have shown the obvious way to query in other examples, we show here out of interest a potential optimisation that would send the query in the body of the GET (see [discussion on http-wg list](https://lists.w3.org/Archives/Public/ietf-http-wg/2015AprJun/0317.html) ). (The query could also be in a `Query` header.)
124128

125-
```
129+
```http
126130
GET /profile HTTP/1.1
127131
Host: jane.org:443
128132
Accept: text/turtle
129133
Content-Type: application/sparql-query; charset=UTF-8
130134
Content-Length: 123
131-
135+
```
136+
```sparql
132137
PREFIX solid: <http://solid.info/notification/ping#>
133138
CONSTRUCT { <#me> as:ping ?where }
134139
WHERE { <#me> as:ping ?where }
@@ -138,22 +143,23 @@ If the server does not understand the query, it just returns the full document b
138143

139144
The response may then in the best of case just be one short line:
140145

141-
```Turtle
146+
```ttl
142147
@prefix solid: <http://solid.info/notification/ping#> .
143148
<#me> as:ping </pingInbox/> .
144149
```
145150

146-
### Send a notice
151+
### Send a notice
147152

148-
To send a notice the agent could send an activity stream event to the
153+
To send a notice the agent could send an activity stream event to the
149154
`<https://jane.org/pingInbox/>` ldp:BasicContainer .
150155

151-
```
156+
```http
152157
POST /pingInbox/ HTTP/1.1
153158
Host: jane.org:443
154159
Content-Type: text/turtle
155160
Content-Length: 145
156-
161+
```
162+
```ttl
157163
@prefix as: <http://www.w3.org/ns/activitystreams#> .
158164
[] as:Post ;
159165
as:published "2015-02-10T15:04:55Z"^^xsd:dateTime ;
@@ -166,7 +172,7 @@ Content-Length: 145
166172

167173
And the server responds with a 201 created:
168174

169-
```
175+
```http
170176
HTTP/1.1 201 Created
171177
Accept-Patch: application/sparql-update
172178
Access-Control-Allow-Origin: *
@@ -180,12 +186,12 @@ Link: <ping20.wac>; rel=acl
180186

181187
The acl is in `</pingInbox/ping20.wac>` and it may say that the resource is only readable by the owner of the `</pingInbox/>` container and the sender of the resource in R/W.
182188

183-
{>> we need to find a way to have an ACL that automatically adds the
189+
{>> we need to find a way to have an ACL that automatically adds the
184190
author of the ACL to the authorisation <<} .
185-
191+
186192
At this point we have the following set of links:
187193

188-
![relations between docs, acls, and WebIDs](img/PrivateSharing.png)
194+
![relations between docs, acls, and WebIDs](img/PrivateSharing.png)
189195

190196
### Jane views the file
191197

@@ -195,9 +201,9 @@ Jane reads her inbox at some point, and just does a normal GET on the `<https://
195201

196202
### Ian's ssl certificate
197203

198-
You need
204+
You need
199205

200-
```bash
206+
```sh
201207
$ openssl x509 -in IanCert.pem -inform pem -text
202208
Certificate:
203209
Data:
@@ -240,7 +246,7 @@ Certificate:
240246
Digital Signature, Non Repudiation, Key Encipherment, Key Agreement, Certificate Sign
241247
X509v3 Basic Constraints: critical
242248
CA:FALSE
243-
Netscape Cert Type:
249+
Netscape Cert Type:
244250
SSL Client, S/MIME
245251
Signature Algorithm: sha1WithRSAEncryption
246252
95:da:39:18:00:a5:7a:16:4f:cd:d2:b8:21:97:0e:e5:c7:20:

0 commit comments

Comments
 (0)