/// <summary> /// Extension method enabling MSAL.NET extenders for public client applications to set a custom web ui /// that will let the user sign-in with Azure AD, present consent if needed, and get back the authorization /// code. /// </summary> /// <param name="builder">Builder for an AcquireTokenInteractive.</param> /// <param name="customWebUi">Customer implementation for the Web UI.</param> /// <returns>the builder to be able to chain .With methods.</returns> public static AcquireTokenInteractiveParameterBuilder WithCustomWebUi( this AcquireTokenInteractiveParameterBuilder builder, ICustomWebUi customWebUi) { builder.SetCustomWebUi(customWebUi); return(builder); }
/// <summary> /// Extension method enabling MSAL.NET extenders for public client applications to set a custom web UI /// that will let the user sign-in with Azure AD, present consent if needed, and get back the authorization /// code /// </summary> /// <param name="builder">Builder for an AcquireTokenInteractive</param> /// <param name="customWebUi">Customer implementation for the Web UI</param> /// <returns>the builder to be able to chain .With methods</returns> public static AcquireTokenInteractiveParameterBuilder WithCustomWebUi( this AcquireTokenInteractiveParameterBuilder builder, ICustomWebUi customWebUi) { builder.CommonParameters.AddApiTelemetryFeature(ApiTelemetryFeature.WithCustomWebUi); builder.SetCustomWebUi(customWebUi); return(builder); }
public void ValidateInteractiveParameters( IAccount expectedAccount = null, IEnumerable <string> expectedExtraScopesToConsent = null, string expectedLoginHint = null, string expectedPromptValue = null, ICustomWebUi expectedCustomWebUi = null, SystemWebViewOptions browserOptions = null) { ValidateInteractiveParameters( WebViewPreference.NotSpecified, expectedAccount, expectedExtraScopesToConsent, expectedLoginHint, expectedPromptValue, expectedCustomWebUi, browserOptions); }
public void ValidateInteractiveParameters( IAccount expectedAccount = null, IEnumerable <string> expectedExtraScopesToConsent = null, string expectedLoginHint = null, string expectedPromptValue = null, bool expectedEmbeddedWebView = false, ICustomWebUi expectedCustomWebUi = null) { Assert.IsNotNull(InteractiveParametersReceived); Assert.AreEqual(expectedAccount, InteractiveParametersReceived.Account); CoreAssert.AreScopesEqual( (expectedExtraScopesToConsent ?? new List <string>()).AsSingleString(), InteractiveParametersReceived.ExtraScopesToConsent.AsSingleString()); Assert.AreEqual(expectedLoginHint, InteractiveParametersReceived.LoginHint); Assert.AreEqual(expectedPromptValue ?? Prompt.SelectAccount.PromptValue, InteractiveParametersReceived.Prompt.PromptValue); Assert.IsNotNull(InteractiveParametersReceived.UiParent); Assert.AreEqual(expectedEmbeddedWebView, InteractiveParametersReceived.UseEmbeddedWebView); Assert.AreEqual(expectedCustomWebUi, InteractiveParametersReceived.CustomWebUi); }
public void ValidateInteractiveParameters( WebViewPreference expectedEmbeddedWebView, IAccount expectedAccount = null, IEnumerable <string> expectedExtraScopesToConsent = null, string expectedLoginHint = null, string expectedPromptValue = null, ICustomWebUi expectedCustomWebUi = null, SystemWebViewOptions browserOptions = null) { Assert.IsNotNull(InteractiveParametersReceived); Assert.AreEqual(expectedAccount, InteractiveParametersReceived.Account); CoreAssert.AreScopesEqual( (expectedExtraScopesToConsent ?? new List <string>()).AsSingleString(), InteractiveParametersReceived.ExtraScopesToConsent.AsSingleString()); Assert.AreEqual(expectedLoginHint, InteractiveParametersReceived.LoginHint); Assert.AreEqual(expectedPromptValue ?? Prompt.NotSpecified.PromptValue, InteractiveParametersReceived.Prompt.PromptValue); Assert.IsNotNull(InteractiveParametersReceived.UiParent); Assert.AreEqual(expectedEmbeddedWebView, InteractiveParametersReceived.UseEmbeddedWebView); Assert.AreEqual(expectedCustomWebUi, InteractiveParametersReceived.CustomWebUi); Assert.AreEqual(browserOptions, InteractiveParametersReceived.UiParent.SystemWebViewOptions); }
public MsalClient( IAppSettings appSettings, IFileWriter fileWriter, HttpClient httpClient, ITelemetry telemetry, ICustomWebUi customWebUi) { Guard.IsNotNull(appSettings, nameof(appSettings)); Guard.IsNotNull(fileWriter, nameof(fileWriter)); Guard.IsNotNull(httpClient, nameof(httpClient)); Guard.IsNotNull(telemetry, nameof(telemetry)); Guard.IsNotNull(customWebUi, nameof(customWebUi)); _clientId = appSettings.MsaClientId; _fileWriter = fileWriter; _httpClient = httpClient; _telemetry = telemetry; _customWebUi = customWebUi; _msalSdkClient = PublicClientApplicationBuilder .Create(_clientId) .WithAuthority(Authority) .WithRedirectUri(RedirectUri) .Build(); }
// This is internal so that we can configure this from the extension methods for ICustomWebUi internal void SetCustomWebUi(ICustomWebUi customWebUi) { Parameters.CustomWebUi = customWebUi; }
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/ActiveDirectoryAuthenticationProvider.xml' path='docs/members[@name="ActiveDirectoryAuthenticationProvider"]/SetAcquireAuthorizationCodeAsyncCallback/*'/> public void SetAcquireAuthorizationCodeAsyncCallback(Func <Uri, Uri, CancellationToken, Task <Uri> > acquireAuthorizationCodeAsyncCallback) => _customWebUI = new CustomWebUi(acquireAuthorizationCodeAsyncCallback);
public CustomWebUiHandler(ICustomWebUi customWebUi) { _customWebUi = customWebUi; }
public LocalhostInteractiveSqlAuthenticationProvider(string clientId, ICustomWebUi webUi, int port) { this._clientId = clientId; this._webUi = webUi; this._port = port; }
public LocalhostInteractiveSqlAuthenticationProvider(string clientId, ICustomWebUi webUi) : this(clientId, webUi, port : 0) { }