mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 21:16:52 +01:00
Nullify GenericOAuthValidator
This commit is contained in:
@@ -16,8 +16,6 @@ using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Common.Http;
|
||||
using Tgstation.Server.Host.Configuration;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Tgstation.Server.Host.Security.OAuth
|
||||
{
|
||||
/// <summary>
|
||||
@@ -82,11 +80,11 @@ namespace Tgstation.Server.Host.Security.OAuth
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async ValueTask<string> ValidateResponseCode(string code, CancellationToken cancellationToken)
|
||||
public async ValueTask<string?> ValidateResponseCode(string code, CancellationToken cancellationToken)
|
||||
{
|
||||
using var httpClient = CreateHttpClient();
|
||||
string tokenResponsePayload = null;
|
||||
string userInformationPayload = null;
|
||||
string? tokenResponsePayload = null;
|
||||
string? userInformationPayload = null;
|
||||
try
|
||||
{
|
||||
Logger.LogTrace("Validating response code...");
|
||||
@@ -99,7 +97,7 @@ namespace Tgstation.Server.Host.Security.OAuth
|
||||
tokenRequestPayload,
|
||||
SerializerSettings());
|
||||
|
||||
var tokenRequestDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(tokenRequestJson);
|
||||
var tokenRequestDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(tokenRequestJson)!;
|
||||
tokenRequest.Content = new FormUrlEncodedContent(tokenRequestDictionary);
|
||||
|
||||
using var tokenResponse = await httpClient.SendAsync(tokenRequest, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user