♻️ 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:
2025-11-02 14:58:23 +08:00
parent 74a9ca98ad
commit b9edf51f05
8 changed files with 81 additions and 13 deletions

View File

@@ -16,6 +16,11 @@ public class DiscordOidcService(
protected override string DiscoveryEndpoint => ""; // Discord doesn't have a standard OIDC discovery endpoint
protected override string ConfigSectionName => "Discord";
public override Task<string> GetAuthorizationUrlAsync(string state, string nonce)
{
return Task.FromResult(GetAuthorizationUrl(state, nonce));
}
public override string GetAuthorizationUrl(string state, string nonce)
{
var config = GetProviderConfig();
@@ -111,4 +116,4 @@ public class DiscordOidcService(
Provider = ProviderName
};
}
}
}