Skip to content

Commit ab37fc9

Browse files
committed
Reworked section about remote access
1 parent 8fa717b commit ab37fc9

File tree

2 files changed

+57
-61
lines changed

2 files changed

+57
-61
lines changed

IETF-RFC.md

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,8 @@ contain the following information about its OCM API:
695695
`"/index.php/apps/sciencemesh/accept"` is specified here then a WAYF
696696
Page SHOULD redirect the end-user to
697697
`/index.php/apps/sciencemesh/accept?token=zi5kooKu3ivohr9a&providerDomain=example.com`.
698-
* OPTIONAL: tokenEndPoint (string) - URL of the token endpoint where
699-
the Sending Server can exchange a `code` for a bearer token.
698+
* OPTIONAL: tokenEndPoint (string) - URL of the token endpoint where the
699+
Sending Server can exchange a secret for a short-lived bearer token.
700700
Implementations that offer the `"exchange-token"` capability MUST
701701
provide this URL as well.
702702
Example: `"https://my-cloud-storage.org/ocm/token"`.
@@ -961,49 +961,53 @@ notification that this happened.
961961
# Resource Access
962962

963963
To access the Resource, the Receiving Server MAY use multiple ways,
964-
depending on the body of the Share Creation Notification. The procedure
965-
is as follows:
964+
depending on the body of the Share Creation Notification and the
965+
protocol required for access. The procedure is as follows:
966966

967967
1. The receiver MUST extract the OCM Server FQDN from the `sender`
968968
field of the received share, and MUST query the
969-
[Discovery](#ocm-api-discovery) endpoint at that address: the
970-
`resourceTypes[0].protocols.webdav` value is the
971-
`<sender-ocm-path>` to be used in step 3.
972-
2. If `code` is not empty, the receiver SHOULD make a signed POST
973-
request to the path in the Sending Server’s tokenEndPoint, to
974-
exchange the code for a short-lived bearer token, and then use that
975-
bearer token to access the Resource (See the [Code Flow](
976-
#code-flow) section).
977-
3. If `protocol.name` = `webdav`, the receiver SHOULD inspect the
978-
`protocol.options` property. If it contains a `sharedSecret`, as in
979-
the [legacy example](
980-
https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1shares/post),
981-
then the receiver SHOULD make a HTTP PROPFIND request to
982-
`https://<sharedSecret>:@<sender-host><sender-ocm-path>`. Note that
983-
this access method, based on Basic Auth, is _deprecated_ and may be
984-
removed in a future release of the Protocol.
985-
4. Otherwise, if `protocol.name` = `multi`, the receiver MUST inspect
986-
the `protocol.webdav.uri` property: if it's a complete URI, the
987-
receiver MUST make a HTTP PROPFIND request against it to access the
988-
Remote Resource. If it only contains an identifier `<key>`, the
989-
receiver MUST make a HTTP PROPFIND request to
990-
`https://<sender-host><sender-ocm-path>/<key>` in order to access
991-
the Remote Resource. Additionally, the receiver MUST pass an
992-
`Authorization: bearer` header with either the short-lived bearer
993-
token obtained in step 2, if applicable, or the
994-
`protocol.webdav.sharedSecret` value.
969+
[Discovery](#ocm-api-discovery) endpoint at that address: let
970+
`<sender-ocm-path>` be the `resourceTypes[0].protocols.webdav` value
971+
to be used later, if defined.
972+
2. If `protocol.name` is `multi`, the receiver MUST inspect the
973+
`protocol.{protocolName}` properties corresponding to the protocol
974+
of concern, and act according to its semantics. For the specific
975+
case where `protocol.webdav` is available and the receiver wants
976+
to use it, the following steps are to be followed.
977+
3. The `protocol.webdav.requirements` MUST be inspected:
978+
3.1. If it includes `must-exchange-token`, the receiver MUST make a
979+
signed POST request to the path in the Sending Server’s
980+
{tokenEndPoint}, to exchange the `protocol.webdav.sharedSecret`
981+
token for a short-lived bearer token, and then use that bearer
982+
token to access the Resource (See the [Code Flow](#code-flow)
983+
section).
984+
3.2. If it includes `must-use-mfa`, the Receiving Server MUST ensure
985+
that the Receiving Party has been authenticated with MFA, or prompt
986+
the consumer in order to elevate their session, if applicable.
987+
4. The `protocol.webdav.uri` property MUST now be inspected: if it's a
988+
complete URI, the receiver MUST make a HTTP PROPFIND request against
989+
it to access the Remote Resource, otherwise it is to be taken as an
990+
identifier `<id>`, in which case the receiver MUST make a HTTP
991+
PROPFIND request to: `https://<sender-host><sender-ocm-path>/<id>`
992+
in order to access to the Remote Resource. The receiver MUST pass
993+
an `Authorization: bearer` header with either the short-lived bearer
994+
token obtained in step 3.1., if applicable, or the
995+
`protocol.webdav.sharedSecret` value.
996+
5. Otherwise, if `protocol.name` is `webdav` the receiver SHOULD inspect
997+
the `protocol.options` property: if `protocol.options.sharedSecret`
998+
is defined, then the receiver SHOULD make a HTTP PROPFIND request to
999+
`https://<sharedSecret>:@<sender-host><sender-ocm-path>`. Note that
1000+
this access method, based on Basic Auth, is _deprecated_ and may be
1001+
removed in a future release of the Protocol. If a secret cannot be
1002+
identified (e.g. because `protocol.options` is undefined), then
1003+
the receiver SHOULD discard the share as invalid.
9951004

9961005
In all cases, in case the Shared Resource is a folder and the Receiving
9971006
Server accesses a Resource within that shared folder, it SHOULD append
9981007
its relative path to that URL. In other words, the Sending Server
9991008
SHOULD support requests to URLs such as
10001009
`https://<sender-host><sender-ocm-path>/path/to/resource.txt`.
10011010

1002-
Additionally, if `protocol.<protocolname>.requirements` includes
1003-
`mfa-enforced`, the Receiving Server MUST ensure that the Receiving
1004-
Party has been authenticated with MFA, or prompt the consumer in order
1005-
to elevate their session, if applicable.
1006-
10071011

10081012
# Code Flow
10091013

@@ -1017,7 +1021,7 @@ No user interaction or redirect is involved. [RFC6749]
10171021
## Token Request
10181022

10191023
To obtain an access token, the Receiving Server MUST send an HTTP POST
1020-
request to the Sending Server’s tokenEndPoint as discovered in the
1024+
request to the Sending Server’s {tokenEndPoint} as discovered in the
10211025
OCM provider metadata, following section 4.4.2 of [RFC6749]. Here
10221026
follows an example of such POST request:
10231027

@@ -1043,7 +1047,7 @@ code=my_secret_code
10431047
The request MUST be signed using an HTTP Message Signature
10441048
[RFC9421]. The `client_id` identifies the Receiving Server and MUST be
10451049
set to its fully qualified domain name. The `code` parameter carries
1046-
the authorization code that was issued by the Sending Server in the
1050+
the authorization secret that was issued by the Sending Server in the
10471051
Share Creation Notification. It is allowed to send the additional
10481052
parameters defined in [RFC6749] for the `authorization_code` grant type,
10491053
but they MUST be ignored.
@@ -1067,7 +1071,7 @@ structure visible to the Receiving Server. The token authorizes the
10671071
Receiving Server to access the shared resource using the appropriate
10681072
transport protocol (e.g., WebDAV). The `expires_in` value indicates
10691073
the token lifetime in seconds. No `refresh_token` is issued, instead
1070-
the same request to the tokenEndPoint MUST be repeated before the
1074+
the same request to the {tokenEndPoint} MUST be repeated before the
10711075
`access_token` has expired, to recieve a new `access_token` that can
10721076
then be used in the same manner.
10731077

spec.yaml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ paths:
235235
post:
236236
summary: Token Exchange endpoint
237237
description: >
238-
This optional endpoint allows to obtain a (potentially short-lived) bearer token in exchange for a code.
238+
This optional endpoint allows to obtain a (potentially short-lived) bearer token in exchange for a secret.
239239
See [Resource Access](https://github.com/cs3org/OCM-API/blob/develop/IETF-RFC.md#resource-access)
240240
for more details. The actual endpoint URL is discovered via OCM provider metadata
241241
(tokenEndPoint).
@@ -372,39 +372,34 @@ components:
372372
protocols:
373373
type: object
374374
description: >
375-
The supported protocols to access shared resources at this
376-
endpoint.
375+
The supported protocols to access shared resources at this endpoint.
377376
Implementations MUST support at least `webdav` for `file` resources,
378377
any other combination of resources and protocols is optional.
379378
properties:
380379
webdav:
381380
type: string
382381
description: >
383-
The top-level WebDAV path at this endpoint. In order to
384-
access
382+
The top-level WebDAV path at this endpoint. In order to access
385383
a remote shared resource, implementations SHOULD use this path
386384
as a prefix (see sharing examples).
387385
webapp:
388386
type: string
389387
description: >
390-
The top-level path for web apps at this endpoint. In order
391-
to
388+
The top-level path for web apps at this endpoint. In order to
392389
access a remote web app, implementations SHOULD use this path
393390
as a prefix (see sharing examples).
394391
datatx:
395392
type: string
396393
description: >
397-
The top-level path to be used for data transfers. In order
398-
to
394+
The top-level path to be used for data transfers. In order to
399395
access a remote shared resource, implementations SHOULD use
400396
this path as a prefix (see sharing examples). In addition,
401397
implementations are expected to execute the transfer using
402398
WebDAV as the wire protocol.
403399
additionalProperties:
404400
type: string
405401
description: >
406-
Any additional protocol supported for this resource type
407-
MAY
402+
Any additional protocol supported for this resource type MAY
408403
be advertised here, where the value MAY correspond to a top-level
409404
URI to be used for that protocol.
410405
example:
@@ -673,24 +668,21 @@ components:
673668
type: string
674669
description: >
675670
An optional secret to be used to access the remote web app, such as
676-
a bearer token. To prevent leaking it in logs it MUST NOT appear
677-
in any URI. If a `code` is provided, then the sending host MUST
678-
accept the short-lived bearer token when serving the web app,
679-
which can be exchanged in the code flow interaction. The exchange
680-
MAY already have happened if the recipient accessed the underlying
681-
resource via WebDAV, in a multi-protocol scenario. In this case,
682-
the `sharedSecret` SHOULD be omitted.
671+
a bearer token. To prevent leaking it in logs it MUST NOT appear
672+
in any URI. In a multi-protocol share scenario with WebDAV, the
673+
access requirements provided in the `webdav` part MUST apply for
674+
`webapp` accesses as well.
683675
datatx:
684676
type: object
685677
properties:
686678
sharedSecret:
687679
type: string
688680
description: >
689681
An optional secret to be used to access the resource, such as
690-
a bearer token. If a `code` is provided, it SHOULD be used
691-
instead via the code flow interaction, and the `sharedSecret`
692-
SHOULD be omitted. To prevent leaking it in logs it MUST NOT
693-
appear in any URI.
682+
a bearer token. To prevent leaking it in logs it MUST NOT
683+
appear in any URI. In a multi-protocol share scenario with WebDAV,
684+
the access requirements provided in the `webdav` part MUST apply
685+
for `datatx` transfers as well.
694686
srcUri:
695687
type: string
696688
description: >
@@ -853,7 +845,7 @@ components:
853845
example: receiver.org
854846
code:
855847
type: string
856-
description: Code received in the Share Creation Notification
848+
description: Secret received in the Share Creation Notification
857849
example: xyz
858850
grant_type:
859851
type: string

0 commit comments

Comments
 (0)