fix: don't pass CancellationToken to method that shouldn't abort
also add license header to project
This commit is contained in:
		
							parent
							
								
									d982342ab8
								
							
						
					
					
						commit
						5a22807410
					
				
					 3 changed files with 21 additions and 11 deletions
				
			
		|  | @ -28,18 +28,15 @@ public class DiscordAuthController( | |||
|     // TODO: duplicating attribute doesn't work, find another way to mark both as possible response | ||||
|     // leaving it here for documentation purposes | ||||
|     [ProducesResponseType<AuthController.CallbackResponse>(StatusCodes.Status200OK)] | ||||
|     public async Task<IActionResult> CallbackAsync( | ||||
|         [FromBody] AuthController.CallbackRequest req, | ||||
|         CancellationToken ct = default | ||||
|     ) | ||||
|     public async Task<IActionResult> CallbackAsync([FromBody] AuthController.CallbackRequest req) | ||||
|     { | ||||
|         CheckRequirements(); | ||||
|         await keyCacheService.ValidateAuthStateAsync(req.State, ct); | ||||
|         await keyCacheService.ValidateAuthStateAsync(req.State); | ||||
| 
 | ||||
|         var remoteUser = await remoteAuthService.RequestDiscordTokenAsync(req.Code, req.State, ct); | ||||
|         var user = await authService.AuthenticateUserAsync(AuthType.Discord, remoteUser.Id, ct: ct); | ||||
|         var remoteUser = await remoteAuthService.RequestDiscordTokenAsync(req.Code); | ||||
|         var user = await authService.AuthenticateUserAsync(AuthType.Discord, remoteUser.Id); | ||||
|         if (user != null) | ||||
|             return Ok(await GenerateUserTokenAsync(user, ct)); | ||||
|             return Ok(await GenerateUserTokenAsync(user)); | ||||
| 
 | ||||
|         _logger.Debug( | ||||
|             "Discord user {Username} ({Id}) authenticated with no local account", | ||||
|  | @ -51,8 +48,7 @@ public class DiscordAuthController( | |||
|         await keyCacheService.SetKeyAsync( | ||||
|             $"discord:{ticket}", | ||||
|             remoteUser, | ||||
|             Duration.FromMinutes(20), | ||||
|             ct | ||||
|             Duration.FromMinutes(20) | ||||
|         ); | ||||
| 
 | ||||
|         return Ok( | ||||
|  |  | |||
|  | @ -13,7 +13,6 @@ public class RemoteAuthService(Config config, ILogger logger) | |||
| 
 | ||||
|     public async Task<RemoteUser> RequestDiscordTokenAsync( | ||||
|         string code, | ||||
|         string state, | ||||
|         CancellationToken ct = default | ||||
|     ) | ||||
|     { | ||||
|  |  | |||
|  | @ -1,3 +1,18 @@ | |||
| <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||||
| 	<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (C) 2023-present sam/u1f320 (vulpine.solutions) | ||||
| 
 | ||||
| This program is free software: you can redistribute it and/or modify | ||||
| it under the terms of the GNU Affero General Public License as published | ||||
| by the Free Software Foundation, either version 3 of the License, or | ||||
| (at your option) any later version. | ||||
| 
 | ||||
| This program is distributed in the hope that it will be useful, | ||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| GNU Affero General Public License for more details. | ||||
| 
 | ||||
| You should have received a copy of the GNU Affero General Public License | ||||
| along with this program.  If not, see <https://www.gnu.org/licenses/>.</s:String> | ||||
| 	<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean> | ||||
| 	<s:Boolean x:Key="/Default/UserDictionary/Words/=foxnouns/@EntryIndexedValue">True</s:Boolean> | ||||
| 	<s:Boolean x:Key="/Default/UserDictionary/Words/=pronounscc/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue