Skip to content
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

feat: added ability to set user name for federated auth #3202

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

JohnTheNerd
Copy link
Contributor

@JohnTheNerd JohnTheNerd commented Jun 16, 2024

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for validating the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

this PR adds an optional environment variable named WEBUI_AUTH_TRUSTED_NAME_HEADER, which sets the user's name to the contents of that header. this only happens if the user is just being created, just like how the trusted e-mail header works.

if the environment variable or header is not present, we fall back to the original behavior which is to re-use the user e-mail address.

Added

  • Adds a new optional environment variable

Changed

None

Deprecated

None

Removed

None

Fixed

N/A

Security

N/A

Breaking Changes

N/A, it will fall back to original behavior if the header or environment variable does not exist.


Additional Information

The GitHub actions are failing due to uppercase characters in my username, so to test, I first fixed that (#3204), merged both changes in a separate branch, and merely ran the actions. The images are available in the images containing ci-cd-test in the Packages section of my fork. I deployed the resulting image to my homelab and it's working fine so far.

Documentation changes are at open-webui/docs#117 and the discussion post is #3201 .

Screenshots or Videos

N/A

@JohnTheNerd JohnTheNerd changed the base branch from main to dev June 16, 2024 00:12
@JohnTheNerd JohnTheNerd changed the title added ability to set user name for federated auth [feat] added ability to set user name for federated auth Jun 16, 2024
@JohnTheNerd JohnTheNerd changed the title [feat] added ability to set user name for federated auth feat: added ability to set user name for federated auth Jun 16, 2024
@tjbck
Copy link
Contributor

tjbck commented Jun 16, 2024

#2706 seems related. I just won't merge PRs that I can't really test so if you could help out with this that'd be great!

@JohnTheNerd
Copy link
Contributor Author

JohnTheNerd commented Jun 16, 2024

Happy to test the other PR for you, but I will first wait for #3204 to be merged because it's quite difficult for me to build custom images including commits from different repositories to deploy to my homelab. The images I built for testing are merely cherry-picked and I run the GitHub actions as-is.

@JohnTheNerd
Copy link
Contributor Author

Alternatively, I can simply include a screen recording of me running the branch from this PR in a comment right here and showing that the functionality works. Whichever works better for you, really.

@JohnTheNerd
Copy link
Contributor Author

now that the respective PR is merged, I can (much more easily) build stuff. would you prefer I demonstrate that this PR or #2706 functions properly? is a screen recording okay, or would you prefer something else?

@tjbck
Copy link
Contributor

tjbck commented Jun 16, 2024

Screenrecording works for me! Let's add @sample as a coauthor as well!

this commit adds an optional environment variable named `WEBUI_AUTH_TRUSTED_NAME_HEADER`, which sets the user's name to the contents of that header. this only happens if the user is just being created, just like how the trusted e-mail header works.

if the environment variable or header is not present, we fall back to the original behavior which is to re-use the user e-mail address.

Co-Authored-By: Nikita Borzykh <[email protected]>
@JohnTheNerd
Copy link
Contributor Author

rebased it off dev, and added @sample as a co-author. just waiting for the image build before I demonstrate

@JohnTheNerd
Copy link
Contributor Author

after lots of screaming at ffmpeg, i finally got the screen record small enough to fit in a comment lol
output2.webm

@tjbck
Copy link
Contributor

tjbck commented Jun 17, 2024

LGTM, Thanks!

@tjbck tjbck merged commit f3bd810 into open-webui:dev Jun 17, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants