♻️ Refactor OpenID: Phase 3: Async Flow Modernization
- Added async GetAuthorizationUrlAsync() methods to all OIDC providers - Updated base OidcService with abstract async contract and backward-compatible sync wrapper - Modified OidcController to use async authorization URL generation - Removed sync blocks using .GetAwaiter().GetResult() in Google provider - Maintained backward compatibility with existing sync method calls - Eliminated thread blocking and improved async flow throughout auth pipeline - Enhanced scalability by allowing non-blocking async authorization URL generation
This commit is contained in:
		@@ -43,7 +43,7 @@ public class OidcController(
 | 
			
		||||
                await cache.SetAsync($"{StateCachePrefix}{state}", oidcState, StateExpiration);
 | 
			
		||||
 | 
			
		||||
                // The state parameter sent to the provider is the GUID key for the cache.
 | 
			
		||||
                var authUrl = oidcService.GetAuthorizationUrl(state, nonce);
 | 
			
		||||
                var authUrl = await oidcService.GetAuthorizationUrlAsync(state, nonce);
 | 
			
		||||
                return Redirect(authUrl);
 | 
			
		||||
            }
 | 
			
		||||
            else // Otherwise, proceed with the login / registration flow
 | 
			
		||||
@@ -54,7 +54,7 @@ public class OidcController(
 | 
			
		||||
                // Create login state with return URL and device ID
 | 
			
		||||
                var oidcState = OidcState.ForLogin(returnUrl ?? "/", deviceId);
 | 
			
		||||
                await cache.SetAsync($"{StateCachePrefix}{state}", oidcState, StateExpiration);
 | 
			
		||||
                var authUrl = oidcService.GetAuthorizationUrl(state, nonce);
 | 
			
		||||
                var authUrl = await oidcService.GetAuthorizationUrlAsync(state, nonce);
 | 
			
		||||
                return Redirect(authUrl);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -194,4 +194,4 @@ public class OidcController(
 | 
			
		||||
 | 
			
		||||
        return newAccount;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user