Migrate proto files for store and adjust paths

This commit is contained in:
Juan Pablo Villafáñez
2022-01-12 17:59:42 +01:00
parent 2593ff0f70
commit 7bfb6c7d3e
10 changed files with 36 additions and 2169 deletions

View File

@@ -9,6 +9,8 @@ import (
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
storesvc "github.com/owncloud/ocis/protogen/gen/ocis/services/store/v1"
"github.com/coreos/go-oidc/v3/oidc"
"github.com/cs3org/reva/pkg/token/manager/jwt"
chimiddleware "github.com/go-chi/chi/v5/middleware"
@@ -30,7 +32,6 @@ import (
proxyHTTP "github.com/owncloud/ocis/proxy/pkg/server/http"
"github.com/owncloud/ocis/proxy/pkg/tracing"
"github.com/owncloud/ocis/proxy/pkg/user/backend"
storepb "github.com/owncloud/ocis/store/pkg/proto/v0"
"github.com/urfave/cli/v2"
"golang.org/x/oauth2"
)
@@ -152,7 +153,7 @@ func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config)
logger.Fatal().Msgf("Invalid accounts backend type '%s'", cfg.AccountBackend)
}
storeClient := storepb.NewStoreService("com.owncloud.api.store", grpc.DefaultClient)
storeClient := storesvc.NewStoreService("com.owncloud.api.store", grpc.DefaultClient)
if err != nil {
logger.Error().Err(err).
Str("gateway", cfg.Reva.Address).

View File

@@ -8,11 +8,11 @@ import (
accountssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/accounts/v1"
settingssvc "github.com/owncloud/ocis/protogen/gen/ocis/services/settings/v1"
storesvc "github.com/owncloud/ocis/protogen/gen/ocis/services/store/v1"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/proxy/pkg/config"
storepb "github.com/owncloud/ocis/store/pkg/proto/v0"
)
// Option defines a single option function.
@@ -41,7 +41,7 @@ type Options struct {
// RevaGatewayClient to send requests to the reva gateway
RevaGatewayClient gateway.GatewayAPIClient
// Store for persisting data
Store storepb.StoreService
Store storesvc.StoreService
// PreSignedURLConfig to configure the middleware
PreSignedURLConfig config.PreSignedURL
// UserOIDCClaim to read from the oidc claims
@@ -142,7 +142,7 @@ func RevaGatewayClient(gc gateway.GatewayAPIClient) Option {
}
// Store provides a function to set the store option.
func Store(sc storepb.StoreService) Option {
func Store(sc storesvc.StoreService) Option {
return func(o *Options) {
o.Store = sc
}

View File

@@ -13,9 +13,10 @@ import (
revactx "github.com/cs3org/reva/pkg/ctx"
"github.com/owncloud/ocis/ocis-pkg/log"
storemsg "github.com/owncloud/ocis/protogen/gen/ocis/messages/store/v1"
storesvc "github.com/owncloud/ocis/protogen/gen/ocis/services/store/v1"
"github.com/owncloud/ocis/proxy/pkg/config"
"github.com/owncloud/ocis/proxy/pkg/user/backend"
store "github.com/owncloud/ocis/store/pkg/proto/v0"
"golang.org/x/crypto/pbkdf2"
)
@@ -39,7 +40,7 @@ type signedURLAuth struct {
logger log.Logger
preSignedURLConfig config.PreSignedURL
userProvider backend.UserBackend
store store.StoreService
store storesvc.StoreService
}
func (m signedURLAuth) ServeHTTP(w http.ResponseWriter, req *http.Request) {
@@ -197,8 +198,8 @@ func (m signedURLAuth) createSignature(url string, signingKey []byte) string {
}
func (m signedURLAuth) getSigningKey(ctx context.Context, ocisID string) ([]byte, error) {
res, err := m.store.Read(ctx, &store.ReadRequest{
Options: &store.ReadOptions{
res, err := m.store.Read(ctx, &storesvc.ReadRequest{
Options: &storemsg.ReadOptions{
Database: "proxy",
Table: "signing-keys",
},