-
-
Notifications
You must be signed in to change notification settings - Fork 230
Feat: Pull users' Profile Picture from the OIDC claims #2704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1c21c4e
e26ca66
3dfd163
9869563
f443861
f1bed7a
dd41a43
b5074d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Enhancement: Sync user profile pictures from OIDC claims | ||
|
|
||
| The proxy now reads a profile picture URL from the OIDC `picture` claim (configurable | ||
| via `PROXY_AUTOPROVISION_CLAIM_PICTURE`, defaults to the standard `picture` claim, | ||
| set to an empty string to disable) and emits a `ProfilePictureSyncRequested` event. | ||
| The graph service consumes this event, downloads the image and stores it as the | ||
| user's avatar. Allowed image URLs can be restricted via | ||
| `GRAPH_PROFILE_PICTURE_URL_ALLOWLIST` (glob patterns, defaults to the OpenCloud URL | ||
| host). A `UserProfilePictureUpdated` event is emitted after a successful update so | ||
| the UI can refresh the avatar without a page reload. | ||
|
|
||
| https://github.com/opencloud-eu/opencloud/issues/1499 | ||
| https://github.com/opencloud-eu/opencloud/pull/2704 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import ( | |
|
|
||
| user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" | ||
| provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" | ||
| types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" | ||
| ) | ||
|
|
||
| type ResourceMention struct { | ||
|
|
@@ -20,3 +21,27 @@ func (ResourceMention) Unmarshal(v []byte) (interface{}, error) { | |
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } | ||
|
|
||
| type ProfilePictureSyncRequested struct { | ||
| Executant *user.UserId | ||
| PictureURL string `json:",omitempty"` | ||
| Timestamp *types.Timestamp | ||
| } | ||
|
|
||
| func (ProfilePictureSyncRequested) Unmarshal(v []byte) (interface{}, error) { | ||
| e := ProfilePictureSyncRequested{} | ||
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } | ||
|
|
||
| // UserProfilePictureUpdated can be consumed by frontend-facing services to refresh the avatar without a page reload. | ||
| type UserProfilePictureUpdated struct { | ||
| Executant *user.UserId | ||
| Timestamp *types.Timestamp | ||
| } | ||
|
|
||
| func (UserProfilePictureUpdated) Unmarshal(v []byte) (interface{}, error) { | ||
| e := UserProfilePictureUpdated{} | ||
| err := json.Unmarshal(v, &e) | ||
| return e, err | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor nitpick: one event has User prefix, one has not - feels a bit inconsistent
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. |
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,13 +25,14 @@ type Config struct { | |
| TokenManager *TokenManager `yaml:"token_manager"` | ||
| GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"` | ||
|
|
||
| Application Application `yaml:"application"` | ||
| Spaces Spaces `yaml:"spaces"` | ||
| Identity Identity `yaml:"identity"` | ||
| IncludeOCMSharees bool `yaml:"include_ocm_sharees" env:"OC_ENABLE_OCM;GRAPH_INCLUDE_OCM_SHAREES" desc:"Include OCM sharees when listing users." introductionVersion:"1.0.0"` | ||
| Events Events `yaml:"events"` | ||
| UnifiedRoles UnifiedRoles `yaml:"unified_roles"` | ||
| MaxConcurrency int `yaml:"max_concurrency" env:"OC_MAX_CONCURRENCY;GRAPH_MAX_CONCURRENCY" desc:"The maximum number of concurrent requests the service will handle." introductionVersion:"1.0.0"` | ||
| Application Application `yaml:"application"` | ||
| Spaces Spaces `yaml:"spaces"` | ||
| Identity Identity `yaml:"identity"` | ||
| ProfilePictureURLAllowlist []string `yaml:"profile_picture_url_allowlist" env:"GRAPH_PROFILE_PICTURE_URL_ALLOWLIST" desc:"A comma separated allowlist of URL patterns accepted for profile-picture sync events. Patterns can be full URLs with glob support in the host (for example 'https://*.example.com') or '*' to allow all URLs (dangerous: only use if the IdP is fully trusted to provide safe URLs, otherwise this is an SSRF attack vector). If empty, the OpenCloud URL host is allowed by default." introductionVersion:"6.3.0"` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. introductionVersion needs to be |
||
| IncludeOCMSharees bool `yaml:"include_ocm_sharees" env:"OC_ENABLE_OCM;GRAPH_INCLUDE_OCM_SHAREES" desc:"Include OCM sharees when listing users." introductionVersion:"1.0.0"` | ||
| Events Events `yaml:"events"` | ||
| UnifiedRoles UnifiedRoles `yaml:"unified_roles"` | ||
| MaxConcurrency int `yaml:"max_concurrency" env:"OC_MAX_CONCURRENCY;GRAPH_MAX_CONCURRENCY" desc:"The maximum number of concurrent requests the service will handle." introductionVersion:"1.0.0"` | ||
|
|
||
| Keycloak Keycloak `yaml:"keycloak"` | ||
| ServiceAccount ServiceAccount `yaml:"service_account"` | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the changelog folder, it seems we're not doing changelog items there anymore - but I'm not sure about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's correct. Changelog is being built from PR titles (linking to the PRs) by the
ready-release-go. So having a meaningful PR title and description is all you need. This changelog item can be deleted.