From bac18c51c43179d6e97be8952dca630a78b25761 Mon Sep 17 00:00:00 2001 From: Nikola Metulev Date: Fri, 28 Jan 2022 16:13:59 -0800 Subject: [PATCH] Revert "Add optional Scopes parameter to BaseProvider" --- CommunityToolkit.Authentication.Msal/MsalProvider.cs | 5 ++--- CommunityToolkit.Authentication.Uwp/WindowsProvider.cs | 7 +++---- CommunityToolkit.Authentication/BaseProvider.cs | 2 +- CommunityToolkit.Authentication/IProvider.cs | 3 +-- CommunityToolkit.Authentication/MockProvider.cs | 2 +- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CommunityToolkit.Authentication.Msal/MsalProvider.cs b/CommunityToolkit.Authentication.Msal/MsalProvider.cs index 9b90884..3adf77a 100644 --- a/CommunityToolkit.Authentication.Msal/MsalProvider.cs +++ b/CommunityToolkit.Authentication.Msal/MsalProvider.cs @@ -171,10 +171,9 @@ public override async Task SignOutAsync() } /// - public override Task GetTokenAsync(bool silentOnly = false, string[] scopes = null) + public override Task GetTokenAsync(bool silentOnly = false) { - var withScopes = scopes ?? this.Scopes; - return this.GetTokenWithScopesAsync(withScopes, silentOnly); + return this.GetTokenWithScopesAsync(Scopes, silentOnly); } /// diff --git a/CommunityToolkit.Authentication.Uwp/WindowsProvider.cs b/CommunityToolkit.Authentication.Uwp/WindowsProvider.cs index 2a5434a..b0f1235 100644 --- a/CommunityToolkit.Authentication.Uwp/WindowsProvider.cs +++ b/CommunityToolkit.Authentication.Uwp/WindowsProvider.cs @@ -184,17 +184,16 @@ public override async Task SignOutAsync() } /// - public override async Task GetTokenAsync(bool silentOnly = false, string[] scopes = null) + public override async Task GetTokenAsync(bool silentOnly = false) { await SemaphoreSlim.WaitAsync(); try { - // use request specific scopes if not null, otherwise use class scopes - var authenticationScopes = scopes ?? this._scopes; + var scopes = _scopes; // Attempt to authenticate silently. - var authResult = await AuthenticateSilentAsync(authenticationScopes); + var authResult = await AuthenticateSilentAsync(scopes); // Authenticate with user interaction as appropriate. if (authResult?.ResponseStatus != WebTokenRequestStatus.Success) diff --git a/CommunityToolkit.Authentication/BaseProvider.cs b/CommunityToolkit.Authentication/BaseProvider.cs index 4a0c5d5..cbeaeb6 100644 --- a/CommunityToolkit.Authentication/BaseProvider.cs +++ b/CommunityToolkit.Authentication/BaseProvider.cs @@ -52,7 +52,7 @@ public BaseProvider() public abstract Task AuthenticateRequestAsync(HttpRequestMessage request); /// - public abstract Task GetTokenAsync(bool silentOnly = false, string[] scopes = null); + public abstract Task GetTokenAsync(bool silentOnly = false); /// public abstract Task SignInAsync(); diff --git a/CommunityToolkit.Authentication/IProvider.cs b/CommunityToolkit.Authentication/IProvider.cs index a9d0e84..cd065a2 100644 --- a/CommunityToolkit.Authentication/IProvider.cs +++ b/CommunityToolkit.Authentication/IProvider.cs @@ -39,9 +39,8 @@ public interface IProvider /// Retrieve a token for the authenticated user. /// /// Determines if the acquisition should be done without prompts to the user. - /// Optional parameter for setting scopes specific to this token request. /// A token string for the authenticated user. - Task GetTokenAsync(bool silentOnly = false, string[] scopes = null); + Task GetTokenAsync(bool silentOnly = false); /// /// Sign in the user. diff --git a/CommunityToolkit.Authentication/MockProvider.cs b/CommunityToolkit.Authentication/MockProvider.cs index 67e261d..d66e63b 100644 --- a/CommunityToolkit.Authentication/MockProvider.cs +++ b/CommunityToolkit.Authentication/MockProvider.cs @@ -52,7 +52,7 @@ public override async Task AuthenticateRequestAsync(HttpRequestMessage request) } /// - public override Task GetTokenAsync(bool silentOnly = false, string[] scopes = null) + public override Task GetTokenAsync(bool silentOnly = false) { return Task.FromResult(""); }