Files
Vanadium-2023-2025-Leak-Server/Guard/Server/Security/IPlayerAuthenticator.cs
T
skidfire fe3468c65d yikes,
2026-09-06 19:59:27 -04:00

30 lines
1.1 KiB
C#

using System.Threading.Tasks;
namespace VanadiumGuard.Server.Security
{
/// <summary>
/// Verifies the bearer token a client presents at session open and returns the player
/// id it belongs to. Implement this against your existing auth service.
/// </summary>
public interface IPlayerAuthenticator
{
/// <summary>Returns the authenticated player id, or null when the token is not valid.</summary>
Task<string?> AuthenticateAsync(string? bearerToken);
}
/// <summary>
/// Development stand-in that trusts whatever the client claims.
/// <para>
/// It refuses to run outside Development precisely because trusting the client about
/// who it is would let anyone file detections against anyone else.
/// </para>
/// </summary>
public sealed class TrustClaimedIdentityAuthenticator : IPlayerAuthenticator
{
public Task<string?> AuthenticateAsync(string? bearerToken)
{
return Task.FromResult<string?>(string.IsNullOrEmpty(bearerToken) ? null : bearerToken);
}
}
}