mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-04-03 20:08:21 +00:00
Auth
This commit is contained in:
@@ -19,7 +19,9 @@ public class SendList : BinaryList
|
|||||||
|
|
||||||
public override AsyncReply<object[]> Done()
|
public override AsyncReply<object[]> Done()
|
||||||
{
|
{
|
||||||
connection.Send(this.ToArray());
|
var s = this.ToArray();
|
||||||
|
//Console.WriteLine($"Sending {s.Length} -> {DC.ToHex(s)}");
|
||||||
|
connection.Send(s);
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -644,6 +644,8 @@ public partial class EpConnection : NetworkConnection, IStore
|
|||||||
{
|
{
|
||||||
offset += (uint)rt;
|
offset += (uint)rt;
|
||||||
|
|
||||||
|
//Console.WriteLine($"AuthPacket: RT: {rt} {authPacket.ToString()}");
|
||||||
|
|
||||||
if (authPacket.Command == EpAuthPacketCommand.Initialize && isInitiator)
|
if (authPacket.Command == EpAuthPacketCommand.Initialize && isInitiator)
|
||||||
throw new Exception("Bad authentication packet received. Connection is initiator but received an initialization packet.");
|
throw new Exception("Bad authentication packet received. Connection is initiator but received an initialization packet.");
|
||||||
|
|
||||||
@@ -672,6 +674,7 @@ public partial class EpConnection : NetworkConnection, IStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
//@TODO allow all for testing
|
//@TODO allow all for testing
|
||||||
|
AuthenticatonCompleted("guest");
|
||||||
SendParams()
|
SendParams()
|
||||||
.AddUInt8((byte)EpAuthPacketAcknowledgement.SessionEstablished)
|
.AddUInt8((byte)EpAuthPacketAcknowledgement.SessionEstablished)
|
||||||
.Done();
|
.Done();
|
||||||
@@ -762,7 +765,8 @@ public partial class EpConnection : NetworkConnection, IStore
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AuthenticatonCompleted(string identity)
|
void AuthenticatonCompleted(string identity)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (this.Instance == null)
|
if (this.Instance == null)
|
||||||
{
|
{
|
||||||
Server.Instance.Warehouse.Put(
|
Server.Instance.Warehouse.Put(
|
||||||
@@ -770,8 +774,8 @@ public partial class EpConnection : NetworkConnection, IStore
|
|||||||
.Then(x =>
|
.Then(x =>
|
||||||
{
|
{
|
||||||
session.AuthorizedIdentity = identity;
|
session.AuthorizedIdentity = identity;
|
||||||
|
|
||||||
authenticated = true;
|
authenticated = true;
|
||||||
|
|
||||||
Status = EpConnectionStatus.Connected;
|
Status = EpConnectionStatus.Connected;
|
||||||
openReply?.Trigger(true);
|
openReply?.Trigger(true);
|
||||||
openReply = null;
|
openReply = null;
|
||||||
@@ -1500,7 +1504,6 @@ public partial class EpConnection : NetworkConnection, IStore
|
|||||||
|
|
||||||
var chunkId = (new Random()).Next(1000, 1000000);
|
var chunkId = (new Random()).Next(1000, 1000000);
|
||||||
|
|
||||||
|
|
||||||
this.Socket.Hold();
|
this.Socket.Hold();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user