diff --git a/src/Microsoft.Identity.Abstractions/TokenAcquisition/AcquireTokenOptions.cs b/src/Microsoft.Identity.Abstractions/TokenAcquisition/AcquireTokenOptions.cs index 81d2539..1c7a896 100644 --- a/src/Microsoft.Identity.Abstractions/TokenAcquisition/AcquireTokenOptions.cs +++ b/src/Microsoft.Identity.Abstractions/TokenAcquisition/AcquireTokenOptions.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; namespace Microsoft.Identity.Abstractions { @@ -30,6 +31,7 @@ public AcquireTokenOptions(AcquireTokenOptions other) CorrelationId = other.CorrelationId; ExtraQueryParameters = other.ExtraQueryParameters; ExtraHeadersParameters = other.ExtraHeadersParameters; + ExtraParameters = other.ExtraParameters; ForceRefresh = other.ForceRefresh; Claims = other.Claims; PopPublicKey = other.PopPublicKey; @@ -58,6 +60,15 @@ public AcquireTokenOptions(AcquireTokenOptions other) /// public IDictionary? ExtraQueryParameters { get; set; } + /// + /// An property bag used for extensiblity. + /// + /// + /// Not meant to be used by application developers, but by other SDKs. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public IDictionary? ExtraParameters { get; set; } + /// Sets extra headers in the HTTP request to the STS "/token" endpoint. public IDictionary? ExtraHeadersParameters { get; set; } diff --git a/test/Microsoft.Identity.Abstractions.Tests/DownstreamApiTests.cs b/test/Microsoft.Identity.Abstractions.Tests/DownstreamApiTests.cs index b7445b0..4edfae4 100644 --- a/test/Microsoft.Identity.Abstractions.Tests/DownstreamApiTests.cs +++ b/test/Microsoft.Identity.Abstractions.Tests/DownstreamApiTests.cs @@ -32,6 +32,7 @@ public void CloneClonesAllProperties() CorrelationId = Guid.NewGuid(), ExtraHeadersParameters = new Dictionary { { "slice", "test" } }, ExtraQueryParameters = new Dictionary { { "slice", "test" } }, + ExtraParameters = new Dictionary { { "param1", "value1" }, { "param2", "value2" } }, ForceRefresh = true, LongRunningWebApiSessionKey = AcquireTokenOptions.LongRunningWebApiSessionKeyAuto, ManagedIdentity = new ManagedIdentityOptions(), @@ -81,6 +82,7 @@ public void CloneClonesAllProperties() Assert.Equal(downstreamApiOptions.AcquireTokenOptions.CorrelationId, downstreamApiClone.AcquireTokenOptions.CorrelationId); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ExtraHeadersParameters, downstreamApiClone.AcquireTokenOptions.ExtraHeadersParameters); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ExtraQueryParameters, downstreamApiClone.AcquireTokenOptions.ExtraQueryParameters); + Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ExtraParameters, downstreamApiClone.AcquireTokenOptions.ExtraParameters); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ForceRefresh, downstreamApiClone.AcquireTokenOptions.ForceRefresh); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.LongRunningWebApiSessionKey, downstreamApiClone.AcquireTokenOptions.LongRunningWebApiSessionKey); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ManagedIdentity.UserAssignedClientId, downstreamApiClone.AcquireTokenOptions.ManagedIdentity?.UserAssignedClientId); @@ -93,7 +95,7 @@ public void CloneClonesAllProperties() // If this fails, think of also adding a line to test the new property Assert.Equal(12, typeof(DownstreamApiOptions).GetProperties().Length); - Assert.Equal(13, typeof(AcquireTokenOptions).GetProperties().Length); + Assert.Equal(14, typeof(AcquireTokenOptions).GetProperties().Length); DownstreamApiOptionsReadOnlyHttpMethod options = new DownstreamApiOptionsReadOnlyHttpMethod(downstreamApiOptions, HttpMethod.Delete.ToString()); Assert.Equal(HttpMethod.Delete.ToString(), options.HttpMethod);