88using System . Net . Http . Headers ;
99using System . Threading ;
1010using System . Threading . Tasks ;
11- using Windows . Networking . Connectivity ;
1211using Windows . Security . Authentication . Web ;
1312using Windows . Security . Authentication . Web . Core ;
1413using Windows . Security . Credentials ;
@@ -23,14 +22,6 @@ namespace CommunityToolkit.Authentication
2322 /// </summary>
2423 public class WindowsProvider : BaseProvider
2524 {
26- /// <summary>
27- /// Gets the redirect uri value based on the current app callback uri.
28- /// Used for configuring the Azure app registration.
29- /// </summary>
30- public static string RedirectUri => string . Format ( "ms-appx-web://Microsoft.AAD.BrokerPlugIn/{0}" , WebAuthenticationBroker . GetCurrentApplicationCallbackUri ( ) . Host . ToUpper ( ) ) ;
31-
32- private static readonly SemaphoreSlim SemaphoreSlim = new ( 1 ) ;
33-
3425 private const string AuthenticationHeaderScheme = "Bearer" ;
3526 private const string GraphResourcePropertyKey = "resource" ;
3627 private const string GraphResourcePropertyValue = "https://graph.microsoft.com" ;
@@ -41,13 +32,21 @@ public class WindowsProvider : BaseProvider
4132 private const string SettingsKeyAccountId = "WindowsProvider_AccountId" ;
4233 private const string SettingsKeyProviderId = "WindowsProvider_ProviderId" ;
4334
35+ private static readonly SemaphoreSlim SemaphoreSlim = new ( 1 ) ;
36+
4437 // Default/minimal scopes for authentication, if none are provided.
4538 private static readonly string [ ] DefaultScopes = { "User.Read" } ;
4639
4740 // The default account providers available in the AccountsSettingsPane.
4841 // Default is Msa because it does not require any additional configuration
4942 private static readonly WebAccountProviderType DefaultWebAccountsProviderType = WebAccountProviderType . Msa ;
5043
44+ /// <summary>
45+ /// Gets the redirect uri value based on the current app callback uri.
46+ /// Used for configuring the Azure app registration.
47+ /// </summary>
48+ public static string RedirectUri => string . Format ( "ms-appx-web://Microsoft.AAD.BrokerPlugIn/{0}" , WebAuthenticationBroker . GetCurrentApplicationCallbackUri ( ) . Host . ToUpper ( ) ) ;
49+
5150 /// <inheritdoc />
5251 public override string CurrentAccountId => _webAccount ? . Id ;
5352
@@ -188,14 +187,6 @@ public override async Task<string> GetTokenAsync(bool silentOnly = false)
188187
189188 try
190189 {
191- var internetConnectionProfile = NetworkInformation . GetInternetConnectionProfile ( ) ;
192- if ( internetConnectionProfile == null )
193- {
194- // We are not online, no token for you.
195- // TODO: Is there anything special to do when we go offline?
196- return null ;
197- }
198-
199190 var scopes = _scopes ;
200191
201192 // Attempt to authenticate silently.
0 commit comments