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/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/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/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 +} 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 9e2b4036686..b8b3809f4ec 100644 --- a/pkg/storage/utils/decomposedfs/options/options.go +++ b/pkg/storage/utils/decomposedfs/options/options.go @@ -92,6 +92,8 @@ type Options struct { MaxQuota uint64 `mapstructure:"max_quota"` MountID string `mapstructure:"mount_id"` + + DisableVersioning bool `mapstructure:"disable_versioning"` } // AsyncPropagatorOptions holds the configuration for the async propagator 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