add sessions to report

This commit is contained in:
Michael Barz
2023-04-17 08:39:12 +02:00
parent c0be639f80
commit 3ed6786185
4 changed files with 7 additions and 5 deletions

View File

@@ -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

View File

@@ -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
}

View File

@@ -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)
}

View File

@@ -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.