From 94ee0370cc01afb8162ae9e04675f0c83824d383 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Mon, 24 Jun 2024 12:32:07 +0200 Subject: [PATCH 1/3] utils: Add GetServiceUserToken() Helps to reduce some duplication on the ocis side --- changelog/unreleased/serviceuser-token-utils.md | 6 ++++++ pkg/utils/grpc.go | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/serviceuser-token-utils.md diff --git a/changelog/unreleased/serviceuser-token-utils.md b/changelog/unreleased/serviceuser-token-utils.md new file mode 100644 index 00000000000..ae6dab22a1d --- /dev/null +++ b/changelog/unreleased/serviceuser-token-utils.md @@ -0,0 +1,6 @@ +Enhancement: Add GetServiceUserToken() method to utils pkg + +Added GetServiceUserToken() function to the utils pkg to easily get a reva +token for a service account. + +https://github.com/cs3org/reva/pull/4738 diff --git a/pkg/utils/grpc.go b/pkg/utils/grpc.go index e82e9895366..ffeb38d81e9 100644 --- a/pkg/utils/grpc.go +++ b/pkg/utils/grpc.go @@ -44,20 +44,30 @@ func GetServiceUserContext(serviceUserID string, gwc gateway.GatewayAPIClient, s // GetServiceUserContextWithContext returns an authenticated context of the given service user func GetServiceUserContextWithContext(ctx context.Context, gwc gateway.GatewayAPIClient, serviceUserID string, serviceUserSecret string) (context.Context, error) { + token, err := GetServiceUserToken(ctx, gwc, serviceUserID, serviceUserSecret) + if err != nil { + return nil, err + } + + return metadata.AppendToOutgoingContext(ctx, ctxpkg.TokenHeader, token), nil +} + +// GetServiceUserToken returns a reva authentication token for the given service user +func GetServiceUserToken(ctx context.Context, gwc gateway.GatewayAPIClient, serviceUserID string, serviceUserSecret string) (string, error) { authRes, err := gwc.Authenticate(ctx, &gateway.AuthenticateRequest{ Type: "serviceaccounts", ClientId: serviceUserID, ClientSecret: serviceUserSecret, }) if err != nil { - return nil, err + return "", err } if err := checkStatusCode("authenticating service user", authRes.GetStatus().GetMessage(), authRes.GetStatus().GetCode()); err != nil { - return nil, err + return "", err } - return metadata.AppendToOutgoingContext(ctx, ctxpkg.TokenHeader, authRes.Token), nil + return authRes.Token, nil } // GetUser gets the specified user From 9351da5ba08f56ea5d879e55f7560374d1478445 Mon Sep 17 00:00:00 2001 From: Roman Perekhod <2403905@gmail.com> Date: Tue, 25 Jun 2024 10:53:50 +0200 Subject: [PATCH 2/3] Add the backchannel logout event (#4737) * Add the backchannel logout event * Update pkg/events/users.go Co-authored-by: kobergj --------- Co-authored-by: kobergj --- changelog/unreleased/add-backchannel-event.md | 6 ++++++ pkg/events/users.go | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 changelog/unreleased/add-backchannel-event.md diff --git a/changelog/unreleased/add-backchannel-event.md b/changelog/unreleased/add-backchannel-event.md new file mode 100644 index 00000000000..74aed17b4c9 --- /dev/null +++ b/changelog/unreleased/add-backchannel-event.md @@ -0,0 +1,6 @@ +Enhancement: Add the backchannel logout event + +We've added the backchannel logout event + +https://github.com/cs3org/reva/pull/4737 +https://github.com/owncloud/ocis/issues/9355 diff --git a/pkg/events/users.go b/pkg/events/users.go index 1a118b71993..79ea2add7ec 100644 --- a/pkg/events/users.go +++ b/pkg/events/users.go @@ -88,3 +88,17 @@ func (PersonalDataExtracted) Unmarshal(v []byte) (interface{}, error) { err := json.Unmarshal(v, &e) return e, err } + +// BackchannelLogout is emitted when the callback from the identity provider is received +type BackchannelLogout struct { + Executant *user.UserId + SessionId string + Timestamp *types.Timestamp +} + +// Unmarshal to fulfill umarshaller interface +func (BackchannelLogout) Unmarshal(v []byte) (interface{}, error) { + e := BackchannelLogout{} + err := json.Unmarshal(v, &e) + return e, err +} From a76ce1f704ad8ed21d9eecd7390172505fc6f734 Mon Sep 17 00:00:00 2001 From: jkoberg Date: Wed, 26 Jun 2024 11:19:14 +0200 Subject: [PATCH 3/3] feat(decomposedfs): expose disable-versioning Signed-off-by: jkoberg --- changelog/unreleased/expose-disable-versioning.md | 5 +++++ pkg/storage/utils/decomposedfs/decomposedfs.go | 9 +++++---- pkg/storage/utils/decomposedfs/options/options.go | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 changelog/unreleased/expose-disable-versioning.md diff --git a/changelog/unreleased/expose-disable-versioning.md b/changelog/unreleased/expose-disable-versioning.md new file mode 100644 index 00000000000..ab4bfe8ce8f --- /dev/null +++ b/changelog/unreleased/expose-disable-versioning.md @@ -0,0 +1,5 @@ +Enhancement: Expose disable-versioning configuration option + +This PR exposes the disable-versioning configuration option to the user. This option allows the user to disable versioning for the storage-providers. + +https://github.com/cs3org/reva/pull/4742 diff --git a/pkg/storage/utils/decomposedfs/decomposedfs.go b/pkg/storage/utils/decomposedfs/decomposedfs.go index fd8e9696d18..8b53a82d3b5 100644 --- a/pkg/storage/utils/decomposedfs/decomposedfs.go +++ b/pkg/storage/utils/decomposedfs/decomposedfs.go @@ -157,10 +157,11 @@ func NewDefault(m map[string]interface{}, bs tree.Blobstore, es events.Stream) ( } aspects := aspects.Aspects{ - Lookup: lu, - Tree: tp, - Permissions: permissions.NewPermissions(node.NewPermissions(lu), permissionsSelector), - EventStream: es, + Lookup: lu, + Tree: tp, + Permissions: permissions.NewPermissions(node.NewPermissions(lu), permissionsSelector), + EventStream: es, + DisableVersioning: o.DisableVersioning, } return New(o, aspects) diff --git a/pkg/storage/utils/decomposedfs/options/options.go b/pkg/storage/utils/decomposedfs/options/options.go index e68bd73d066..61355c935e4 100644 --- a/pkg/storage/utils/decomposedfs/options/options.go +++ b/pkg/storage/utils/decomposedfs/options/options.go @@ -90,6 +90,8 @@ type Options struct { MaxConcurrency int `mapstructure:"max_concurrency"` MaxQuota uint64 `mapstructure:"max_quota"` + + DisableVersioning bool `mapstructure:"disable_versioning"` } // AsyncPropagatorOptions holds the configuration for the async propagator