mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 21:16:52 +01:00
Remove support for old /tg/ forums OAuthValidator
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace Tgstation.Server.Api.Models
|
||||
@@ -20,8 +22,9 @@ namespace Tgstation.Server.Api.Models
|
||||
Discord,
|
||||
|
||||
/// <summary>
|
||||
/// https://tgstation13.org.
|
||||
/// Pre-hostening https://tgstation13.org. No longer supported.
|
||||
/// </summary>
|
||||
[Obsolete("tgstation13.org no longer has a custom OAuth solution", true)]
|
||||
TGForums,
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace Tgstation.Server.Host.GraphQL.Types.OAuth
|
||||
|
||||
Discord = TryBuild(OAuthProvider.Discord, info => new BasicOAuthProviderInfo(info));
|
||||
GitHub = TryBuild(OAuthProvider.GitHub, info => new RedirectOAuthProviderInfo(info));
|
||||
TGForums = TryBuild(OAuthProvider.TGForums, info => new RedirectOAuthProviderInfo(info));
|
||||
Keycloak = TryBuild(OAuthProvider.Keycloak, info => new FullOAuthProviderInfo(info));
|
||||
InvisionCommunity = TryBuild(OAuthProvider.InvisionCommunity, info => new FullOAuthProviderInfo(info));
|
||||
}
|
||||
|
||||
@@ -57,13 +57,6 @@ namespace Tgstation.Server.Host.Security.OAuth
|
||||
loggerFactory.CreateLogger<DiscordOAuthValidator>(),
|
||||
discordConfig));
|
||||
|
||||
if (securityConfiguration.OAuth.TryGetValue(OAuthProvider.TGForums, out var tgConfig))
|
||||
validatorsBuilder.Add(
|
||||
new TGForumsOAuthValidator(
|
||||
httpClientFactory,
|
||||
loggerFactory.CreateLogger<TGForumsOAuthValidator>(),
|
||||
tgConfig));
|
||||
|
||||
if (securityConfiguration.OAuth.TryGetValue(OAuthProvider.Keycloak, out var keyCloakConfig))
|
||||
validatorsBuilder.Add(
|
||||
new KeycloakOAuthValidator(
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Tgstation.Server.Api.Models;
|
||||
using Tgstation.Server.Common.Http;
|
||||
using Tgstation.Server.Host.Configuration;
|
||||
|
||||
namespace Tgstation.Server.Host.Security.OAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// <see cref="IOAuthValidator"/> for /tg/ forums.
|
||||
/// </summary>
|
||||
sealed class TGForumsOAuthValidator : GenericOAuthValidator
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override OAuthProvider Provider => OAuthProvider.TGForums;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Uri TokenUrl => new("https://tgstation13.org/phpBB/app.php/tgapi/oauth/token");
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Uri UserInformationUrl => new("https://tgstation13.org/phpBB/app.php/tgapi/user/me");
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TGForumsOAuthValidator"/> class.
|
||||
/// </summary>
|
||||
/// <param name="httpClientFactory">The <see cref="IAbstractHttpClientFactory"/> for the <see cref="GenericOAuthValidator"/>.</param>
|
||||
/// <param name="logger">The <see cref="ILogger"/> for the <see cref="GenericOAuthValidator"/>.</param>
|
||||
/// <param name="oAuthConfiguration">The <see cref="OAuthConfiguration"/> for the <see cref="GenericOAuthValidator"/>.</param>
|
||||
public TGForumsOAuthValidator(
|
||||
IAbstractHttpClientFactory httpClientFactory,
|
||||
ILogger<TGForumsOAuthValidator> logger,
|
||||
OAuthConfiguration oAuthConfiguration)
|
||||
: base(
|
||||
httpClientFactory,
|
||||
logger,
|
||||
oAuthConfiguration)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override string DecodeTokenPayload(dynamic responseJson) => responseJson.access_token;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override string DecodeUserInformationPayload(dynamic responseJson) => responseJson.phpbb_username;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override OAuthTokenRequest CreateTokenRequest(string code) => new(OAuthConfiguration, code, "user");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user