[PM-15990] fix(identity): preserve port in IdentityServer Origin URL
đī¸ Tracking
https://github.com/bitwarden/server/issues/4981
đ Objective
Previously, when using a custom port in self-hosted deployments (e.g., https://bitwarden.myserver.com:8443), the port information was lost during redirects from /identity/connect/authorize to /identity/sso/Login, despite having correctly configured globalSettings__baseServiceUri__vault.
This fix replaces Uri.Host with Uri.Authority when setting IdentityServer's Origin URL, ensuring:
- Port information is preserved in redirect URLs
- Maintains compatibility with both standard (443) and custom port deployments
đ¸ Screenshots
â° Reminders before review
- Contributor guidelines followed
- All formatters and local linters executed and passed
- Written new unit and / or integration tests where applicable
- Protected functional changes with optionality (feature flags)
- Used internationalization (i18n) for all UI strings
- CI builds passed
- Communicated to DevOps any deployment requirements
- Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team
đĻŽ Reviewer guidelines
- đ (
:+1:) or similar for great changes - đ (
:memo:) or âšī¸ (:information_source:) for notes or general info - â (
:question:) for questions - đ¤ (
:thinking:) or đ (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - đ¨ (
:art:) for suggestions / improvements - â (
:x:) or â ī¸ (:warning:) for more significant problems or concerns needing attention - đą (
:seedling:) or âģī¸ (:recycle:) for future improvements or indications of technical debt - â (
:pick:) for minor or nitpick changes
Thank you for your contribution! We've added this to our internal Community PR board for review. ID: PM-15990 Link: https://bitwarden.atlassian.net/browse/PM-15990
Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.
Checkmarx One â Scan Summary & Details â 031fefcc-1b4f-47a4-84d7-b25c9c68e5e5
Great job! No new security vulnerabilities introduced in this pull request
Codecov Report
:x: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 53.28%. Comparing base (480c20a) to head (3a3ce8c).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| bitwarden_license/src/Sso/Startup.cs | 0.00% | 1 Missing :warning: |
| src/Identity/Startup.cs | 0.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #5150 +/- ##
==========================================
+ Coverage 53.26% 53.28% +0.01%
==========================================
Files 1906 1906
Lines 84973 84973
Branches 7639 7639
==========================================
+ Hits 45265 45275 +10
+ Misses 37954 37944 -10
Partials 1754 1754
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.