mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Some stuff for auth * Holy crap auth works * Enable encryption even if no auth token is provided. It's still possible that the public key was retrieved over HTTPS via the status API, in which case it will be secure. * Fix integration test compile. * Secure CVar API. * Literally rewrite the auth protocol to be minecraft's. * Better exception tolerance in server handshake. * Auth works from launcher. * Fix some usages of UserID instead of UserName * Fix auth.server CVar * Kick existing connection if same account connects twice. * Username assignment, guest session distinguishing. * Necessary work to make bans work. * Expose LoginType to OnConnecting. * Fixing tests and warnings.
31 lines
701 B
C#
31 lines
701 B
C#
using System;
|
|
|
|
namespace Robust.Shared.Interfaces.Network
|
|
{
|
|
public struct NetApproval
|
|
{
|
|
public bool IsApproved => _denyReason == null;
|
|
|
|
public string DenyReason => _denyReason != null
|
|
? _denyReason!
|
|
: throw new InvalidOperationException("This was not a denial.");
|
|
|
|
private readonly string? _denyReason;
|
|
|
|
private NetApproval(string? denyReason)
|
|
{
|
|
_denyReason = denyReason;
|
|
}
|
|
|
|
public static NetApproval Deny(string reason)
|
|
{
|
|
return new NetApproval(reason);
|
|
}
|
|
|
|
public static NetApproval Allow()
|
|
{
|
|
return new NetApproval(null);
|
|
}
|
|
}
|
|
}
|