mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-22 09:32:36 -05:00
[PR #807] [MERGED] send user data to badger when authenticated #11129
Reference in New Issue
Block 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?
📋 Pull Request Information
Original PR: https://github.com/fosrl/pangolin/pull/807
Author: @pyrho
Created: 5/30/2025
Status: ✅ Merged
Merged: 6/4/2025
Merged by: @miloschwartz
Base:
dev← Head:feat/auth-header📝 Commits (1)
c5e37c1send user data to badger when authenticated📊 Changes
1 file changed (+36 additions, -16 deletions)
View changed files
📝
server/routers/badger/verifySession.ts(+36 -16)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
tl;dr;
Add
Remote-User,Remote-NameandRemote-Emailheaders to the upstream service request.Why ?
Some applications accept headers to authenticate users, Pangolin has access to this information and can simply forward some basic user information.
See for example Paperless-ngx.
See also:
Changes to Pangolin
This PR introduces simple changes to the response sent to the badger middleware on the
/verify-sessionroute; namely the username, name and email (seeBasicUserData).Note that the new user info data is only sent when the user is authenticated via SSO. I guess it could be added to other means of authentication (PIN, email, ...), but would require additional DB calls, and is perhaps better overall planning of the feature.
Changes to Badger
For this to work, we also need to make small changes within badger. The following diff enables the functionality:
A testing middleware has been published to Traefik catalog and can be tested by replacing the Badger middleware with my patched version.
The patched middleware code is available in my hard fork or Badger.
This can be done by modifying the
config/traefik/traefik_config.ymlfileLimitations
As mentioned, this will only work when login in via Pangolin SSO (not PIN, nor resource password, nor email link).
Additionally, it seems like the server admin account only has an
email. If you need the username and name, you will have to login with an Org user instead.How to test?
Using Pangolin, proxy to a resource serving the echo docker image to
https://echo.my.tld, secure it with SSO, openhttps://echo.my.tld, login in with Pangolin's SSO and see the headers.I'm currently running this, and it serves my needs.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.