diff --git a/sdk/identity/Azure.Identity.BrokeredAuthentication/api/Azure.Identity.BrokeredAuthentication.net462.cs b/sdk/identity/Azure.Identity.BrokeredAuthentication/api/Azure.Identity.BrokeredAuthentication.net462.cs index e981f65bb80bb..9016acddfe994 100644 --- a/sdk/identity/Azure.Identity.BrokeredAuthentication/api/Azure.Identity.BrokeredAuthentication.net462.cs +++ b/sdk/identity/Azure.Identity.BrokeredAuthentication/api/Azure.Identity.BrokeredAuthentication.net462.cs @@ -3,10 +3,12 @@ namespace Azure.Identity.BrokeredAuthentication public partial class InteractiveBrowserCredentialBrokerOptions : Azure.Identity.InteractiveBrowserCredentialOptions { public InteractiveBrowserCredentialBrokerOptions(System.IntPtr parentWindowHandle) { } + public bool? IsMsaPassthroughEnabled { get { throw null; } set { } } } public partial class SharedTokenCacheCredentialBrokerOptions : Azure.Identity.SharedTokenCacheCredentialOptions { public SharedTokenCacheCredentialBrokerOptions() { } public SharedTokenCacheCredentialBrokerOptions(Azure.Identity.TokenCachePersistenceOptions tokenCacheOptions) { } + public bool? IsMsaPassthroughEnabled { get { throw null; } set { } } } } diff --git a/sdk/identity/Azure.Identity/CHANGELOG.md b/sdk/identity/Azure.Identity/CHANGELOG.md index 38f93222ce705..9233c04c5d10f 100644 --- a/sdk/identity/Azure.Identity/CHANGELOG.md +++ b/sdk/identity/Azure.Identity/CHANGELOG.md @@ -3,7 +3,7 @@ ## 1.10.0-beta.2 (Unreleased) ### Features Added -- Add `BrowserCustomizedOptions` to `InteractiveBrowserCredential` to enable web view customization for interactive authentication. +- Added `BrowserCustomization` property to `InteractiveBrowserCredential` to enable web view customization for interactive authentication. ### Breaking Changes diff --git a/sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs b/sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs index cfbe3c011a213..c48d1c9aa95d9 100644 --- a/sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs +++ b/sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs @@ -94,10 +94,10 @@ public AzurePowerShellCredentialOptions() { } } public partial class BrowserCustomizationOptions { - public bool? UseEmbeddedWebView; public BrowserCustomizationOptions() { } - public string HtmlMessageError { get { throw null; } set { } } - public string HtmlMessageSuccess { get { throw null; } set { } } + public string ErrorMessage { get { throw null; } set { } } + public string SuccessMessage { get { throw null; } set { } } + public bool? UseEmbeddedWebView { get { throw null; } set { } } } public partial class ChainedTokenCredential : Azure.Core.TokenCredential { @@ -281,7 +281,7 @@ public partial class InteractiveBrowserCredentialOptions : Azure.Identity.TokenC public InteractiveBrowserCredentialOptions() { } public System.Collections.Generic.IList AdditionallyAllowedTenants { get { throw null; } } public Azure.Identity.AuthenticationRecord AuthenticationRecord { get { throw null; } set { } } - public Azure.Identity.BrowserCustomizationOptions BrowserCustomizedOptions { get { throw null; } set { } } + public Azure.Identity.BrowserCustomizationOptions BrowserCustomization { get { throw null; } set { } } public string ClientId { get { throw null; } set { } } public bool DisableAutomaticAuthentication { get { throw null; } set { } } public bool DisableInstanceDiscovery { get { throw null; } set { } } diff --git a/sdk/identity/Azure.Identity/src/Credentials/BrowserCustomizationOptions.cs b/sdk/identity/Azure.Identity/src/Credentials/BrowserCustomizationOptions.cs index 2ac35a32c2b4c..0a3d0a99e14d6 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/BrowserCustomizationOptions.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/BrowserCustomizationOptions.cs @@ -17,7 +17,7 @@ public class BrowserCustomizationOptions /// Specifies if the public client application should used an embedded web browser /// or the system default browser /// - public bool? UseEmbeddedWebView; + public bool? UseEmbeddedWebView { get; set; } internal SystemWebViewOptions SystemBrowserOptions; @@ -34,7 +34,7 @@ private SystemWebViewOptions systemWebViewOptions /// Property to set HtmlMessageSuccess of SystemWebViewOptions from MSAL, /// which the browser will show to the user when the user finishes authenticating successfully. /// - public string HtmlMessageSuccess + public string SuccessMessage { get { @@ -52,7 +52,7 @@ public string HtmlMessageSuccess /// which the browser will show to the user when the user finishes authenticating, but an error occurred. /// You can use a string format e.g. "An error has occurred: {0} details: {1}". /// - public string HtmlMessageError + public string ErrorMessage { get { diff --git a/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs index c1a3957c820e9..a2b7379a7a116 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs @@ -21,7 +21,7 @@ public class InteractiveBrowserCredential : TokenCredential internal string[] AdditionallyAllowedTenantIds { get; } internal string ClientId { get; } internal string LoginHint { get; } - internal BrowserCustomizationOptions BrowserCustomizedOptions { get; } + internal BrowserCustomizationOptions BrowserCustomization { get; } internal MsalPublicClient Client { get; } internal CredentialPipeline Pipeline { get; } internal bool DisableAutomaticAuthentication { get; } @@ -91,7 +91,7 @@ internal InteractiveBrowserCredential(string tenantId, string clientId, TokenCre Client = client ?? new MsalPublicClient(Pipeline, tenantId, clientId, redirectUrl, options); AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants); Record = (options as InteractiveBrowserCredentialOptions)?.AuthenticationRecord; - BrowserCustomizedOptions = (options as InteractiveBrowserCredentialOptions)?.BrowserCustomizedOptions; + BrowserCustomization = (options as InteractiveBrowserCredentialOptions)?.BrowserCustomization; } /// @@ -242,7 +242,7 @@ private async Task GetTokenViaBrowserLoginAsync(TokenRequestContext var tenantId = TenantIdResolver.Resolve(TenantId ?? Record?.TenantId, context, AdditionallyAllowedTenantIds); AuthenticationResult result = await Client - .AcquireTokenInteractiveAsync(context.Scopes, context.Claims, prompt, LoginHint, tenantId, context.IsCaeEnabled, BrowserCustomizedOptions, async, cancellationToken) + .AcquireTokenInteractiveAsync(context.Scopes, context.Claims, prompt, LoginHint, tenantId, context.IsCaeEnabled, BrowserCustomization, async, cancellationToken) .ConfigureAwait(false); Record = new AuthenticationRecord(result, ClientId); diff --git a/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredentialOptions.cs b/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredentialOptions.cs index 4e3ca802f5f09..eb0bfc4cad650 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredentialOptions.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredentialOptions.cs @@ -69,6 +69,6 @@ public string TenantId /// /// The options for customizing the browser for interactive authentication. /// - public BrowserCustomizationOptions BrowserCustomizedOptions { get; set; } + public BrowserCustomizationOptions BrowserCustomization { get; set; } } } diff --git a/sdk/identity/Azure.Identity/tests/InteractiveBrowserCredentialTests.cs b/sdk/identity/Azure.Identity/tests/InteractiveBrowserCredentialTests.cs index 7bca55e9cf8ca..85801445eb5a6 100644 --- a/sdk/identity/Azure.Identity/tests/InteractiveBrowserCredentialTests.cs +++ b/sdk/identity/Azure.Identity/tests/InteractiveBrowserCredentialTests.cs @@ -294,25 +294,25 @@ public async Task InvokesBeforeBuildClientOnExtendedOptions() } [Test] - public async Task BrowserCustomizedOptionsHtmlMessage([Values(null, "

Login Successfully.

")] string htmlMessageSuccess, [Values(null, "

An error occured: {0}. Details {1}

")] string htmlMessageError) + public async Task BrowserCustomizationsHtmlMessage([Values(null, "

Login Successfully.

")] string htmlMessageSuccess, [Values(null, "

An error occured: {0}. Details {1}

")] string htmlMessageError) { var mockMsalClient = new MockMsalPublicClient { InteractiveAuthFactory = (_, _, _, _, _, _, browserOptions, _) => { Assert.AreEqual(false, browserOptions.UseEmbeddedWebView); - Assert.AreEqual(htmlMessageSuccess, browserOptions.HtmlMessageSuccess); - Assert.AreEqual(htmlMessageError, browserOptions.HtmlMessageError); + Assert.AreEqual(htmlMessageSuccess, browserOptions.SuccessMessage); + Assert.AreEqual(htmlMessageError, browserOptions.ErrorMessage); return AuthenticationResultFactory.Create(Guid.NewGuid().ToString(), expiresOn: DateTimeOffset.UtcNow.AddMinutes(5)); } }; var options = new InteractiveBrowserCredentialOptions() { - BrowserCustomizedOptions = new BrowserCustomizationOptions() + BrowserCustomization = new BrowserCustomizationOptions() { UseEmbeddedWebView = false, - HtmlMessageSuccess = htmlMessageSuccess, - HtmlMessageError = htmlMessageError + SuccessMessage = htmlMessageSuccess, + ErrorMessage = htmlMessageError } }; @@ -329,16 +329,16 @@ public async Task BrowserCustomizedUseEmbeddedWebView([Values(null, true, false) InteractiveAuthFactory = (_, _, _, _, _, _, browserOptions, _) => { Assert.AreEqual(useEmbeddedWebView, browserOptions.UseEmbeddedWebView); - Assert.AreEqual(htmlMessageError, browserOptions.HtmlMessageError); + Assert.AreEqual(htmlMessageError, browserOptions.ErrorMessage); return AuthenticationResultFactory.Create(Guid.NewGuid().ToString(), expiresOn: DateTimeOffset.UtcNow.AddMinutes(5)); } }; var options = new InteractiveBrowserCredentialOptions() { - BrowserCustomizedOptions = new BrowserCustomizationOptions() + BrowserCustomization = new BrowserCustomizationOptions() { UseEmbeddedWebView = useEmbeddedWebView, - HtmlMessageError = htmlMessageError + ErrorMessage = htmlMessageError } };