File tree Expand file tree Collapse file tree 5 files changed +11
-8
lines changed
Expand file tree Collapse file tree 5 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -171,9 +171,10 @@ public override async Task SignOutAsync()
171171 }
172172
173173 /// <inheritdoc/>
174- public override Task < string > GetTokenAsync ( bool silentOnly = false )
174+ public override Task < string > GetTokenAsync ( bool silentOnly = false , string [ ] scopes = null )
175175 {
176- return this . GetTokenWithScopesAsync ( Scopes , silentOnly ) ;
176+ var withScopes = scopes ?? this . Scopes ;
177+ return this . GetTokenWithScopesAsync ( withScopes , silentOnly ) ;
177178 }
178179
179180 /// <summary>
Original file line number Diff line number Diff line change @@ -184,16 +184,17 @@ public override async Task SignOutAsync()
184184 }
185185
186186 /// <inheritdoc />
187- public override async Task < string > GetTokenAsync ( bool silentOnly = false )
187+ public override async Task < string > GetTokenAsync ( bool silentOnly = false , string [ ] scopes = null )
188188 {
189189 await SemaphoreSlim . WaitAsync ( ) ;
190190
191191 try
192192 {
193- var scopes = _scopes ;
193+ // use request specific scopes if not null, otherwise use class scopes
194+ var authenticationScopes = scopes ?? this . _scopes ;
194195
195196 // Attempt to authenticate silently.
196- var authResult = await AuthenticateSilentAsync ( scopes ) ;
197+ var authResult = await AuthenticateSilentAsync ( authenticationScopes ) ;
197198
198199 // Authenticate with user interaction as appropriate.
199200 if ( authResult ? . ResponseStatus != WebTokenRequestStatus . Success )
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public BaseProvider()
5252 public abstract Task AuthenticateRequestAsync ( HttpRequestMessage request ) ;
5353
5454 /// <inheritdoc />
55- public abstract Task < string > GetTokenAsync ( bool silentOnly = false ) ;
55+ public abstract Task < string > GetTokenAsync ( bool silentOnly = false , string [ ] scopes = null ) ;
5656
5757 /// <inheritdoc />
5858 public abstract Task SignInAsync ( ) ;
Original file line number Diff line number Diff line change @@ -39,8 +39,9 @@ public interface IProvider
3939 /// Retrieve a token for the authenticated user.
4040 /// </summary>
4141 /// <param name="silentOnly">Determines if the acquisition should be done without prompts to the user.</param>
42+ /// <param name="scopes"> Optional parameter for setting scopes specific to this token request. </param>
4243 /// <returns>A token string for the authenticated user.</returns>
43- Task < string > GetTokenAsync ( bool silentOnly = false ) ;
44+ Task < string > GetTokenAsync ( bool silentOnly = false , string [ ] scopes = null ) ;
4445
4546 /// <summary>
4647 /// Sign in the user.
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public override async Task AuthenticateRequestAsync(HttpRequestMessage request)
5252 }
5353
5454 /// <inheritdoc/>
55- public override Task < string > GetTokenAsync ( bool silentOnly = false )
55+ public override Task < string > GetTokenAsync ( bool silentOnly = false , string [ ] scopes = null )
5656 {
5757 return Task . FromResult ( "<mock-provider-token>" ) ;
5858 }
You can’t perform that action at this time.
0 commit comments