Skip to content

Commit 9dd40bd

Browse files
authored
fix assertions being removed from dict before callback is executed (#2733)
1 parent a574aa6 commit 9dd40bd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Microsoft.Identity.Web.TokenAcquisition/TokenAcquisition.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,15 +816,17 @@ private void NotifyCertificateSelection(MergedOptions mergedOptions, IConfidenti
816816
// Special case when the OBO inbound token is composite (for instance PFT)
817817
if (dict.ContainsKey(assertionConstant) && dict.ContainsKey(subAssertionConstant))
818818
{
819+
string assertion = dict[assertionConstant];
820+
string subAssertion = dict[subAssertionConstant];
819821

820822
// Check assertion and sub_assertion passed from merging extra query parameters to ensure they do not contain unsupported character(s).
821-
CheckAssertionsForInjectionAttempt(dict[assertionConstant], dict[subAssertionConstant]);
823+
CheckAssertionsForInjectionAttempt(assertion, subAssertion);
822824

823825
builder.OnBeforeTokenRequest((data) =>
824826
{
825827
// Replace the assertion and adds sub_assertion with the values from the extra query parameters
826-
data.BodyParameters[assertionConstant] = dict[assertionConstant];
827-
data.BodyParameters.Add(subAssertionConstant, dict[subAssertionConstant]);
828+
data.BodyParameters[assertionConstant] = assertion;
829+
data.BodyParameters.Add(subAssertionConstant, subAssertion);
828830
return Task.CompletedTask;
829831
});
830832

0 commit comments

Comments
 (0)