Skip to content

Commit d79f8e3

Browse files
committed
Added ssh as protocol for shares. Fixes #277
1 parent fabbb0b commit d79f8e3

File tree

2 files changed

+71
-14
lines changed

2 files changed

+71
-14
lines changed

IETF-RFC.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -607,22 +607,23 @@ contain the following information about its OCM API:
607607
support at least `webdav`,
608608
any other combination of Resources and protocols is
609609
optional. Example:
610-
`json
610+
```json
611611
{
612612
"webdav": "/remote/dav/ocm/",
613613
"webapp": "/app/ocm/",
614614
"talk": "/apps/spreed/api/"
615615
}
616-
`
616+
```
617617
Fields:
618618
- webdav (string) - The top-level WebDAV [RFC4918] path at this
619619
endpoint. In order to access a Remote Resource, implementations
620-
MAY use this path as a prefix, or as the full path (see sharing
621-
examples).
620+
SHOULD use this path as a prefix (see sharing examples).
622621
- webapp (string) - The top-level path for web apps at this
623-
endpoint. This value is provided for documentation
624-
purposes, and it SHOULD NOT be intended as a prefix
625-
for share requests.
622+
endpoint. In order to access a remote web app, implementations
623+
SHOULD use this path as a prefix (see sharing examples).
624+
- ssh (string) - The top-level address in the form `host:port`
625+
of an endpoint that supports ssh and scp with a public/private
626+
key based authentication.
626627
- Any additional protocol supported for this Resource type MAY be
627628
advertised here, where the value MAY correspond to
628629
a top-level URI to be used for that protocol.
@@ -768,7 +769,8 @@ To create a Share, the Sending Server SHOULD make a HTTP POST request
768769
* REQUIRED protocol (object)
769770
JSON object with specific options for each protocol.
770771
The supported protocols are: - `webdav`, to access the data -
771-
`webapp`, to access remote web applications.
772+
`webapp`, to access remote web applications - `ssh`, to access
773+
the data via a public/private key pair.
772774
Other custom protocols might be added in the future.
773775
In case a single protocol is offered, there are three ways to
774776
specify this object:
@@ -848,6 +850,20 @@ To create a Share, the Sending Server SHOULD make a HTTP POST request
848850
- OPTIONAL sharedSecret (string)
849851
An optional secret to be used to access the remote
850852
web app, for example in the form of a bearer token.
853+
* Protocol details for `ssh` MAY contain:
854+
- OPTIONAL accessType (array of strings) - The type of access
855+
being granted to the remote resource. If omitted, it defaults to
856+
`['remote']`. A subset of: - `remote` signals the recipient that
857+
the resource is available for remote access, e.g. via sshfs.
858+
- `datatx` signals the recipient to transfer the resource
859+
from the given URI via scp. The recipient MAY delegate a
860+
third-party service to execute the data transfer on their behalf.
861+
- REQUIRED uri (string)
862+
The endpoint to be used for ssh or scp access, in the form
863+
`[email protected]:/path`, where authentication is expected
864+
to take place via public/private key: the Receiving Server MUST
865+
reply to such a Share Creation Notification sending their public
866+
key, for the Sender server to authorize access to the Resource.
851867

852868
## Response
853869

@@ -860,6 +876,9 @@ A 201 response status means the Share Creation Notification Request was
860876
successful. In this case, the response body MUST contain a JSON
861877
document representing an object with the following string fields:
862878
- REQUIRED: `recipientDisplayName` - the Recipient's display name.
879+
- OPTIONAL: `recipientPublicKey` - the Recipient's public key.
880+
This property MUST be returned when the protocol of the incoming
881+
share was `ssh`.
863882
A 400 response status means some parameters were invalid or missing.
864883
A 401 response status means the Sender cannot be authenticated as
865884
a trusted service.

spec.yaml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,14 @@ paths:
7272
properties:
7373
recipientDisplayName:
7474
type: string
75-
description: display name of the recipient
75+
description: >
76+
Display name of the recipient
7677
example: John Doe
78+
recipientPublicKey:
79+
type: string
80+
description: >
81+
The public key of the recipient. This value MUST be provided
82+
in case the Share Creation Notification includes the `ssh` protocol.
7783
"400":
7884
description: >
7985
Bad request due to invalid parameters, e.g. when `shareWith` is not
@@ -83,26 +89,26 @@ paths:
8389
schema:
8490
$ref: "#/components/schemas/400"
8591
"401":
86-
description: Client cannot be authenticated as a trusted service.
92+
description: Sender cannot be authenticated as a trusted service.
8793
content:
8894
application/json:
8995
schema:
9096
$ref: "#/components/schemas/Error"
9197
"403":
92-
description: Trusted service is not authorized to create shares.
98+
description: Sender is not authorized to create shares.
9399
content:
94100
application/json:
95101
schema:
96102
$ref: "#/components/schemas/Error"
97103
"501":
98-
description: The consumer doesn't support incoming external shares, the share
104+
description: The Receiver doesn't support incoming external shares, the share
99105
type or the resource type is not supported.
100106
content:
101107
application/json:
102108
schema:
103109
$ref: "#/components/schemas/Error"
104110
"503":
105-
description: The consumer is temporary unavailable (e.g. due to planned
111+
description: The Receiver is temporary unavailable (e.g. due to planned
106112
maintenance).
107113
headers:
108114
Retry-After:
@@ -388,6 +394,12 @@ components:
388394
The top-level path for web apps at this endpoint. In order to
389395
access a remote web app, implementations SHOULD use this path
390396
as a prefix (see sharing examples).
397+
ssh:
398+
type: string
399+
decription: >
400+
The top-level address in the form `host:port` of an endpoint
401+
that supports ssh and scp with a public/private key based
402+
authentication.
391403
additionalProperties:
392404
type: string
393405
description: >
@@ -688,7 +700,30 @@ components:
688700
in any URI. In a multi-protocol share scenario with WebDAV, the
689701
access requirements provided in the `webdav` part MUST apply for
690702
`webapp` accesses as well.
691-
703+
ssh:
704+
type: object
705+
properties:
706+
accessType:
707+
type: array
708+
description: >
709+
The type of access being granted to the remote resource.
710+
If omitted, it defaults to `['remote']`.
711+
- `remote` signals the recipient that the resource is available
712+
for remote access, e.g. via sshfs.
713+
- `datatx` signals the recipient to transfer the resource from
714+
the given URI via scp. The recipient MAY delegate a third-party
715+
service to execute the data transfer on their behalf.
716+
items:
717+
type: string
718+
enum:
719+
- remote
720+
- datatx
721+
uri:
722+
type: string
723+
description: >
724+
The endpoint to be used for ssh or scp access, in the form
725+
`[email protected]:/path`, where authentication is expected
726+
to take place via public/private key.
692727
additionalProperties:
693728
type: object
694729
description: >
@@ -724,6 +759,9 @@ components:
724759
uri: 7c084226-d9a1-11e6-bf26-cec0c932ce01
725760
sharedSecret: hfiuhworzwnur98d3wjiwhr
726761
viewMode: read
762+
ssh:
763+
accessType: ['datatx']
764+
uri: [email protected]:/7c084226-d9a1-11e6-bf26-cec0c932ce01
727765
NewNotification:
728766
type: object
729767
required:

0 commit comments

Comments
 (0)