Skip to content

Commit 392f141

Browse files
committed
Remove unused attributes, slightly improve logging
1 parent fb791c1 commit 392f141

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

Refresh.Core/Services/BlueSphereClientService.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,14 @@ namespace Refresh.Core.Services;
1515
public class BlueSphereClientService : EndpointService
1616
{
1717
private readonly HttpClient _client;
18-
private readonly GameServerConfig _config;
19-
private readonly IntegrationConfig _integration;
20-
private readonly ContactInfoConfig _contact;
21-
private readonly TimeProviderService _timeProviderService;
2218

23-
public BlueSphereClientService(Logger logger, GameServerConfig config, IntegrationConfig integration, ContactInfoConfig contact, TimeProviderService timeProviderService) : base(logger)
19+
public BlueSphereClientService(Logger logger, GameServerConfig config, IntegrationConfig integration, ContactInfoConfig contact) : base(logger)
2420
{
2521
if (!integration.BlueSphereEnabled)
2622
{
2723
throw new InvalidOperationException($"Cannot construct BlueSphereClientService because integration is disabled. This should be caught beforehand!");
2824
}
2925

30-
this._config = config;
31-
this._integration = integration;
32-
this._contact = contact;
33-
this._timeProviderService = timeProviderService;
34-
3526
this._client = new HttpClient
3627
{
3728
BaseAddress = new Uri(integration.BlueSphereBaseUrl),
@@ -52,6 +43,7 @@ public async Task<BsOAuthResponse> VerifyOAuthCode(string username, string code)
5243

5344
string serializedRequest = JsonConvert.SerializeObject(request);
5445
this.Logger.LogDebug(BunkumCategory.Authentication, $"Sending verification request to BlueSphere for username '{username}', code '{code}': '{serializedRequest}'");
46+
5547
HttpResponseMessage message = await this._client.PostAsync("/api/verify", new StringContent(serializedRequest));
5648

5749
string serializedResponse = Encoding.UTF8.GetString(await message.Content.ReadAsByteArrayAsync());
@@ -63,11 +55,11 @@ public async Task<BsOAuthResponse> VerifyOAuthCode(string username, string code)
6355
BsErrorResponse? error = JsonConvert.DeserializeObject<BsErrorResponse>(serializedResponse);
6456
if (error == null) throw new BsOAuthException($"Couldn't deserialize error response for {code}! (status: {message.StatusCode})");
6557

66-
throw new BsOAuthException($"Authentication failed for {code} (status: {message.StatusCode}): '{error.Error}'");
58+
throw new BsOAuthException($"Authentication failed for code '{code}' (status: {message.StatusCode}): '{error.Error}'");
6759
}
6860

6961
BsOAuthResponse? success = JsonConvert.DeserializeObject<BsOAuthResponse>(serializedResponse);
70-
if (success == null) throw new BsOAuthException($"Couldn't deserialize success response for {code}!");
62+
if (success == null) throw new BsOAuthException($"Couldn't deserialize success response for code '{code}'!");
7163

7264
return success;
7365
}

0 commit comments

Comments
 (0)