Validate login request and refactor login handling
This commit is contained in:
@@ -16,8 +16,18 @@ public class SteamAuthValidator(ISteamAuthService steamAuthService) : IPlatformA
|
||||
string platformId,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
var steamParams = JsonSerializer.Deserialize<SteamPlatformAuth>(platformAuthentication);
|
||||
if (steamParams == null)
|
||||
SteamPlatformAuth? steamParams;
|
||||
|
||||
try
|
||||
{
|
||||
steamParams = JsonSerializer.Deserialize<SteamPlatformAuth>(platformAuthentication);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return PlatformAuthResult.Failure("Invalid authentication");
|
||||
}
|
||||
|
||||
if (steamParams?.AppId is null || string.IsNullOrWhiteSpace(steamParams.Ticket))
|
||||
return PlatformAuthResult.Failure("Invalid authentication");
|
||||
|
||||
var result = await steamAuthService.AuthorizeAsync(steamParams.Ticket, steamParams.AppId.AppId, ct);
|
||||
|
||||
Reference in New Issue
Block a user