Skip to content

Commit aa7f446

Browse files
authored
Support signature authentication for public links (#118)
1 parent 4a26f4f commit aa7f446

File tree

4 files changed

+232
-25
lines changed

4 files changed

+232
-25
lines changed

cs3/sharing/link/v1beta1/link_api.proto

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ message ListPublicSharesRequest {
173173
// OPTIONAL.
174174
// The list of filters to apply if any.
175175
repeated Filter filters = 2;
176+
// OPTIONAL.
177+
// If a signature should be included in the share.
178+
bool sign = 3;
176179
}
177180

178181
message ListPublicSharesResponse {
@@ -212,6 +215,9 @@ message GetPublicShareRequest {
212215
// REQUIRED.
213216
// The reference to which the action should be performed.
214217
PublicShareReference ref = 2;
218+
// OPTIONAL.
219+
// If a signature should be included in the share.
220+
bool sign = 3;
215221
}
216222

217223
message GetPublicShareResponse {
@@ -224,9 +230,6 @@ message GetPublicShareResponse {
224230
// REQUIRED.
225231
// The share.
226232
PublicShare share = 3;
227-
// OPTIONAL.
228-
// The share password hash.
229-
string password_hash = 4;
230233
}
231234

232235
message GetPublicShareByTokenRequest {
@@ -237,8 +240,11 @@ message GetPublicShareByTokenRequest {
237240
// The unlisted token to identify the public share.
238241
string token = 2;
239242
// OPTIONAL.
240-
// The public link can be password protected.
241-
string password = 3;
243+
// The public link can require authentication.
244+
PublicShareAuthentication authentication = 3;
245+
// OPTIONAL.
246+
// If a signature should be included in the share.
247+
bool sign = 4;
242248
}
243249

244250
message GetPublicShareByTokenResponse {
@@ -253,5 +259,5 @@ message GetPublicShareByTokenResponse {
253259
PublicShare share = 3;
254260
// OPTIONAL.
255261
// The share password hash.
256-
string password_hash = 4;
262+
string password_hash = 4 [deprecated = true];
257263
}

cs3/sharing/link/v1beta1/resources.proto

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ message PublicShare {
9898
// This field is only useful for informational purposes, like for example,
9999
// setting the window title in a public share HTML page.
100100
string display_name = 11;
101+
// OPTIONAL.
102+
// A time constrained token with which
103+
// GetPublicSharebyToken requests can be
104+
// authenticated.
105+
ShareSignature signature = 12;
101106
}
102107

103108
// The permissions for a share.
@@ -130,6 +135,28 @@ message PublicShareReference {
130135
}
131136
}
132137

138+
// The mechanism to authenticate a request to
139+
// GetPublicShareByToken.
140+
message PublicShareAuthentication {
141+
oneof spec {
142+
// The password of the share.
143+
string password = 1;
144+
// The signature issued by GetPublicShareByToken.
145+
ShareSignature signature = 2;
146+
}
147+
}
148+
149+
// A time constrained token which can be used to
150+
// authenticate link share requests.
151+
message ShareSignature {
152+
// REQUIRED.
153+
// The signature value.
154+
string signature = 1;
155+
// REQUIRED.
156+
// The time until the signature becomes invalid.
157+
cs3.types.v1beta1.Timestamp signature_expiration = 2;
158+
}
159+
133160
// Defines the restrictions for the public share.
134161
message Grant {
135162
// REQUIRED.

docs/index.html

Lines changed: 130 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,10 @@ <h2>Table of Contents</h2>
11031103
<a href="#cs3.sharing.link.v1beta1.PublicShare"><span class="badge">M</span>PublicShare</a>
11041104
</li>
11051105

1106+
<li>
1107+
<a href="#cs3.sharing.link.v1beta1.PublicShareAuthentication"><span class="badge">M</span>PublicShareAuthentication</a>
1108+
</li>
1109+
11061110
<li>
11071111
<a href="#cs3.sharing.link.v1beta1.PublicShareId"><span class="badge">M</span>PublicShareId</a>
11081112
</li>
@@ -1115,6 +1119,10 @@ <h2>Table of Contents</h2>
11151119
<a href="#cs3.sharing.link.v1beta1.PublicShareReference"><span class="badge">M</span>PublicShareReference</a>
11161120
</li>
11171121

1122+
<li>
1123+
<a href="#cs3.sharing.link.v1beta1.ShareSignature"><span class="badge">M</span>ShareSignature</a>
1124+
</li>
1125+
11181126

11191127

11201128

@@ -8482,11 +8490,19 @@ <h3 id="cs3.sharing.link.v1beta1.GetPublicShareByTokenRequest">GetPublicShareByT
84828490
</tr>
84838491

84848492
<tr>
8485-
<td>password</td>
8486-
<td><a href="#string">string</a></td>
8493+
<td>authentication</td>
8494+
<td><a href="#cs3.sharing.link.v1beta1.PublicShareAuthentication">PublicShareAuthentication</a></td>
8495+
<td></td>
8496+
<td><p>OPTIONAL.
8497+
The public link can require authentication. </p></td>
8498+
</tr>
8499+
8500+
<tr>
8501+
<td>sign</td>
8502+
<td><a href="#bool">bool</a></td>
84878503
<td></td>
84888504
<td><p>OPTIONAL.
8489-
The public link can be password protected. </p></td>
8505+
If a signature should be included in the share. </p></td>
84908506
</tr>
84918507

84928508
</tbody>
@@ -8542,6 +8558,27 @@ <h3 id="cs3.sharing.link.v1beta1.GetPublicShareByTokenResponse">GetPublicShareBy
85428558
</table>
85438559

85448560

8561+
8562+
8563+
<h4>Fields with deprecated option</h4>
8564+
<table>
8565+
<thead>
8566+
<tr>
8567+
<td>Name</td>
8568+
<td>Option</td>
8569+
</tr>
8570+
</thead>
8571+
<tbody>
8572+
8573+
<tr>
8574+
<td>password_hash</td>
8575+
<td><p>true</p></td>
8576+
</tr>
8577+
8578+
</tbody>
8579+
</table>
8580+
8581+
85458582

85468583

85478584

@@ -8571,6 +8608,14 @@ <h3 id="cs3.sharing.link.v1beta1.GetPublicShareRequest">GetPublicShareRequest</h
85718608
The reference to which the action should be performed. </p></td>
85728609
</tr>
85738610

8611+
<tr>
8612+
<td>sign</td>
8613+
<td><a href="#bool">bool</a></td>
8614+
<td></td>
8615+
<td><p>OPTIONAL.
8616+
If a signature should be included in the share. </p></td>
8617+
</tr>
8618+
85748619
</tbody>
85758620
</table>
85768621

@@ -8612,14 +8657,6 @@ <h3 id="cs3.sharing.link.v1beta1.GetPublicShareResponse">GetPublicShareResponse<
86128657
The share. </p></td>
86138658
</tr>
86148659

8615-
<tr>
8616-
<td>password_hash</td>
8617-
<td><a href="#string">string</a></td>
8618-
<td></td>
8619-
<td><p>OPTIONAL.
8620-
The share password hash. </p></td>
8621-
</tr>
8622-
86238660
</tbody>
86248661
</table>
86258662

@@ -8653,6 +8690,14 @@ <h3 id="cs3.sharing.link.v1beta1.ListPublicSharesRequest">ListPublicSharesReques
86538690
The list of filters to apply if any. </p></td>
86548691
</tr>
86558692

8693+
<tr>
8694+
<td>sign</td>
8695+
<td><a href="#bool">bool</a></td>
8696+
<td></td>
8697+
<td><p>OPTIONAL.
8698+
If a signature should be included in the share. </p></td>
8699+
</tr>
8700+
86568701
</tbody>
86578702
</table>
86588703

@@ -9243,6 +9288,47 @@ <h3 id="cs3.sharing.link.v1beta1.PublicShare">PublicShare</h3>
92439288
setting the window title in a public share HTML page. </p></td>
92449289
</tr>
92459290

9291+
<tr>
9292+
<td>signature</td>
9293+
<td><a href="#cs3.sharing.link.v1beta1.ShareSignature">ShareSignature</a></td>
9294+
<td></td>
9295+
<td><p>OPTIONAL.
9296+
A time constrained token with which
9297+
GetPublicSharebyToken requests can be
9298+
authenticated. </p></td>
9299+
</tr>
9300+
9301+
</tbody>
9302+
</table>
9303+
9304+
9305+
9306+
9307+
9308+
<h3 id="cs3.sharing.link.v1beta1.PublicShareAuthentication">PublicShareAuthentication</h3>
9309+
<p>The mechanism to authenticate a request to</p><p>GetPublicShareByToken.</p>
9310+
9311+
9312+
<table class="field-table">
9313+
<thead>
9314+
<tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
9315+
</thead>
9316+
<tbody>
9317+
9318+
<tr>
9319+
<td>password</td>
9320+
<td><a href="#string">string</a></td>
9321+
<td></td>
9322+
<td><p>The password of the share. </p></td>
9323+
</tr>
9324+
9325+
<tr>
9326+
<td>signature</td>
9327+
<td><a href="#cs3.sharing.link.v1beta1.ShareSignature">ShareSignature</a></td>
9328+
<td></td>
9329+
<td><p>The signature issued by GetPublicShareByToken. </p></td>
9330+
</tr>
9331+
92469332
</tbody>
92479333
</table>
92489334

@@ -9332,6 +9418,39 @@ <h3 id="cs3.sharing.link.v1beta1.PublicShareReference">PublicShareReference</h3>
93329418

93339419

93349420

9421+
<h3 id="cs3.sharing.link.v1beta1.ShareSignature">ShareSignature</h3>
9422+
<p>A time constrained token which can be used to</p><p>authenticate link share requests.</p>
9423+
9424+
9425+
<table class="field-table">
9426+
<thead>
9427+
<tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
9428+
</thead>
9429+
<tbody>
9430+
9431+
<tr>
9432+
<td>signature</td>
9433+
<td><a href="#string">string</a></td>
9434+
<td></td>
9435+
<td><p>REQUIRED.
9436+
The signature value. </p></td>
9437+
</tr>
9438+
9439+
<tr>
9440+
<td>signature_expiration</td>
9441+
<td><a href="#cs3.types.v1beta1.Timestamp">cs3.types.v1beta1.Timestamp</a></td>
9442+
<td></td>
9443+
<td><p>REQUIRED.
9444+
The time until the signature becomes invalid. </p></td>
9445+
</tr>
9446+
9447+
</tbody>
9448+
</table>
9449+
9450+
9451+
9452+
9453+
93359454

93369455

93379456

0 commit comments

Comments
 (0)