mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02: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.
47 lines
1001 B
C#
47 lines
1001 B
C#
using System;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Robust.Shared.Network
|
|
{
|
|
[Serializable, NetSerializable]
|
|
public struct NetUserId : IEquatable<NetUserId>
|
|
{
|
|
public readonly Guid UserId;
|
|
|
|
public NetUserId(Guid userId)
|
|
{
|
|
UserId = userId;
|
|
}
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
return obj is NetUserId id && Equals(id);
|
|
}
|
|
|
|
public bool Equals(NetUserId other)
|
|
{
|
|
return UserId == other.UserId;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return UserId.GetHashCode();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return UserId.ToString();
|
|
}
|
|
|
|
public static bool operator ==(NetUserId id1, NetUserId id2)
|
|
{
|
|
return id1.Equals(id2);
|
|
}
|
|
|
|
public static bool operator !=(NetUserId id1, NetUserId id2)
|
|
{
|
|
return !(id1 == id2);
|
|
}
|
|
}
|
|
}
|