-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add optional OIDC avatar fetching from the picture
claim
#5429
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
Add optional OIDC avatar fetching from the picture
claim
#5429
Conversation
picture
claim
Thanks for providing this @rubentalstra. Is the authorization header in the picture URL request based upon any actual need or standard/specification? Also, I wouldn't look to have this run on each login, just the first registration/sync as per all existing details in support SSO options. We'll also need to add testing to cover the added functionality. I'm happy to make these changes/additions before merge, but I really just need to know about the authorization point above. |
@ssddanbrown hi, thank you for taking the time. The header is for sure needed if you use Microsoft because it will call a global endpoint. And based on the header it will return the users profile. |
Thanks for this @rubentalstra. I can confirm via testing. I'm siding towards not sending any auth tokens, leaving any non-spec services like Entra/AzureAD use our logical theme hooks to work around their awkardness. Another consideration for this PR: it's currently saving images as png, which probably will be the most common, but this is not assured; The spec does not confirm exact formats. |
Review of #5429, OIDC avatar fetching
This has now been merged for the next release, thanks again @rubentalstra. |
@ssddanbrown thank you for reviewing my PR. I'm happy to see that it was not for nothing 😉 |
This update enables BookStack to optionally fetch user avatars from the OIDC
picture
claim. The implementation:picture
claim for use as user avatar #4271fetch_avatars
config flag inconfig/oidc.php
to toggle avatar retrieval.UserAvatars->assignToUserFromUrl($user, $picture, $accessToken)
to support both public and private (Bearer token-protected) endpoints.picture
claim from the user’s ID token or userinfo response, if provided.picture
URL.picture
field.This approach does not break existing behavior; avatar fetching is off by default. If enabled, BookStack will try to update a user’s avatar upon login, using the token to authenticate if necessary.