major refactor: auth v3
This commit is contained in:
parent
8a8b4b2573
commit
179d21d7b6
18 changed files with 376 additions and 166 deletions
|
|
@ -16,7 +16,6 @@
|
|||
#include "Settings.h"
|
||||
#include "..\Minecraft.World\HandshakeManager.h"
|
||||
#include "..\Minecraft.World\SessionAuthModule.h"
|
||||
#include "..\Minecraft.World\OfflineAuthModule.h"
|
||||
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
||||
#include "..\Minecraft.Server\ServerLogManager.h"
|
||||
#include "..\Minecraft.Server\Access\Access.h"
|
||||
|
|
@ -105,8 +104,14 @@ void PendingConnection::disconnect(DisconnectPacket::eDisconnectReason reason)
|
|||
|
||||
void PendingConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||
{
|
||||
if (handshakeManager && !authComplete)
|
||||
if (!authComplete)
|
||||
{
|
||||
if (!handshakeManager)
|
||||
{
|
||||
app.DebugPrintf("PendingConnection: PreLogin received without auth handshake, disconnecting\n");
|
||||
disconnect(DisconnectPacket::eDisconnect_AuthFailed);
|
||||
return;
|
||||
}
|
||||
app.DebugPrintf("PendingConnection: PreLogin received before auth complete, disconnecting\n");
|
||||
disconnect(DisconnectPacket::eDisconnect_Closed);
|
||||
return;
|
||||
|
|
@ -413,10 +418,12 @@ bool PendingConnection::isDisconnected()
|
|||
void PendingConnection::initAuth()
|
||||
{
|
||||
handshakeManager = new HandshakeManager(true);
|
||||
if (server->authMode == "session")
|
||||
handshakeManager->registerModule(std::make_unique<SessionAuthModule>());
|
||||
else
|
||||
handshakeManager->registerModule(std::make_unique<SessionAuthModule>());
|
||||
if (server->authMode != "session")
|
||||
{
|
||||
handshakeManager->registerModule(std::make_unique<KeypairOfflineAuthModule>());
|
||||
handshakeManager->registerModule(std::make_unique<OfflineAuthModule>());
|
||||
}
|
||||
}
|
||||
|
||||
void PendingConnection::handleAuth(const shared_ptr<AuthPacket> &packet)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue