mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-08 03:09:39 +03:00
OIDC: Support picture claim for use as user avatar
#3824
Closed
opened 2026-02-05 07:35:09 +03:00 by OVERLORD
·
9 comments
No Branch/Tag Specified
development
further_theme_development
l10n_development
release
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
pull-request
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#3824
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Ghost-chu on GitHub (May 26, 2023).
Describe the Bug
Although the OIDC response contains the
picturefield, the Bookstack still use default user avatar.Steps to Reproduce
Expected Behaviour
Bookstack should use the avatar from OIDC response instead the default avatar
Screenshots or Additional Context
No response
Browser Details
Brave 1.51.118 Chromium: 113.0.5672.126(Release) (64 bit)
Exact BookStack Version
v23.05.2
PHP Version
No response
Hosting Environment
debian-11.7 - Bookstack Docker Image by LinuxServer
@ssddanbrown commented on GitHub (May 26, 2023):
Thanks for raising, but I have recategorised this as a feature request, and updated the title to suit, since this is not a break in existing logic. We've just never specifically supported user avatars via the picture claim.
@cal940 commented on GitHub (Feb 3, 2024):
hello, is there any new progress on this issue?
would be nice to see this feature in the following releases.
@jasonpincin commented on GitHub (Aug 24, 2024):
Plus one on this one, fwiw.
@rubentalstra commented on GitHub (Jan 20, 2025):
I’ve opened a merge request (#5429) adding optional support for fetching user avatars from the OIDC
pictureclaim. It reuses our existing avatar logic so there’s no major code duplication. A newoidc.fetch_avatarsconfig option must be enabled for this feature to take effect. Feedback and testing are welcome!@ssddanbrown commented on GitHub (May 25, 2025):
This has now been added via #5429 and #5626.
Thanks to @rubentalstra for providing an implementation for this.
Thanks @Ghost-chu for the original request.
This will be part of the next feature release.
It will be disabled by default, but enabled with a
.envoption.Just to confirm though, this does not assure it will support all auth providers. The exact details of using the
pictureclaim are not too detailed in the spec, and it looks like auth providers like to do awkward things.BookStack will fetch an image at the
pictureclaim, following up to 3 GET redirects, and the image provided will need to be one of BookStack's accepted image formats (png, webp, avif, gif, bmp).Any platforms acting outside of that (For example Azure which seems to need credentials) will be outside the scope of what we support, at least in this revision, although it may be possible to use the logical theme system to implement custom workarounds.
Also, this will fetch and assign the avatar image at every login, where the user does not have an avatar already assigned (either manually configured in platform or via a prior fetch). This aligns with our logic for LDAP.
@Tomblarom commented on GitHub (Jul 31, 2025):
@ssddanbrown is there a workaround for Azure? We are using OIDC, which works perfectly to automatically log in, fetch the username/email and assign the matching roles based on their groups. But avatar/picture are not being fetched.. Is it possibe to pull it from LDAP instead? Authentification with LDAP works and fetches the picture, but lacks the auto-login-feature, which is why we switched to OIDC..
@ssddanbrown commented on GitHub (Jul 31, 2025):
@Tomblarom No workaround as of yet, although it should technically be possible to create one with the logical theme system, although the process might be a bit akward. We provide a OIDC specific event you can hook into, which provides the auth details during the OIDC process. You could use that to get the image, put it into accessible web space, then set an avatar URL in the OIDC data for the image to point to that image in accessible web space. Probably many other way to go about it, but using the provided OIDC logical theme event is key to having the correct auth.
LDAP systems are quite different, and I'm not sure about shared auth between OIDC/LDAP for Azure. Would probably be more faff to attempt I reckon.
@Tomblarom commented on GitHub (Oct 16, 2025):
@ssddanbrown so I hacked together my own solution and it seems to do exactly what I want. :) Since I used ChatGPT I would highly recommend to review and refactor the code, before potentially publishing as an unofficial hack. 😉
Workaround for retrieving
picturewhen using OIDCAs primary authentication provider, I used
AUTH_METHOD=oidc(setup: video, docs). Additionally I repurposed the variables from the LDAP-authentication:LDAP_SERVER,LDAP_BASE_DN,LDAP_DN,LDAP_PASS,LDAP_THUMBNAIL_ATTRIBUTE,LDAP_USER_FILTER(optional) andLDAP_START_TLS(optional).The script utilizes the suggested logical theme system and hooks into
AUTH_LOGIN/AUTH_REGISTER. Upon each login/registration it checks, if the picture for that user already exists. If not, it established a LDAP-connection, pulls the picture, saves it tobookstack/app/www/uploads/images/user/YYYY-MM/and links it to the present user.In order to retrieve and update the pictures of existing users, there is an artisan command
update-avatars. This command has not been tested by me, but you definitely get the idea.The script itself lives in
bookstack/app/www/themes/oidc-avatar-from-ldap/functions.phpand needs to be registered by addingAPP_THEME=oidc-avatar-from-ldap.functions.php
@ssddanbrown commented on GitHub (Nov 1, 2025):
A BookStack support customer also had the need for images with Azure/Entra, so I've published a simple example logical theme solution on our hack site: https://www.bookstackapp.com/hacks/oidc-azure-avatar-images/
Thanks @Tomblarom for offering that! but I decided to go a simpler route rather than getting LDAP involved in this.