Files
SVSimServer/SVSim.EmulatedEntrypoint/Services/DevAlwaysValidSteamServer.cs
gamer147 c27bf444a5 refactor(auth): drop null-guard on dev steam ticket log; add test fixture doc
ISteamServer contract forbids null tickets (prod impl and sole caller both assume non-null),
so the dev bypass no longer needs the ?. / ?? 0 defensive form. Also adds a class-level XML
doc summary to DevAlwaysValidSteamServerTests matching the style of other fixtures in the suite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 09:06:26 -04:00

32 lines
1.2 KiB
C#

using Microsoft.Extensions.Logging;
namespace SVSim.EmulatedEntrypoint.Services;
/// <summary>
/// Development-only <see cref="ISteamServer"/> that accepts every ticket without contacting
/// Steam. Selected in <c>Program.cs</c> when <c>Auth:BypassSteamTicket</c> is true, so clients
/// with a synthetic (non-Steam) identity — e.g. a second instance on the same machine for the
/// two-client PvP smoke — can authenticate. NEVER select this outside local dev: it turns the
/// Steam ticket gate into a no-op for the whole process.
/// </summary>
public sealed class DevAlwaysValidSteamServer : ISteamServer
{
private readonly ILogger<DevAlwaysValidSteamServer> _logger;
public DevAlwaysValidSteamServer(ILogger<DevAlwaysValidSteamServer> logger) => _logger = logger;
public void Initialize(int appId) { }
public bool BeginAuthSession(byte[] ticket, ulong steamId)
{
_logger.LogWarning(
"DEV Steam bypass: accepting ticket for steamId {SteamId} WITHOUT validation (ticketLen={Len}).",
steamId, ticket.Length);
return true;
}
public void EndSession(ulong steamId) { }
public void Shutdown() { }
}