Repository navigation
Enforce HTTPS for WS-Trust endpoints #6165
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
Merged
Logan Dorsey (logdog16)
merged 17 commits into
main
from
lodorsey/wstrust-https-enforcement
Sep 17, 2026
+1,667
−43
Merged
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fb872a0
Enforce HTTPS for WS-Trust endpoints
logdog16 846ef8c
Disable redirects for MEX requests
logdog16 9d1dab8
Merge branch 'main' into lodorsey/wstrust-https-enforcement
logdog16 6fcb262
Merge branch 'main' into lodorsey/wstrust-https-enforcement
logdog16 d8b2d76
Preserve secure WS-Trust redirects
logdog16 63aefed
Merge branch 'main' into lodorsey/wstrust-https-enforcement
logdog16 b86f9fd
Address WS-Trust redirect review feedback
logdog16 319a48a
Preserve credentials on same-origin redirects
logdog16 9957bae
Potential fix for pull request finding
logdog16 6f6c3de
Merge remote-tracking branch 'origin/main' into lodorsey/wstrust-http…
Copilot 114d0e4
Merge branch 'main' into lodorsey/wstrust-https-enforcement
logdog16 21a28a2
Merge branch 'main' into lodorsey/wstrust-https-enforcement
logdog16 d043e07
Use zero timeout in cancellation tests
Copilot 0c3acd9
Add WS-Trust HTTP factory capability and safe fallback
logdog16 a875dde
Merge main and preserve WS-Trust retry budgets
logdog16 8fb5bdd
Simplify WS-Trust HTTP timeout and retry handling
logdog16 9c7758c
Merge branch 'main' into lodorsey/wstrust-https-enforcement
logdog16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
49 changes: 49 additions & 0 deletions
49
src/client/Microsoft.Identity.Client/Http/HttpRequestOperationContext.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Threading; | ||
|
|
||
| namespace Microsoft.Identity.Client.Http | ||
| { | ||
| internal sealed class HttpRequestOperationContext : IDisposable | ||
|
logdog16 marked this conversation as resolved.
Outdated
|
||
| { | ||
| private readonly CancellationToken _callerCancellationToken; | ||
| private readonly CancellationTokenSource _cancellationTokenSource; | ||
| private bool _timeoutInitialized; | ||
|
|
||
| public HttpRequestOperationContext(CancellationToken cancellationToken) | ||
| { | ||
| _callerCancellationToken = cancellationToken; | ||
| _cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); | ||
| } | ||
|
|
||
| public CancellationToken CancellationToken => _cancellationTokenSource.Token; | ||
|
|
||
| public int RetryCount { get; set; } | ||
|
|
||
| public bool IsTimedOut => | ||
| _cancellationTokenSource.IsCancellationRequested && | ||
| !_callerCancellationToken.IsCancellationRequested; | ||
|
|
||
| public void InitializeTimeout(TimeSpan timeout) | ||
| { | ||
| if (_timeoutInitialized) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| _timeoutInitialized = true; | ||
|
|
||
| if (timeout != Timeout.InfiniteTimeSpan) | ||
| { | ||
| _cancellationTokenSource.CancelAfter(timeout); | ||
| } | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| _cancellationTokenSource.Dispose(); | ||
| } | ||
| } | ||
| } | ||
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
12 changes: 12 additions & 0 deletions
12
src/client/Microsoft.Identity.Client/Http/IHttpClientFactoryWithRedirectControl.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Net.Http; | ||
|
|
||
| namespace Microsoft.Identity.Client.Http | ||
| { | ||
| internal interface IHttpClientFactoryWithRedirectControl | ||
| { | ||
| HttpClient GetHttpClient(bool allowAutoRedirect, bool useDefaultCredentials); | ||
| } | ||
| } |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.