Skip to content

Commit

Permalink
Implement historical way of constructing OCM WebDAV URL (#3868)
Browse files Browse the repository at this point in the history
* adapt webdav ocm endpoint according to historical way of contructing webdav url

* add discovery endpoint in the ocm client

* Make root OCM URLs configurable in /ocm-provider

* add changelog

* fix path for old ocm webdav

* Added reverse proxy for /ocm-provider

* Revert "Added reverse proxy for /ocm-provider"

This reverts commit 1ecb6e4.

* Moved ocm-provider to a new http service

* Updated examples

* Linting

* Simplified ocmprovider and documented config

* Further simplification + relaunching the CI

* Regenerated docs

* Expose OCM as disabled if no endpoint is configured for it

* Update internal/http/services/owncloud/ocdav/propfind.go

Co-authored-by: Giuseppe Lo Presti <giuseppe.lopresti@cern.ch>

* Update internal/http/services/owncloud/ocdav/dav.go

Co-authored-by: Giuseppe Lo Presti <giuseppe.lopresti@cern.ch>

* Update internal/http/services/owncloud/ocdav/dav.go

Co-authored-by: Giuseppe Lo Presti <giuseppe.lopresti@cern.ch>

* Update internal/http/services/owncloud/ocdav/ocdav.go

Co-authored-by: Giuseppe Lo Presti <giuseppe.lopresti@cern.ch>

* Update internal/http/services/owncloud/ocdav/propfind.go

Co-authored-by: Giuseppe Lo Presti <giuseppe.lopresti@cern.ch>

* fix support legacy ocm access

---------

Co-authored-by: Giuseppe Lo Presti <giuseppe.lopresti@cern.ch>
  • Loading branch information
gmgigi96 and glpatcern authored May 11, 2023
1 parent f81247e commit cfcf976
Show file tree
Hide file tree
Showing 25 changed files with 344 additions and 120 deletions.
8 changes: 8 additions & 0 deletions changelog/unreleased/expose-historical-ocm-webdav.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Enhancement: Implement historical way of constructing OCM WebDAV URL

Expose the expected WebDAV endpoint for OCM by OC10 and Nextcloud as described
in https://github.com/cs3org/OCM-API/issues/70#issuecomment-1538551138 to allow
reva providers to participate to mesh.

https://github.com/cs3org/reva/pull/3868
https://github.com/cs3org/reva/issues/3855
66 changes: 66 additions & 0 deletions docs/content/en/docs/config/http/services/ocmprovider/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: "ocmprovider"
linkTitle: "ocmprovider"
weight: 10
description: >
Configuration for the ocmprovider service
---

# _struct: config_

{{% dir name="ocm_prefix" type="string" default="ocm" %}}
The prefix URL where the OCM API is served. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/ocmprovider/ocmprovider.go#L37)
{{< highlight toml >}}
[http.services.ocmprovider]
ocm_prefix = "ocm"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="endpoint" type="string" default="http://localhost" %}}
This host's URL. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/ocmprovider/ocmprovider.go#L38)
{{< highlight toml >}}
[http.services.ocmprovider]
endpoint = "http://localhost"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="provider" type="string" default="reva" %}}
A friendly name that defines this service. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/ocmprovider/ocmprovider.go#L39)
{{< highlight toml >}}
[http.services.ocmprovider]
provider = "reva"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="webdav_root" type="string" default="/remote.php/dav/ocm" %}}
The root URL of the WebDAV endpoint to serve OCM shares. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/ocmprovider/ocmprovider.go#L40)
{{< highlight toml >}}
[http.services.ocmprovider]
webdav_root = "/remote.php/dav/ocm"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="webapp_root" type="string" default="/external/sciencemesh" %}}
The root URL to serve Web apps via OCM. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/ocmprovider/ocmprovider.go#L41)
{{< highlight toml >}}
[http.services.ocmprovider]
webapp_root = "/external/sciencemesh"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="enable_webapp" type="bool" default=false %}}
Whether web apps are enabled in OCM shares. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/ocmprovider/ocmprovider.go#L42)
{{< highlight toml >}}
[http.services.ocmprovider]
enable_webapp = false
{{< /highlight >}}
{{% /dir %}}

{{% dir name="enable_datatx" type="bool" default=false %}}
Whether data transfers are enabled in OCM shares. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/ocmprovider/ocmprovider.go#L43)
{{< highlight toml >}}
[http.services.ocmprovider]
enable_datatx = false
{{< /highlight >}}
{{% /dir %}}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: >
# _struct: Config_

{{% dir name="insecure" type="bool" default=false %}}
Whether to skip certificate checks when sending requests. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/owncloud/ocdav/ocdav.go#L102)
Whether to skip certificate checks when sending requests. [[Ref]](https://github.com/cs3org/reva/tree/master/internal/http/services/owncloud/ocdav/ocdav.go#L103)
{{< highlight toml >}}
[http.services.owncloud.ocdav]
insecure = false
Expand Down
16 changes: 8 additions & 8 deletions docs/content/en/docs/config/packages/auth/manager/oidc/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,63 @@ description: >
# _struct: config_

{{% dir name="insecure" type="bool" default=false %}}
Whether to skip certificate checks when sending requests. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L61)
Whether to skip certificate checks when sending requests. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L63)
{{< highlight toml >}}
[auth.manager.oidc]
insecure = false
{{< /highlight >}}
{{% /dir %}}

{{% dir name="issuer" type="string" default="" %}}
The issuer of the OIDC token. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L62)
The issuer of the OIDC token. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L64)
{{< highlight toml >}}
[auth.manager.oidc]
issuer = ""
{{< /highlight >}}
{{% /dir %}}

{{% dir name="id_claim" type="string" default="sub" %}}
The claim containing the ID of the user. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L63)
The claim containing the ID of the user. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L65)
{{< highlight toml >}}
[auth.manager.oidc]
id_claim = "sub"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="uid_claim" type="string" default="" %}}
The claim containing the UID of the user. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L64)
The claim containing the UID of the user. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L66)
{{< highlight toml >}}
[auth.manager.oidc]
uid_claim = ""
{{< /highlight >}}
{{% /dir %}}

{{% dir name="gid_claim" type="string" default="" %}}
The claim containing the GID of the user. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L65)
The claim containing the GID of the user. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L67)
{{< highlight toml >}}
[auth.manager.oidc]
gid_claim = ""
{{< /highlight >}}
{{% /dir %}}

{{% dir name="gatewaysvc" type="string" default="" %}}
The endpoint at which the GRPC gateway is exposed. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L66)
The endpoint at which the GRPC gateway is exposed. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L68)
{{< highlight toml >}}
[auth.manager.oidc]
gatewaysvc = ""
{{< /highlight >}}
{{% /dir %}}

{{% dir name="users_mapping" type="string" default="" %}}
The optional OIDC users mapping file path [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L67)
The optional OIDC users mapping file path [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L69)
{{< highlight toml >}}
[auth.manager.oidc]
users_mapping = ""
{{< /highlight >}}
{{% /dir %}}

{{% dir name="group_claim" type="string" default="" %}}
The group claim to be looked up to map the user (default to 'groups'). [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L68)
The group claim to be looked up to map the user (default to 'groups'). [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/auth/manager/oidc/oidc.go#L70)
{{< highlight toml >}}
[auth.manager.oidc]
group_claim = ""
Expand Down
18 changes: 9 additions & 9 deletions docs/content/en/docs/config/packages/cbox/group/rest/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,71 @@ description: >
# _struct: config_

{{% dir name="redis_address" type="string" default="localhost:6379" %}}
The address at which the redis server is running [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L54)
The address at which the redis server is running [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L56)
{{< highlight toml >}}
[cbox.group.rest]
redis_address = "localhost:6379"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="group_members_cache_expiration" type="int" default=5 %}}
The time in minutes for which the members of a group would be cached [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L60)
The time in minutes for which the members of a group would be cached [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L62)
{{< highlight toml >}}
[cbox.group.rest]
group_members_cache_expiration = 5
{{< /highlight >}}
{{% /dir %}}

{{% dir name="id_provider" type="string" default="http://cernbox.cern.ch" %}}
The OIDC Provider [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L62)
The OIDC Provider [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L64)
{{< highlight toml >}}
[cbox.group.rest]
id_provider = "http://cernbox.cern.ch"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="api_base_url" type="string" default="https://authorization-service-api-dev.web.cern.ch" %}}
Base API Endpoint [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L64)
Base API Endpoint [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L66)
{{< highlight toml >}}
[cbox.group.rest]
api_base_url = "https://authorization-service-api-dev.web.cern.ch"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="client_id" type="string" default="-" %}}
Client ID needed to authenticate [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L66)
Client ID needed to authenticate [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L68)
{{< highlight toml >}}
[cbox.group.rest]
client_id = "-"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="client_secret" type="string" default="-" %}}
Client Secret [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L68)
Client Secret [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L70)
{{< highlight toml >}}
[cbox.group.rest]
client_secret = "-"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="oidc_token_endpoint" type="string" default="https://keycloak-dev.cern.ch/auth/realms/cern/api-access/token" %}}
Endpoint to generate token to access the API [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L71)
Endpoint to generate token to access the API [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L73)
{{< highlight toml >}}
[cbox.group.rest]
oidc_token_endpoint = "https://keycloak-dev.cern.ch/auth/realms/cern/api-access/token"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="target_api" type="string" default="authorization-service-api" %}}
The target application for which token needs to be generated [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L73)
The target application for which token needs to be generated [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L75)
{{< highlight toml >}}
[cbox.group.rest]
target_api = "authorization-service-api"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="group_fetch_interval" type="int" default=3600 %}}
The time in seconds between bulk fetch of groups [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L75)
The time in seconds between bulk fetch of groups [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/cbox/group/rest/rest.go#L77)
{{< highlight toml >}}
[cbox.group.rest]
group_fetch_interval = 3600
Expand Down
1 change: 1 addition & 0 deletions examples/meshdirectory/meshdirectory.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ file = "/var/tmp/reva/shares_server_1.json"
[http.services.dataprovider]
[http.services.prometheus]
[http.services.ocmd]
[http.services.ocmprovider]
[http.services.ocdav]
[http.services.ocs]

Expand Down
6 changes: 4 additions & 2 deletions examples/nextcloud-integration/revad.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ driver = "nextcloud"
endpoint = "http://localhost/apps/sciencemesh/"

[http]
enabled_services = ["ocmd"]
enabled_services = ["ocmd", "ocmprovider"]
enabled_middlewares = ["providerauthorizer", "cors"]
address = "0.0.0.0:19001"

Expand All @@ -126,9 +126,11 @@ driver = "nextcloud"
user_layout = "{{.Username}}"

[http.services.ocmd]
prefix = "ocm"

[http.services.ocmprovider]
provider = "Reva-Nextcloud"
endpoint = "http://localhost"
webdav_root = "/remote.php/dav/ocm"
enable_webapp = true
enable_datatx = true

Expand Down
4 changes: 3 additions & 1 deletion examples/oc-phoenix/ocmd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ driver = "json"
providers = "providers.demo.json"

[http]
enabled_services = ["ocmd"]
enabled_services = ["ocmd", "ocmprovider"]
enabled_middlewares = ["providerauthorizer", "cors"]
address = "0.0.0.0:13001"

[http.services.ocmd]
prefix = "ocm"

[http.services.ocmprovider]
endpoint = "http://localhost:13001"

[http.middlewares.providerauthorizer]
Expand Down
3 changes: 3 additions & 0 deletions examples/ocmd/server-1/ocmd-server-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ user_layout = "{{.Username}}"

[http.services.ocmd]
prefix = "ocm"

[http.services.ocmprovider]
ocm_prefix = "ocm"
provider = "reva@cern"
endpoint = "http://localhost:19001"
enable_webapp = true
Expand Down
3 changes: 2 additions & 1 deletion examples/ocmd/server-2/ocmd-server-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ driver = "localhome"
user_layout = "{{.Username}}"

[http.services.ocmd]
prefix = "ocm"

[http.services.ocmprovider]
provider = "reva@cesnet"
endpoint = "http://localhost:17001"
enable_webapp = true
Expand Down
1 change: 1 addition & 0 deletions examples/oidc-mapping-tpc/server-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ driver = "localhome"
[http.services.datagateway]
[http.services.prometheus]
[http.services.ocmd]
[http.services.ocmprovider]
[http.services.ocs]
[http.services.ocdav]
enable_http_tpc = true
1 change: 1 addition & 0 deletions examples/oidc-mapping-tpc/server-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ driver = "localhome"
[http.services.datagateway]
[http.services.prometheus]
[http.services.ocmd]
[http.services.ocmprovider]
[http.services.ocs]
[http.services.ocdav]
enable_http_tpc = true
File renamed without changes.
1 change: 1 addition & 0 deletions examples/standalone/standalone.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
[http.services.dataprovider]
[http.services.prometheus]
[http.services.ocmd]
[http.services.ocmprovider]
[http.services.ocdav]
[http.services.ocs]
1 change: 1 addition & 0 deletions examples/storage-references/gateway.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mime_types = [
[http.services.datagateway]
[http.services.prometheus]
[http.services.ocmd]
[http.services.ocmprovider]
[http.services.ocdav]
[http.services.ocs]
[http.services.appprovider]
1 change: 1 addition & 0 deletions examples/two-server-setup/gateway-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ address = "0.0.0.0:19001"
[http.services.datagateway]
[http.services.prometheus]
[http.services.ocmd]
[http.services.ocmprovider]
provider = "Reva-Server-1"
endpoint = "http://localhost:19001"
enable_webapp = true
Expand Down
1 change: 1 addition & 0 deletions examples/two-server-setup/gateway-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ address = "0.0.0.0:29001"
[http.services.datagateway]
[http.services.prometheus]
[http.services.ocmd]
[http.services.ocmprovider]
provider = "Reva-Server-2"
endpoint = "http://localhost:29001"
enable_webapp = true
Expand Down
1 change: 1 addition & 0 deletions internal/http/services/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
_ "github.com/cs3org/reva/internal/http/services/meshdirectory"
_ "github.com/cs3org/reva/internal/http/services/metrics"
_ "github.com/cs3org/reva/internal/http/services/ocmd"
_ "github.com/cs3org/reva/internal/http/services/ocmprovider"
_ "github.com/cs3org/reva/internal/http/services/owncloud/ocdav"
_ "github.com/cs3org/reva/internal/http/services/owncloud/ocs"
_ "github.com/cs3org/reva/internal/http/services/preferences"
Expand Down
Loading

0 comments on commit cfcf976

Please sign in to comment.