Enabling non-standard ports for on-prem using OAuth#517
Open
korytiak wants to merge 3 commits intomicrosoft:masterfrom
Open
Enabling non-standard ports for on-prem using OAuth#517korytiak wants to merge 3 commits intomicrosoft:masterfrom
korytiak wants to merge 3 commits intomicrosoft:masterfrom
Conversation
…ise options for on-prem OAuth service client are very limited On-prem deployment very often use non-standard ports like 444
Update ConnectionService.cs to allow on-prem ports with OAuth
tehcrashxor
reviewed
Jul 18, 2025
| if (!IsOnPrem || _eAuthType == AuthenticationType.OAuth) // Use this even if its onPrem, when auth type == oauth. | ||
| if (!IsOnPrem) | ||
| { | ||
| OrgWorkingURI = new Uri(string.Format(SoapOrgUriFormat, _targetInstanceUriToConnectTo.Scheme, _targetInstanceUriToConnectTo.DnsSafeHost)); |
Member
There was a problem hiding this comment.
I do not believe your change does what you think it does.
On line 1476, the Uri.DnsSafeHost property, just like the Uri.Host property, returns only the host portion of the URI, so even if _targetInstanceUriToConnectTo contains your port 444, it would still be stripped out of the URI generated here.
Author
There was a problem hiding this comment.
Thank you for explaining the issue with my change. Would updating the .DnsSafeHost to .Authority (which would preserve the port) work as a potential workaround to allow the on-prem usage, or do you see any issue with that? Base on your feeling about this, please reject/accept the PR. Thank you again for your time and correction either way!
…preserve the port for on-prem hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hello my team has been struggling adopt the new ServiceClient as we're very restricted with our old on-prem setup. We've made some advances, and are getting closer, however the best thing we can do is use the ServiceClient constructior that takes url and tokenProviderFunction. This is really the best way for us to use new ServiceClient + OAuth we've set up, however it rewrites our port 444 to 443 and that breaks the client. Thank you for considering this fix.