Skip to content

Commit bccbce9

Browse files
ashok672gladjohn
andauthored
Deprecate AcquireTokenByIntegratedWindowsAuth API (#5345)
* Deprecate IntegratedWindowsAuth API * Update src/client/Microsoft.Identity.Client/IPublicClientApplication.cs Co-authored-by: Gladwin Johnson <[email protected]> * Update WsTrustWebRequestManager.cs * Update WsTrustWebRequestManager.cs * Fix build break --------- Co-authored-by: Gladwin Johnson <[email protected]>
1 parent 23fe188 commit bccbce9

File tree

7 files changed

+19
-9
lines changed

7 files changed

+19
-9
lines changed

src/client/Microsoft.Identity.Client/IPublicClientApplication.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ AcquireTokenWithDeviceCodeParameterBuilder AcquireTokenWithDeviceCode(
7777

7878
/// <summary>
7979
/// <para>
80-
/// This API is no longer recommended and will be deprecated in future versions in favor of
81-
/// similar functionality via <see href="https://aka.ms/msal-net-wam">the Windows broker (WAM)</see>.
80+
/// This API is no longer recommended. If your application requires single sign-on (SSO) with the Windows OS's default account,
81+
/// please transition to using WAM, which provides similar functionality
82+
/// via <see href="https://aka.ms/msal-net-wam">the Windows broker (WAM)</see>.
8283
/// WAM does not require any setup for desktop apps to login with the Windows account.
8384
/// </para>
8485
/// <para>
@@ -94,6 +95,9 @@ AcquireTokenWithDeviceCodeParameterBuilder AcquireTokenWithDeviceCode(
9495
/// <remarks>
9596
/// See <see href="https://aka.ms/msal-net-iwa">our documentation</see> for more details.
9697
/// </remarks>
98+
99+
[Obsolete("This API is no longer recommended. For scenarios requiring SSO with the Windows OS's default account, please transition to using WAM.", false)]
100+
[EditorBrowsable(EditorBrowsableState.Never)]
97101
AcquireTokenByIntegratedWindowsAuthParameterBuilder AcquireTokenByIntegratedWindowsAuth(
98102
IEnumerable<string> scopes);
99103

src/client/Microsoft.Identity.Client/WsTrust/WsTrustWebRequestManager.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,9 @@ public async Task<WsTrustResponse> GetWsTrustResponseAsync(
9696
{
9797
{ "SOAPAction", (wsTrustEndpoint.Version == WsTrustVersion.WsTrust2005) ? XmlNamespace.Issue2005.ToString() : XmlNamespace.Issue.ToString() }
9898
};
99-
100-
var body = new StringContent(
101-
// CodeQL [SM00417] False Positive: wsTrustRequest is a body parameter for HttpRequest that follows WsTrust protocol
102-
wsTrustRequest,
103-
Encoding.UTF8, "application/soap+xml");
99+
100+
// CodeQL [SM00417] False Positive: wsTrustRequest is a body parameter for HttpRequest that follows WsTrust protocol
101+
var body = new StringContent(wsTrustRequest, Encoding.UTF8, "application/soap+xml");
104102

105103
IRetryPolicyFactory retryPolicyFactory = requestContext.ServiceBundle.Config.RetryPolicyFactory;
106104
IRetryPolicy retryPolicy = retryPolicyFactory.GetRetryPolicy(RequestType.STS);

tests/Microsoft.Identity.Test.Unit/PublicApiTests/PublicClientApplicationTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,9 @@ public void EnsurePublicApiSurfaceExistsOnInterface()
11591159
#endif
11601160
CheckBuilderCommonMethods(interactiveBuilder);
11611161

1162+
#pragma warning disable CS0618 // Type or member is obsolete
11621163
var iwaBuilder = app.AcquireTokenByIntegratedWindowsAuth(TestConstants.s_scope)
1164+
#pragma warning restore CS0618 // Type or member is obsolete
11631165
.WithUsername("[email protected]");
11641166
CheckBuilderCommonMethods(iwaBuilder);
11651167

tests/devapps/FociTestApp/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ private static Task<AuthenticationResult> StartAcquireTokenAsync(IPublicClientAp
180180
{
181181
if (s_useIWA)
182182
{
183+
#pragma warning disable CS0618 // Type or member is obsolete
183184
return pca.AcquireTokenByIntegratedWindowsAuth(s_scopes).ExecuteAsync();
185+
#pragma warning restore CS0618 // Type or member is obsolete
184186
}
185187
return pca.AcquireTokenInteractive(s_scopes).WithUseEmbeddedWebView(false).ExecuteAsync();
186188
}

tests/devapps/NetCoreTestApp/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public class Program
3636
// Confidential client app with access to https://graph.microsoft.com/.default
3737
private static string s_clientIdForConfidentialApp;
3838

39-
4039
// App certificate for app above
4140
private static X509Certificate2 s_confidentialClientCertificate;
4241

@@ -172,7 +171,9 @@ 0. Exit App
172171
switch (selection)
173172
{
174173
case 1: // acquire token
174+
#pragma warning disable CS0618 // Type or member is obsolete
175175
authTask = pca.AcquireTokenByIntegratedWindowsAuth(s_scopes).WithUsername(s_username).ExecuteAsync(CancellationToken.None);
176+
#pragma warning restore CS0618 // Type or member is obsolete
176177
await FetchTokenAndCallGraphAsync(pca, authTask).ConfigureAwait(false);
177178

178179
break;
@@ -432,7 +433,6 @@ private static IConfidentialClientApplication CreateCcaForMtlsPop(string region)
432433
.WithAuthority("https://login.microsoftonline.com/bea21ebe-8b64-4d06-9f6d-6a889b120a7c")
433434
.WithAzureRegion(region);
434435

435-
436436
ccaBuilder = ccaBuilder.WithCertificate(s_confidentialClientCertificate, true);
437437

438438
//Add Experimental feature for MTLS PoP

tests/devapps/NetFxConsoleTestApp/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,10 @@ x. Exit app
223223
switch (selection)
224224
{
225225
case '1': // acquire token
226+
#pragma warning disable CS0618 // Type or member is obsolete
226227
var iwaBuilder =
227228
pca.AcquireTokenByIntegratedWindowsAuth(s_scopes)
229+
#pragma warning restore CS0618 // Type or member is obsolete
228230
.WithUsername(s_username);
229231

230232
var result = await iwaBuilder.ExecuteAsync().ConfigureAwait(false);

tests/devapps/WAM/NetCoreWinFormsWam/Form1.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,11 @@ private async void btn_wia_Click(object sender, EventArgs e)
946946
var cancellationTokenSource = new CancellationTokenSource();
947947

948948
var pca = await CreatePca(GetAuthMethod()).ConfigureAwait(false);
949+
#pragma warning disable CS0618 // Type or member is obsolete
949950
AuthenticationResult authenticationResult = await pca
950951
.AcquireTokenByIntegratedWindowsAuth(
951952
GetScopes())
953+
#pragma warning restore CS0618 // Type or member is obsolete
952954
.ExecuteAsync(cancellationTokenSource.Token)
953955
.ConfigureAwait(true);
954956

0 commit comments

Comments
 (0)