From fa1b262bc114c4e3bc750eeafa2fb2d831bef3cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 16 Jan 2020 22:34:25 +0100 Subject: [PATCH] introduce dedicated reva commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- go.mod | 4 +- go.sum | 28 +- pkg/command/phoenix_ocis.go | 13 +- pkg/command/phoenix_simple.go | 15 +- pkg/command/reva.go | 31 -- pkg/command/reva_ocis.go | 533 ----------------------------- pkg/command/reva_simple.go | 263 -------------- pkg/command/revaauthbasic.go | 40 +++ pkg/command/revaauthbearer.go | 40 +++ pkg/command/revafrontend.go | 40 +++ pkg/command/revagateway.go | 40 +++ pkg/command/revasharing.go | 40 +++ pkg/command/revastoragehome.go | 42 +++ pkg/command/revastoragehomedata.go | 40 +++ pkg/command/revastorageoc.go | 42 +++ pkg/command/revastorageocdata.go | 40 +++ pkg/command/revastorageroot.go | 40 +++ pkg/command/revausers.go | 40 +++ pkg/command/server_simple.go | 10 +- pkg/micro/runtime/runtime.go | 12 +- 20 files changed, 479 insertions(+), 874 deletions(-) delete mode 100644 pkg/command/reva.go delete mode 100644 pkg/command/reva_ocis.go delete mode 100644 pkg/command/reva_simple.go create mode 100644 pkg/command/revaauthbasic.go create mode 100644 pkg/command/revaauthbearer.go create mode 100644 pkg/command/revafrontend.go create mode 100644 pkg/command/revagateway.go create mode 100644 pkg/command/revasharing.go create mode 100644 pkg/command/revastoragehome.go create mode 100644 pkg/command/revastoragehomedata.go create mode 100644 pkg/command/revastorageoc.go create mode 100644 pkg/command/revastorageocdata.go create mode 100644 pkg/command/revastorageroot.go create mode 100644 pkg/command/revausers.go diff --git a/go.mod b/go.mod index 08304fa4937..937603ea6da 100644 --- a/go.mod +++ b/go.mod @@ -20,9 +20,9 @@ require ( github.com/owncloud/ocis-hello v0.0.0-20200114093148-2205c2745838 github.com/owncloud/ocis-konnectd v0.0.0-20191227185917-046fec203337 github.com/owncloud/ocis-ocs v0.0.0-20191224113758-20455a2e9013 - github.com/owncloud/ocis-phoenix v0.0.0-20200114152828-8b3ea4082472 + github.com/owncloud/ocis-phoenix v0.0.0-20200117091807-bab3638b2acc github.com/owncloud/ocis-pkg v1.2.1-0.20200115112437-3dd614fdcd51 - github.com/owncloud/ocis-reva v0.0.0-20200107084202-6cc46af428bf + github.com/owncloud/ocis-reva v0.0.0-20200117091331-9a63eaa1173d github.com/owncloud/ocis-webdav v0.0.0-20191227185841-c5c77e241249 github.com/spf13/viper v1.6.1 go.opencensus.io v0.22.2 diff --git a/go.sum b/go.sum index fbb6922c697..0a04d512df9 100644 --- a/go.sum +++ b/go.sum @@ -102,10 +102,8 @@ github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpi github.com/aws/aws-sdk-go v1.19.45/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.31/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk= -github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.26.7 h1:ObjEnmzvSdYy8KVd3me7v/UMyCn81inLy2SyoIPoBkg= -github.com/aws/aws-sdk-go v1.26.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.28.2 h1:j5IXG9CdyLfcVfICqo1PXVv+rua+QQHbkXuvuU/JF+8= +github.com/aws/aws-sdk-go v1.28.2/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -190,10 +188,8 @@ github.com/cs3org/go-cs3apis v0.0.0-20191128165347-19746c015c83 h1:9bcp1jc6+36XU github.com/cs3org/go-cs3apis v0.0.0-20191128165347-19746c015c83/go.mod h1:IsVGyZrOLUQD48JIhlM/xb3Vz6He5o2+W0ZTfUGY+IU= github.com/cs3org/go-cs3apis v0.0.0-20191218073906-e3405ff6775e h1:cPcpOoPLdsIV2Bw1xMJCIw4ZAejtQqA6J0U56YHOJeQ= github.com/cs3org/go-cs3apis v0.0.0-20191218073906-e3405ff6775e/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva v0.0.2-0.20191217083445-dee8d1c71f95 h1:wrx5iQTS50W4gFDyYfR+kRuVlrSw4oXr22msH+uPjb0= -github.com/cs3org/reva v0.0.2-0.20191217083445-dee8d1c71f95/go.mod h1:lwilkLiV0vnGiyypVxDJZUbGjnAzVo0cgDCKxy/eLpw= -github.com/cs3org/reva v0.0.2-0.20200113091553-573316b69083 h1:Xp7hPQErf6VZa+wLCpz+kNH/NF1MlB7nzWJFmmeJtjE= -github.com/cs3org/reva v0.0.2-0.20200113091553-573316b69083/go.mod h1:tQpaKA+gbZIxWfWjHazXK07EN9eHaB58x4I7HSu3VJw= +github.com/cs3org/reva v0.0.2-0.20200115110931-4c7513415ec5 h1:PkGon9KVtcApu462KRAmFV3iKHOk0S0CRoEzoar4eyE= +github.com/cs3org/reva v0.0.2-0.20200115110931-4c7513415ec5/go.mod h1:Hk3eCcdhtv4eIhKvRK736fQuOyS1HuHnUcz0Dq6NK1A= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -625,20 +621,14 @@ github.com/ory/go-convenience v0.1.0/go.mod h1:uEY/a60PL5c12nYz4V5cHY03IBmwIAEm8 github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ= github.com/owncloud/ocis-graph v0.0.0-20191227120927-91e17d0cdeb1 h1:Zamh3nQI2moI/rfbuNHwog0KXU9osNLVkUM2BfcHA0g= github.com/owncloud/ocis-graph v0.0.0-20191227120927-91e17d0cdeb1/go.mod h1:7fIggCksf10Nlu0KhU9U9KeY+v7n47OHLjWMRrNxlg8= -github.com/owncloud/ocis-hello v0.0.0-20200104020928-c9b97a86a3e9 h1:BAQw8hKbjghqQL8yOHyZywHaT9YMyKxlGqkwx+/daKo= -github.com/owncloud/ocis-hello v0.0.0-20200104020928-c9b97a86a3e9/go.mod h1:hrXqmloO2NHbdkDTPSNneobwzQgki8CUuQD8fqjkPv8= -github.com/owncloud/ocis-hello v0.0.0-20200114071351-901a0c06b94d h1:PJGhG1ZOw0DKQPZc5DO0C8xz3Y7VRxiTELJZlYBRMsE= -github.com/owncloud/ocis-hello v0.0.0-20200114071351-901a0c06b94d/go.mod h1:hrXqmloO2NHbdkDTPSNneobwzQgki8CUuQD8fqjkPv8= github.com/owncloud/ocis-hello v0.0.0-20200114093148-2205c2745838 h1:kG/H/Ey6sqU6xIzsDtZEpR321NlyPrsxPKrDAe9sbY0= github.com/owncloud/ocis-hello v0.0.0-20200114093148-2205c2745838/go.mod h1:hrXqmloO2NHbdkDTPSNneobwzQgki8CUuQD8fqjkPv8= github.com/owncloud/ocis-konnectd v0.0.0-20191227185917-046fec203337 h1:ZGqMcrWZgGoH+jztjSFvzAJGw3lsG2/jjZQioV4ZcDY= github.com/owncloud/ocis-konnectd v0.0.0-20191227185917-046fec203337/go.mod h1:b9DxRrJvAsmFzoB/ETqNPAaRIGlkUwXSCM0Z7rF84m4= github.com/owncloud/ocis-ocs v0.0.0-20191224113758-20455a2e9013 h1:NZnmuAzcXmOM7AXgFVjdWFBQHzM1LpjXxaZOTriTe6U= github.com/owncloud/ocis-ocs v0.0.0-20191224113758-20455a2e9013/go.mod h1:uxMnXanRGabyExSbqGTkMTWVriv3HrdSivUfh2lxozE= -github.com/owncloud/ocis-phoenix v0.0.0-20200113080457-21e730fd76fa h1:SjMcrp6MvBss0QfCuqIOXj7xT2shzo9GuKhUagmwnLo= -github.com/owncloud/ocis-phoenix v0.0.0-20200113080457-21e730fd76fa/go.mod h1:xPa4BmtS+Hcsgx5veyfNxeLnjqitXJ7YRWLR2ZJg91A= -github.com/owncloud/ocis-phoenix v0.0.0-20200114152828-8b3ea4082472 h1:GE3XDooXErPaC3tGa/c/M4710OPqzIuETYhsrJROiqI= -github.com/owncloud/ocis-phoenix v0.0.0-20200114152828-8b3ea4082472/go.mod h1:xPa4BmtS+Hcsgx5veyfNxeLnjqitXJ7YRWLR2ZJg91A= +github.com/owncloud/ocis-phoenix v0.0.0-20200117091807-bab3638b2acc h1:TwiydBSuMt4myFVHFPxJBpJb46qMphvReO4hBbP2KpQ= +github.com/owncloud/ocis-phoenix v0.0.0-20200117091807-bab3638b2acc/go.mod h1:fpMuOPTPkDcdvqFRpiHvlq56kNpa35HeqckmEJlj50M= github.com/owncloud/ocis-pkg v1.1.0/go.mod h1:EfbeXoe60Me2lB/AWjYl8UFNv4isqCPP6lokd5R7nyM= github.com/owncloud/ocis-pkg v1.2.0 h1:eP0AOSEXAgiblL2yOpNOmriKhDXN+mai+4belBJRkWU= github.com/owncloud/ocis-pkg v1.2.0/go.mod h1:EfbeXoe60Me2lB/AWjYl8UFNv4isqCPP6lokd5R7nyM= @@ -647,8 +637,8 @@ github.com/owncloud/ocis-pkg v1.2.1-0.20191217084055-eab942498596 h1:3aMNmuDCIdK github.com/owncloud/ocis-pkg v1.2.1-0.20191217084055-eab942498596/go.mod h1:Wo0QfOmhadh2vNcUoQIsw2yaOT3zeftk+xaOOwP3y88= github.com/owncloud/ocis-pkg v1.2.1-0.20200115112437-3dd614fdcd51 h1:K720zP/n/8Y451mz3tSUAz4JkarK0GBqbF1A3i3294M= github.com/owncloud/ocis-pkg v1.2.1-0.20200115112437-3dd614fdcd51/go.mod h1:Wo0QfOmhadh2vNcUoQIsw2yaOT3zeftk+xaOOwP3y88= -github.com/owncloud/ocis-reva v0.0.0-20200107084202-6cc46af428bf h1:JRJsRWRvLmxxR5f8I4tlkLlN1ALWY7Db9LoBndlR/cc= -github.com/owncloud/ocis-reva v0.0.0-20200107084202-6cc46af428bf/go.mod h1:wCErA+9UG1jHQa6EnS3gHY+5FGpTiUwfFfQzY+xZtpM= +github.com/owncloud/ocis-reva v0.0.0-20200117091331-9a63eaa1173d h1:SRe5xFFXFtHqWCkFcXhPolHJDQbkGiAy0sFqAYLEykY= +github.com/owncloud/ocis-reva v0.0.0-20200117091331-9a63eaa1173d/go.mod h1:Wdb8J9mJhSmpWDP5kbla7pILKMxP9dIsxrc0FIaQD1s= github.com/owncloud/ocis-webdav v0.0.0-20191227185841-c5c77e241249 h1:CuQ+tn5yTZHs2GgAI/VxgbuEnMtSuCPyuJucQB9usiI= github.com/owncloud/ocis-webdav v0.0.0-20191227185841-c5c77e241249/go.mod h1:2lMqOO/rcHqn5V4/W8pOSemqwnogUnrfBR5m6a/VZJc= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= @@ -671,6 +661,8 @@ github.com/pierrec/lz4 v2.2.6+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/xattr v0.4.1 h1:dhclzL6EqOXNaPDWqoeb9tIxATfBSmjqL0b4DpSjwRw= github.com/pkg/xattr v0.4.1/go.mod h1:W2cGD0TBEus7MkUgv0tNZ9JutLtVO3cXu+IBRuHqnFs= diff --git a/pkg/command/phoenix_ocis.go b/pkg/command/phoenix_ocis.go index c1894466a5b..781fb04eafc 100644 --- a/pkg/command/phoenix_ocis.go +++ b/pkg/command/phoenix_ocis.go @@ -3,8 +3,6 @@ package command import ( - "os" - svcconfig "github.com/owncloud/ocis-phoenix/pkg/config" "github.com/owncloud/ocis/pkg/config" ) @@ -14,15 +12,8 @@ func configurePhoenix(cfg *config.Config) *svcconfig.Config { cfg.Phoenix.Log.Pretty = cfg.Log.Pretty cfg.Phoenix.Log.Color = cfg.Log.Color - if len(os.Getenv("PHOENIX_OIDC_METADATA_URL")) == 0 { - os.Setenv("PHOENIX_OIDC_METADATA_URL", "http://localhost:20080/.well-known/openid-configuration") - } - if len(os.Getenv("PHOENIX_OIDC_AUTHORITY")) == 0 { - os.Setenv("PHOENIX_OIDC_AUTHORITY", "http://localhost:20080") - } - if len(os.Getenv("PHOENIX_WEB_CONFIG_SERVER")) == 0 { - os.Setenv("PHOENIX_WEB_CONFIG_SERVER", "http://localhost:20080") - } + // disable ocis-hello extension + cfg.Phoenix.Phoenix.Config.ExternalApps = []svcconfig.ExternalApp{} return cfg.Phoenix } diff --git a/pkg/command/phoenix_simple.go b/pkg/command/phoenix_simple.go index e56969635c2..d7aeb0ea63c 100644 --- a/pkg/command/phoenix_simple.go +++ b/pkg/command/phoenix_simple.go @@ -3,8 +3,6 @@ package command import ( - "os" - svcconfig "github.com/owncloud/ocis-phoenix/pkg/config" "github.com/owncloud/ocis/pkg/config" ) @@ -13,24 +11,13 @@ func configurePhoenix(cfg *config.Config) *svcconfig.Config { cfg.Phoenix.Log.Level = cfg.Log.Level cfg.Phoenix.Log.Pretty = cfg.Log.Pretty cfg.Phoenix.Log.Color = cfg.Log.Color - - // TODO they will be overriden in the extensions service.Init(), tracked in https://github.com/owncloud/ocis/issues/81 - //cfg.Phoenix.Phoenix.Config.OpenIDConnect.Authority = "http://localhost:9135" - //cfg.Phoenix.Phoenix.Config.OpenIDConnect.MetadataURL = "http://localhost:9135/.well-known/openid-configuration" - - if len(os.Getenv("PHOENIX_OIDC_METADATA_URL")) == 0 { - os.Setenv("PHOENIX_OIDC_METADATA_URL", "http://localhost:9135/.well-known/openid-configuration") - } - if len(os.Getenv("PHOENIX_OIDC_AUTHORITY")) == 0 { - os.Setenv("PHOENIX_OIDC_AUTHORITY", "http://localhost:9135") - } // disable built in apps cfg.Phoenix.Phoenix.Config.Apps = []string{} // enable ocis-hello extension cfg.Phoenix.Phoenix.Config.ExternalApps = []svcconfig.ExternalApp{ svcconfig.ExternalApp{ - ID: "hello", + ID: "hello", Path: "http://localhost:9105/hello.js", Config: map[string]interface{}{ "url": "http://localhost:9105", diff --git a/pkg/command/reva.go b/pkg/command/reva.go deleted file mode 100644 index 070b796f664..00000000000 --- a/pkg/command/reva.go +++ /dev/null @@ -1,31 +0,0 @@ -package command - -import ( - "github.com/micro/cli" - "github.com/owncloud/ocis-reva/pkg/command" - "github.com/owncloud/ocis-reva/pkg/flagset" - "github.com/owncloud/ocis/pkg/config" - "github.com/owncloud/ocis/pkg/register" -) - -// RevaCommand is the entrypoint for the konnectd command. -func RevaCommand(cfg *config.Config) cli.Command { - return cli.Command{ - Name: "reva", - Usage: "Start reva server", - Category: "Extensions", - Flags: flagset.ServerWithConfig(cfg.Reva), - Action: func(c *cli.Context) error { - scfg := configureReva(cfg) - - return cli.HandleAction( - command.Server(scfg).Action, - c, - ) - }, - } -} - -func init() { - register.AddCommand(RevaCommand) -} diff --git a/pkg/command/reva_ocis.go b/pkg/command/reva_ocis.go deleted file mode 100644 index b4d1f048b86..00000000000 --- a/pkg/command/reva_ocis.go +++ /dev/null @@ -1,533 +0,0 @@ -// +build !simple - -package command - -import ( - svcconfig "github.com/owncloud/ocis-reva/pkg/config" - "github.com/owncloud/ocis/pkg/config" -) - -func configureReva(cfg *config.Config) *svcconfig.Config { - cfg.Reva.Log.Level = cfg.Log.Level - cfg.Reva.Log.Pretty = cfg.Log.Pretty - cfg.Reva.Log.Color = cfg.Log.Color - - // reva will use a global namespace, for that to work we need to start three storage providers - // - / for the root listing - // - /home which always points to the users home dir - // - /oc for a global view - // in addition to that we need a frontend with - // - an openid connect provider - // - the webdav api - // - the ocs api - // - the .well-know endpoint for oidc configuration - cfg.Reva.Reva.Configs = map[string]interface{}{ - "frontend": map[string]interface{}{ - "grpc": map[string]interface{}{ - "address": "0.0.0.0:20099", - "services": map[string]interface{}{ - "authprovider": map[string]interface{}{ - "auth_manager": "oidc", - "auth_managers": map[string]interface{}{ - "oidc": map[string]interface{}{ - "issuer": "http://localhost:20080", - }, - }, - }, - }, - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - }, - "http": map[string]interface{}{ - "address": "0.0.0.0:20080", - "middlewares": map[string]interface{}{ - "auth": map[string]interface{}{ - "gateway": "localhost:19000", - "credential_chain": []string{"basic", "bearer"}, - "token_strategy": "header", - "token_writer": "header", - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - "cors": map[string]interface{}{ - "allowed_origins": []string{"*"}, - "allowed_methods": []string{ - "OPTIONS", - "GET", - "PUT", - "POST", - "DELETE", - "MKCOL", - "PROPFIND", - "PROPPATCH", - "MOVE", - "COPY", - "REPORT", - "SEARCH", - }, - "allowed_headers": []string{ - "Origin", - "Accept", - "Depth", - "Content-Type", - "X-Requested-With", - "Authorization", - "Ocs-Apirequest", - "If-Match", - "If-None-Match", - "Destination", - "Overwrite", - }, - "allow_credentials": true, - "options_passthrough": false, - }, - }, - "services": map[string]interface{}{ - "wellknown": map[string]interface{}{ - "issuer": "http://localhost:20080", - "authorization_endpoint": "http://localhost:20080/oauth2/auth", - "token_endpoint": "http://localhost:20080/oauth2/token", - "revocation_endpoint": "http://localhost:20080/oauth2/auth", - "introspection_endpoint": "http://localhost:20080/oauth2/introspect", - "userinfo_endpoint": "http://localhost:20080/oauth2/userinfo", - }, - "oidcprovider": map[string]interface{}{ - "prefix": "oauth2", - "gateway": "localhost:19000", - "issuer": "http://localhost:20080", - "clients": map[string]interface{}{ - "phoenix": map[string]interface{}{ - "id": "phoenix", - "redirect_uris": []string{"http://localhost:9100/oidc-callback.html", "http://localhost:9100/"}, - "grant_types": []string{"implicit", "refresh_token", "authorization_code", "password", "client_credentials"}, - "response_types": []string{"code"}, // use authorization code flow, see https://developer.okta.com/blog/2019/05/01/is-the-oauth-implicit-flow-dead for details - "scopes": []string{"openid", "profile", "email", "offline"}, - "public": true, // force PKCS for public clients - }, - // TODO add cli command for token fetching - "cli": map[string]interface{}{ - "id": "cli", - "client_secret": "$2a$10$IxMdI6d.LIRZPpSfEwNoeu4rY3FhDREsxFJXikcgdRRAStxUlsuEO", // = "foobar" - // use hardcoded port credentials for cli - "redirect_uris": []string{"http://localhost:18080/callback"}, - "grant_types": []string{"implicit", "refresh_token", "authorization_code", "password", "client_credentials"}, - "response_types": []string{"code"}, // use authorization code flow, see https://developer.okta.com/blog/2019/05/01/is-the-oauth-implicit-flow-dead for details - "scopes": []string{"openid", "profile", "email", "offline"}, - }, - }, - }, - "ocdav": map[string]interface{}{ - "prefix": "", - "chunk_folder": "/var/tmp/revad/chunks", - "gateway": "localhost:19000", - "files_namespace": "/", - "webdav_namespace": "/", - }, - "ocs": map[string]interface{}{ - "gateway": "localhost:19000", - "config": map[string]interface{}{ - "version": "1.8", - "website": "reva", - "host": "http://localhost:20080", - "contact": "admin@localhost", - "ssl": "false", - }, - "capabilities": map[string]interface{}{ - "capabilities": map[string]interface{}{ - "core": map[string]interface{}{ - "poll_interval": 60, - "webdav_root": "remote.php/webdav", - "status": map[string]interface{}{ - "installed": true, - "maintenance": false, - "needsDbUpgrade": false, - "version": "10.0.11.5", - "versionstring": "10.0.11", - "edition": "community", - "productname": "reva", - "hostname": "", - }, - }, - "checksums": map[string]interface{}{ - "supported_types": []string{"SHA256"}, - "preferred_upload_type": "SHA256", - }, - "files": map[string]interface{}{ - "private_links": false, - "bigfilechunking": false, - "blacklisted_files": []string{}, - "undelete": true, - "versioning": true, - }, - "dav": map[string]interface{}{ - "chunking": "1.0", - }, - "files_sharing": map[string]interface{}{ - "api_enabled": true, - "resharing": true, - "group_sharing": true, - "auto_accept_share": true, - "share_with_group_members_only": true, - "share_with_membership_groups_only": true, - "default_permissions": 22, - "search_min_length": 3, - "public": map[string]interface{}{ - "enabled": true, - "send_mail": true, - "social_share": true, - "upload": true, - "multiple": true, - "supports_upload_only": true, - "password": map[string]interface{}{ - "enforced": true, - "enforced_for": map[string]interface{}{ - "read_only": true, - "read_write": true, - "upload_only": true, - }, - }, - "expire_date": map[string]interface{}{ - "enabled": true, - }, - }, - "user": map[string]interface{}{ - "send_mail": true, - }, - "user_enumeration": map[string]interface{}{ - "enabled": true, - "group_members_only": true, - }, - "federation": map[string]interface{}{ - "outgoing": true, - "incoming": true, - }, - }, - "notifications": map[string]interface{}{ - "endpoints": []string{"list", "get", "delete"}, - }, - }, - "version": map[string]interface{}{ - "edition": "reva", - "major": 10, - "minor": 0, - "micro": 11, - "string": "10.0.11", - }, - }, - }, - }, - }, - }, - "gateway": map[string]interface{}{ - "grpc": map[string]interface{}{ - "address": "0.0.0.0:19000", - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "gateway": map[string]interface{}{ - // registries - "authregistrysvc": "localhost:19000", - "storageregistrysvc": "localhost:19000", - "appregistrysvc": "localhost:19000", - // user metadata - "preferencessvc": "localhost:18000", - "userprovidersvc": "localhost:18000", - // sharing - "usershareprovidersvc": "localhost:17000", - "publicshareprovidersvc": "localhost:17000", - "ocmshareprovidersvc": "localhost:17000", - "commit_share_to_storage_grant": true, - // other - "datagateway": "http://localhost:19001/data", - "transfer_shared_secret": "replace-me-with-a-transfer-secret", - "transfer_expires": 6, // give it a moment - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - "authregistry": map[string]interface{}{ - "driver": "static", - "drivers": map[string]interface{}{ - "static": map[string]interface{}{ - "rules": map[string]interface{}{ - "basic": "localhost:18000", - "bearer": "localhost:20099", - }, - }, - }, - }, - "storageregistry": map[string]interface{}{ - "driver": "static", - "drivers": map[string]interface{}{ - "static": map[string]interface{}{ - "rules": map[string]interface{}{ - "/home": "localhost:12000", - "/oc": "localhost:11000", - "123e4567-e89b-12d3-a456-426655440000": "localhost:11000", - "/": "localhost:11100", - "123e4567-e89b-12d3-a456-426655440001": "localhost:11100", - }, - }, - }, - }, - }, - }, - "http": map[string]interface{}{ - "address": "0.0.0.0:19001", - "middlewares": map[string]interface{}{ - "auth": map[string]interface{}{ - "gateway": "localhost:19000", - "credential_chain": []string{"basic", "bearer"}, - "token_strategy": "header", - "token_writer": "header", - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "datagateway": map[string]interface{}{ - "prefix": "data", - "gateway": "", - "transfer_shared_secret": "replace-me-with-a-transfer-secret", - }, - }, - }, - }, - "shares": map[string]interface{}{ - "grpc": map[string]interface{}{ - "address": "0.0.0.0:17000", - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "usershareprovider": map[string]interface{}{ - "driver": "memory", - }, - "publicshareprovider": map[string]interface{}{ - "driver": "memory", - }, - }, - }, - }, - "storage-home": map[string]interface{}{ - "grpc": map[string]interface{}{ - "address": "0.0.0.0:12000", - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "storageprovider": map[string]interface{}{ - "driver": "owncloud", - "drivers": map[string]interface{}{ - "owncloud": map[string]interface{}{ - "datadirectory": "/var/tmp/reva/data", - }, - }, - "path_wrapper": "context", - "path_wrappers": map[string]interface{}{ - "context": map[string]interface{}{ - "prefix": "", - }, - }, - "mount_path": "/home", - "mount_id": "123e4567-e89b-12d3-a456-426655440000", - "expose_data_server": true, - "data_server_url": "http://localhost:12001/data", - "available_checksums": map[string]interface{}{ - "md5": 100, - "unset": 1000, - }, - }, - }, - }, - "http": map[string]interface{}{ - "address": "0.0.0.0:12001", - "middlewares": map[string]interface{}{ - "auth": map[string]interface{}{ - "gateway": "localhost:19000", - "credential_chain": []string{"basic", "bearer"}, - "token_strategy": "header", - "token_writer": "header", - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "dataprovider": map[string]interface{}{ - "prefix": "data", - "driver": "owncloud", - "drivers": map[string]interface{}{ - "owncloud": map[string]interface{}{ - "datadirectory": "/var/tmp/reva/data", - }, - }, - "temp_folder": "/var/tmp/", - }, - }, - }, - }, - "storage-oc": map[string]interface{}{ - "grpc": map[string]interface{}{ - "address": "0.0.0.0:11000", - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "storageprovider": map[string]interface{}{ - "driver": "owncloud", - "drivers": map[string]interface{}{ - "owncloud": map[string]interface{}{ - "datadirectory": "/var/tmp/reva/data", - }, - }, - "mount_path": "/oc", - "mount_id": "123e4567-e89b-12d3-a456-426655440000", - "expose_data_server": true, - "data_server_url": "http://localhost:11001/data", - "available_checksums": map[string]interface{}{ - "md5": 100, - "unset": 1000, - }, - }, - }, - }, - "http": map[string]interface{}{ - "address": "0.0.0.0:11001", - "middlewares": map[string]interface{}{ - "auth": map[string]interface{}{ - "gateway": "localhost:19000", - "credential_chain": []string{"basic", "bearer"}, - "token_strategy": "header", - "token_writer": "header", - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "dataprovider": map[string]interface{}{ - "prefix": "data", - "driver": "owncloud", - "drivers": map[string]interface{}{ - "owncloud": map[string]interface{}{ - "datadirectory": "/var/tmp/reva/data", - }, - }, - "temp_folder": "/var/tmp/", - }, - }, - }, - }, - "storage-root": map[string]interface{}{ - "grpc": map[string]interface{}{ - "address": "0.0.0.0:11100", - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "storageprovider": map[string]interface{}{ - "driver": "local", - "drivers": map[string]interface{}{ - "local": map[string]interface{}{ - "root": "/var/tmp/reva/root", - }, - }, - "mount_path": "/", - "mount_id": "123e4567-e89b-12d3-a456-426655440001", - "available_checksums": map[string]interface{}{ - "md5": 100, - "unset": 1000, - }, - }, - }, - }, - }, - "users": map[string]interface{}{ - "grpc": map[string]interface{}{ - "address": "0.0.0.0:18000", - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - }, - "services": map[string]interface{}{ - "authprovider": map[string]interface{}{ - "auth_manager": "demo", - }, - "userprovider": map[string]interface{}{ - "driver": "demo", - }, - }, - }, - }, - } - - return cfg.Reva -} diff --git a/pkg/command/reva_simple.go b/pkg/command/reva_simple.go deleted file mode 100644 index 446a43bf60d..00000000000 --- a/pkg/command/reva_simple.go +++ /dev/null @@ -1,263 +0,0 @@ -// +build simple - -package command - -import ( - svcconfig "github.com/owncloud/ocis-reva/pkg/config" - "github.com/owncloud/ocis/pkg/config" -) - -func configureReva(cfg *config.Config) *svcconfig.Config { - cfg.Reva.Log.Level = cfg.Log.Level - cfg.Reva.Log.Pretty = cfg.Log.Pretty - cfg.Reva.Log.Color = cfg.Log.Color - - cfg.Reva.Reva.Configs = map[string]interface{}{ - "oidcprovider": map[string]interface{}{ - "core": map[string]interface{}{ - "max_cpus": cfg.Reva.Reva.MaxCPUs, - "tracing_enabled": cfg.Reva.Tracing.Enabled, - "tracing_endpoint": cfg.Reva.Tracing.Endpoint, - "tracing_collector": cfg.Reva.Tracing.Collector, - "tracing_service_name": cfg.Reva.Tracing.Service, - }, - "log": map[string]interface{}{ - "level": cfg.Reva.Reva.LogLevel, - //TODO mode = "console" # "console" or "json" - //TODO output = "./standalone.log" - }, - "http": map[string]interface{}{ - "network": cfg.Reva.Reva.HTTP.Network, - "address": cfg.Reva.Reva.HTTP.Addr, - "enabled_services": []string{ - "oidcprovider", - "wellknown", - "prometheus", - "ocs", // TODO remove when phoenix no longer tries to fetch the capabilities - }, - "enabled_middlewares": []string{ - "cors", - "auth", - }, - "middlewares": map[string]interface{}{ - "auth": map[string]interface{}{ - "gateway": cfg.Reva.Reva.GRPC.Addr, - "credential_chain": []string{"basic", "bearer"}, - "token_strategy": "header", - "token_writer": "header", - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - "skip_methods": []string{ - "/favicon.ico", - "/oauth2", - "/.well-known", - "/metrics", // for prometheus metrics - }, - }, - "cors": map[string]interface{}{ - "allowed_origins": []string{"*"}, - "allowed_methods": []string{ - "OPTIONS", - "GET", - "PUT", - "POST", - "DELETE", - "MKCOL", - "PROPFIND", - "PROPPATCH", - "MOVE", - "COPY", - "REPORT", - "SEARCH", - }, - "allowed_headers": []string{ - "Origin", - "Accept", - "Depth", - "Content-Type", - "X-Requested-With", - "Authorization", - "Ocs-Apirequest", - "If-Match", - "If-None-Match", - "Destination", - "Overwrite", - }, - "allow_credentials": true, - "options_passthrough": false, - }, - }, - "services": map[string]interface{}{ - // TODO investigate: service must be here as well, otherwise eg wellknown won't get started - // TODO we hardcoded the url because the config option is used to tell the server which address to bind to, - // which is 0.0.0.0:9135 by default, but the iss needs to use a hostname - "wellknown": map[string]interface{}{ - "prefix": ".well-known", - "issuer": "http://localhost:9135", - "authorization_endpoint": "http://localhost:9135/oauth2/auth", - "token_endpoint": "http://localhost:9135/oauth2/token", - "revocation_endpoint": "http://localhost:9135/oauth2/auth", - "introspection_endpoint": "http://localhost:9135/oauth2/introspect", - "userinfo_endpoint": "http://localhost:9135/oauth2/userinfo", - }, - "oidcprovider": map[string]interface{}{ - "prefix": "oauth2", - "gateway": cfg.Reva.Reva.GRPC.Addr, - "auth_type": "basic", - // TODO we hardcoded the url because the config option is used to tell the server which address to bind to, - // which is 0.0.0.0:9135 by default, but the iss needs to use a hostname - "issuer": "http://localhost:9135", - "clients": map[string]interface{}{ - "phoenix": map[string]interface{}{ - "id": "phoenix", - // use ocis port range for phoenix - // TODO should use the micro / ocis http gateway, but then it would no longer be able to run standalone - // IMO the ports should be fetched from the ocis registry anyway - "redirect_uris": []string{"http://localhost:9100/oidc-callback.html", "http://localhost:9100/"}, - "grant_types": []string{"implicit", "refresh_token", "authorization_code", "password", "client_credentials"}, - "response_types": []string{"code"}, // use authorization code flow, see https://developer.okta.com/blog/2019/05/01/is-the-oauth-implicit-flow-dead for details - "scopes": []string{"openid", "profile", "email", "offline"}, - "public": true, // force PKCS for public clients - }, - "cli": map[string]interface{}{ - "id": "cli", - "client_secret": "$2a$10$IxMdI6d.LIRZPpSfEwNoeu4rY3FhDREsxFJXikcgdRRAStxUlsuEO", // = "foobar" - // use hardcoded port credentials for cli - "redirect_uris": []string{"http://localhost:18080/callback"}, - "grant_types": []string{"implicit", "refresh_token", "authorization_code", "password", "client_credentials"}, - "response_types": []string{"code"}, // use authorization code flow, see https://developer.okta.com/blog/2019/05/01/is-the-oauth-implicit-flow-dead for details - "scopes": []string{"openid", "profile", "email", "offline"}, - }, - }, - }, - "ocs": map[string]interface{}{ - "prefix": "ocs", - "gateway": cfg.Reva.Reva.GRPC.Addr, - }, - }, - }, - "grpc": map[string]interface{}{ - "network": cfg.Reva.Reva.GRPC.Network, - "address": cfg.Reva.Reva.GRPC.Addr, - "enabled_services": []string{ - "authprovider", // provides basic auth - "userprovider", // provides user matadata (used to look up email, displayname etc after a login) - "gateway", // to lookup services and authenticate requests - "authregistry", // used by the gateway to look up auth providers - }, - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - "skip_methods": []string{ - // we need to allow calls that happen during authentication - "/cs3.auth.registry.v1beta1.RegistryAPI/GetAuthProvider", - "/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate", - "/cs3.gateway.v1beta1.GatewayAPI/Authenticate", - "/cs3.identity.user.v1beta1.UserAPI/GetUser", - "/cs3.gateway.v1beta1.GatewayAPI/GetUser", - }, - }, - }, - "services": map[string]interface{}{ - "gateway": map[string]interface{}{ - "authregistrysvc": cfg.Reva.Reva.GRPC.Addr, - "storageregistrysvc": cfg.Reva.Reva.GRPC.Addr, - "appregistrysvc": cfg.Reva.Reva.GRPC.Addr, - "preferencessvc": cfg.Reva.Reva.GRPC.Addr, - "usershareprovidersvc": cfg.Reva.Reva.GRPC.Addr, - "publicshareprovidersvc": cfg.Reva.Reva.GRPC.Addr, - "ocmshareprovidersvc": cfg.Reva.Reva.GRPC.Addr, - "userprovidersvc": cfg.Reva.Reva.GRPC.Addr, - "commit_share_to_storage_grant": true, - "datagateway": "http://" + cfg.Reva.Reva.HTTP.Addr + "/data", - "transfer_shared_secret": "replace-me-with-a-transfer-secret", - "transfer_expires": 6, // give it a moment - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - }, - "authregistry": map[string]interface{}{ - "driver": "static", - "drivers": map[string]interface{}{ - "static": map[string]interface{}{ - "rules": map[string]interface{}{ - "basic": cfg.Reva.Reva.GRPC.Addr, - "bearer": "localhost:9138", - }, - }, - }, - }, - "authprovider": map[string]interface{}{ - "auth_manager": "demo", - "userprovidersvc": cfg.Reva.Reva.GRPC.Addr, - }, - "userprovider": map[string]interface{}{ - "driver": "demo", - }, - }, - }, - }, - "oidcauthprovider": map[string]interface{}{ - "core": map[string]interface{}{ - "max_cpus": cfg.Reva.Reva.MaxCPUs, - "tracing_enabled": cfg.Reva.Tracing.Enabled, - "tracing_endpoint": cfg.Reva.Tracing.Endpoint, - "tracing_collector": cfg.Reva.Tracing.Collector, - "tracing_service_name": cfg.Reva.Tracing.Service, - }, - "log": map[string]interface{}{ - "level": cfg.Reva.Reva.LogLevel, - //TODO mode = "console" # "console" or "json" - //TODO output = "./standalone.log" - }, - "grpc": map[string]interface{}{ - "network": cfg.Reva.Reva.GRPC.Network, - "address": "localhost:9138", // use another port - "enabled_services": []string{ - "authprovider", // provides oidc auth - }, - "interceptors": map[string]interface{}{ - "auth": map[string]interface{}{ - "token_manager": "jwt", - "token_managers": map[string]interface{}{ - "jwt": map[string]interface{}{ - "secret": cfg.Reva.Reva.JWTSecret, - }, - }, - "skip_methods": []string{ - "/cs3.auth.registry.v1beta1.RegistryAPI/GetAuthProvider", - "/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate", - }, - }, - }, - "services": map[string]interface{}{ - "authprovider": map[string]interface{}{ - "auth_manager": "oidc", - "userprovidersvc": cfg.Reva.Reva.GRPC.Addr, - "auth_managers": map[string]interface{}{ - "oidc": map[string]interface{}{ - // TODO we hardcoded the url because the config option is used to tell the server which address to bind to, - // which is 0.0.0.0:9135 by default, but the iss needs to use a hostname - "issuer": "http://localhost:9135", - }, - }, - }, - }, - }, - }, - } - - return cfg.Reva -} diff --git a/pkg/command/revaauthbasic.go b/pkg/command/revaauthbasic.go new file mode 100644 index 00000000000..c44c32e7493 --- /dev/null +++ b/pkg/command/revaauthbasic.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaAuthBasicCommand is the entrypoint for the reva-auth-basic command. +func RevaAuthBasicCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-auth-basic", + Usage: "Start reva auth-basic service", + Category: "Extensions", + Flags: flagset.AuthBasicWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaAuthBasic(cfg) + + return cli.HandleAction( + command.AuthBasic(scfg).Action, + c, + ) + }, + } +} + +func configureRevaAuthBasic(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaAuthBasicCommand) +} diff --git a/pkg/command/revaauthbearer.go b/pkg/command/revaauthbearer.go new file mode 100644 index 00000000000..4f11179dd07 --- /dev/null +++ b/pkg/command/revaauthbearer.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaAuthBearerCommand is the entrypoint for the reva-auth-bearer command. +func RevaAuthBearerCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-auth-bearer", + Usage: "Start reva auth-bearer service", + Category: "Extensions", + Flags: flagset.AuthBearerWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaAuthBearer(cfg) + + return cli.HandleAction( + command.AuthBearer(scfg).Action, + c, + ) + }, + } +} + +func configureRevaAuthBearer(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaAuthBearerCommand) +} diff --git a/pkg/command/revafrontend.go b/pkg/command/revafrontend.go new file mode 100644 index 00000000000..1eb1285b935 --- /dev/null +++ b/pkg/command/revafrontend.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaFrontendCommand is the entrypoint for the reva-frontend command. +func RevaFrontendCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-frontend", + Usage: "Start reva frontend", + Category: "Extensions", + Flags: flagset.FrontendWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaFrontend(cfg) + + return cli.HandleAction( + command.Frontend(scfg).Action, + c, + ) + }, + } +} + +func configureRevaFrontend(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaFrontendCommand) +} diff --git a/pkg/command/revagateway.go b/pkg/command/revagateway.go new file mode 100644 index 00000000000..82b44b35244 --- /dev/null +++ b/pkg/command/revagateway.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaGatewayCommand is the entrypoint for the reva-gateway command. +func RevaGatewayCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-gateway", + Usage: "Start reva gateway", + Category: "Extensions", + Flags: flagset.GatewayWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaGateway(cfg) + + return cli.HandleAction( + command.Gateway(scfg).Action, + c, + ) + }, + } +} + +func configureRevaGateway(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaGatewayCommand) +} diff --git a/pkg/command/revasharing.go b/pkg/command/revasharing.go new file mode 100644 index 00000000000..e1367f94b3e --- /dev/null +++ b/pkg/command/revasharing.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaSharingCommand is the entrypoint for the reva-sharing command. +func RevaSharingCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-sharing", + Usage: "Start reva sharing service", + Category: "Extensions", + Flags: flagset.SharingWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaSharing(cfg) + + return cli.HandleAction( + command.Sharing(scfg).Action, + c, + ) + }, + } +} + +func configureRevaSharing(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaSharingCommand) +} diff --git a/pkg/command/revastoragehome.go b/pkg/command/revastoragehome.go new file mode 100644 index 00000000000..1d9ffaa5fef --- /dev/null +++ b/pkg/command/revastoragehome.go @@ -0,0 +1,42 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaStorageHomeCommand is the entrypoint for the reva-storage-home command. +func RevaStorageHomeCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-storage-home", + Usage: "Start reva home storage", + Category: "Extensions", + Flags: flagset.StorageHomeWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaStorageHome(cfg) + + return cli.HandleAction( + command.StorageHome(scfg).Action, + c, + ) + }, + } +} + +func configureRevaStorageHome(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + cfg.Reva.Reva.StorageHome.ExposeDataServer = true + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaStorageHomeCommand) +} diff --git a/pkg/command/revastoragehomedata.go b/pkg/command/revastoragehomedata.go new file mode 100644 index 00000000000..3f5c10d1df6 --- /dev/null +++ b/pkg/command/revastoragehomedata.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaStorageHomeDataCommand is the entrypoint for the reva-storage-home-data command. +func RevaStorageHomeDataCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-storage-home-data", + Usage: "Start reva home storage dataprovider", + Category: "Extensions", + Flags: flagset.StorageHomeDataWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaStorageHomeData(cfg) + + return cli.HandleAction( + command.StorageHomeData(scfg).Action, + c, + ) + }, + } +} + +func configureRevaStorageHomeData(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaStorageHomeDataCommand) +} diff --git a/pkg/command/revastorageoc.go b/pkg/command/revastorageoc.go new file mode 100644 index 00000000000..9b5f8d76fcd --- /dev/null +++ b/pkg/command/revastorageoc.go @@ -0,0 +1,42 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaStorageOCCommand is the entrypoint for the reva-storage-oc command. +func RevaStorageOCCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-storage-oc", + Usage: "Start reva oc storage", + Category: "Extensions", + Flags: flagset.StorageOCWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaStorageOC(cfg) + + return cli.HandleAction( + command.StorageOC(scfg).Action, + c, + ) + }, + } +} + +func configureRevaStorageOC(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + cfg.Reva.Reva.StorageOC.ExposeDataServer = true + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaStorageOCCommand) +} diff --git a/pkg/command/revastorageocdata.go b/pkg/command/revastorageocdata.go new file mode 100644 index 00000000000..4e6e82d8c0d --- /dev/null +++ b/pkg/command/revastorageocdata.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaStorageOCDataCommand is the entrypoint for the reva-storage-oc-data command. +func RevaStorageOCDataCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-storage-oc-data", + Usage: "Start reva oc storage dataprovider", + Category: "Extensions", + Flags: flagset.StorageOCDataWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaStorageOCData(cfg) + + return cli.HandleAction( + command.StorageOCData(scfg).Action, + c, + ) + }, + } +} + +func configureRevaStorageOCData(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaStorageOCDataCommand) +} diff --git a/pkg/command/revastorageroot.go b/pkg/command/revastorageroot.go new file mode 100644 index 00000000000..1da639adeb2 --- /dev/null +++ b/pkg/command/revastorageroot.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaStorageRootCommand is the entrypoint for the reva-storage-root command. +func RevaStorageRootCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-storage-root", + Usage: "Start reva root storage", + Category: "Extensions", + Flags: flagset.StorageRootWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaStorageRoot(cfg) + + return cli.HandleAction( + command.StorageRoot(scfg).Action, + c, + ) + }, + } +} + +func configureRevaStorageRoot(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaStorageRootCommand) +} diff --git a/pkg/command/revausers.go b/pkg/command/revausers.go new file mode 100644 index 00000000000..92f27efcdf3 --- /dev/null +++ b/pkg/command/revausers.go @@ -0,0 +1,40 @@ +package command + +import ( + "github.com/micro/cli" + "github.com/owncloud/ocis-reva/pkg/command" + svcconfig "github.com/owncloud/ocis-reva/pkg/config" + "github.com/owncloud/ocis-reva/pkg/flagset" + "github.com/owncloud/ocis/pkg/config" + "github.com/owncloud/ocis/pkg/register" +) + +// RevaUsersCommand is the entrypoint for the reva-users command. +func RevaUsersCommand(cfg *config.Config) cli.Command { + return cli.Command{ + Name: "reva-users", + Usage: "Start reva users service", + Category: "Extensions", + Flags: flagset.UsersWithConfig(cfg.Reva), + Action: func(c *cli.Context) error { + scfg := configureRevaUsers(cfg) + + return cli.HandleAction( + command.Users(scfg).Action, + c, + ) + }, + } +} + +func configureRevaUsers(cfg *config.Config) *svcconfig.Config { + cfg.Reva.Log.Level = cfg.Log.Level + cfg.Reva.Log.Pretty = cfg.Log.Pretty + cfg.Reva.Log.Color = cfg.Log.Color + + return cfg.Reva +} + +func init() { + register.AddCommand(RevaUsersCommand) +} diff --git a/pkg/command/server_simple.go b/pkg/command/server_simple.go index 0bc3ebb2359..a57a3a44ba2 100644 --- a/pkg/command/server_simple.go +++ b/pkg/command/server_simple.go @@ -16,7 +16,15 @@ import ( var ( // SimpleRuntimeServices declares which services will be started for the fullstack server - SimpleRuntimeServices = []string{"hello", "phoenix", "reva"} + SimpleRuntimeServices = []string{ + "hello", + "phoenix", + "reva-frontend", + "reva-gateway", + "reva-users", + "reva-auth-basic", + "reva-auth-bearer", + } ) // Simple is the entrypoint for the server command. It is the `ocis server` subcommand overloaded with a different set of services diff --git a/pkg/micro/runtime/runtime.go b/pkg/micro/runtime/runtime.go index 261566053ee..4d01b6f124b 100644 --- a/pkg/micro/runtime/runtime.go +++ b/pkg/micro/runtime/runtime.go @@ -43,7 +43,17 @@ var Extensions = []string{ "graph", "ocs", "webdav", - "reva", + "reva-frontend", + "reva-gateway", + "reva-users", + "reva-auth-basic", + "reva-auth-bearer", + "reva-sharing", + "reva-storage-root", + "reva-storage-home", + "reva-storage-home-data", + "reva-storage-oc", + "reva-storage-oc-data", } // Runtime is a micro' runtime