diff --git a/changelog/unreleased/gdpr-export.md b/changelog/unreleased/gdpr-export.md index 9d6740f55..467f93c43 100644 --- a/changelog/unreleased/gdpr-export.md +++ b/changelog/unreleased/gdpr-export.md @@ -2,4 +2,5 @@ Enhancement: GDPR Export Adds an endpoint to collect all data that is related to a user +https://github.com/owncloud/ocis/pull/6064 https://github.com/owncloud/ocis/pull/5950 diff --git a/ocis-pkg/keycloak/client.go b/ocis-pkg/keycloak/client.go index 49cd3e981..f88f2b142 100644 --- a/ocis-pkg/keycloak/client.go +++ b/ocis-pkg/keycloak/client.go @@ -132,14 +132,14 @@ func (c *ConcreteClient) GetPIIReport(ctx context.Context, realm string, email s return nil, err } - creds, err := c.keycloak.GetCredentials(ctx, token.AccessToken, realm, keycloakID) + sessions, err := c.keycloak.GetUserSessions(ctx, token.AccessToken, realm, keycloakID) if err != nil { return nil, err } return &PIIReport{ - UserData: u, - Credentials: creds, + UserData: u, + Sessions: sessions, }, nil } diff --git a/ocis-pkg/keycloak/gocloak.go b/ocis-pkg/keycloak/gocloak.go index c4a4de0cd..52af2e053 100644 --- a/ocis-pkg/keycloak/gocloak.go +++ b/ocis-pkg/keycloak/gocloak.go @@ -16,4 +16,5 @@ type GoCloak interface { LoginClient(ctx context.Context, clientID, clientSecret, realm string) (*gocloak.JWT, error) RetrospectToken(ctx context.Context, accessToken, clientID, clientSecret, realm string) (*gocloak.IntroSpectTokenResult, error) GetCredentials(ctx context.Context, accessToken, realm, userID string) ([]*gocloak.CredentialRepresentation, error) + GetUserSessions(ctx context.Context, token, realm, userID string) ([]*gocloak.UserSessionRepresentation, error) } diff --git a/ocis-pkg/keycloak/types.go b/ocis-pkg/keycloak/types.go index 366a550e3..901893823 100644 --- a/ocis-pkg/keycloak/types.go +++ b/ocis-pkg/keycloak/types.go @@ -26,8 +26,8 @@ var userActionsToString = map[UserAction]string{ // PIIReport is a structure of all the PersonalIdentifiableInformation contained in keycloak. type PIIReport struct { - UserData *libregraph.User `json:"user_data,omitempty"` - Credentials []*gocloak.CredentialRepresentation `json:"credentials,omitempty"` + UserData *libregraph.User + Sessions []*gocloak.UserSessionRepresentation } // Client represents a keycloak client.