send user data to badger when authenticated #807
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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-Name
andRemote-Email
headers 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-session
route; 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.yml
fileLimitations
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.