WIP: authentication rework

This commit is contained in:
Francesco Tolomei 2022-04-07 00:05:14 +02:00
parent f04cf02b4e
commit e2459f7982
No known key found for this signature in database
GPG key ID: 413C3451D6179D06
2 changed files with 13 additions and 3 deletions

View file

@ -84,7 +84,7 @@ def main():
client_secret=args.secret, client_secret=args.secret,
redirect_uri=args.uri redirect_uri=args.uri
) )
enabled_addons = set(a.lower() for a in args.add) enabled_addons = set(a.lower() for a in args.add)
for addon in addons: for addon in addons:
if addon.__name__.lower() in enabled_addons: if addon.__name__.lower() in enabled_addons:

View file

@ -17,6 +17,7 @@ from aiocraft.client import MinecraftClient
from aiocraft.util import helpers from aiocraft.util import helpers
from aiocraft.mc.packet import Packet from aiocraft.mc.packet import Packet
from aiocraft.mc.definitions import ConnectionState from aiocraft.mc.definitions import ConnectionState
from aiocraft.mc.auth import AuthInterface, MicrosoftAuthenticator, MojangAuthenticator
from aiocraft.mc.proto import PacketSetCompression, PacketKickDisconnect from aiocraft.mc.proto import PacketSetCompression, PacketKickDisconnect
from aiocraft.mc.proto.play.clientbound import PacketKeepAlive from aiocraft.mc.proto.play.clientbound import PacketKeepAlive
from aiocraft.mc.proto.play.serverbound import PacketKeepAlive as PacketKeepAliveResponse from aiocraft.mc.proto.play.serverbound import PacketKeepAlive as PacketKeepAliveResponse
@ -97,8 +98,17 @@ class Treepuncher(
_processing : bool _processing : bool
def __init__(self, name:str, *args, config_file:str=None, notifier:Notifier=None, **kwargs): def __init__(
super().__init__(*args, **kwargs) self,
name:str,
server:str,
config_file:str=None,
notifier:Notifier=None,
online_mode:bool=True,
authenticator:Optional[AuthInterface]=None,
**kwargs
):
super().__init__(server, online_mode=online_mode, authenticator=authenticator, username=name)
self.ctx = dict() self.ctx = dict()
self.name = name self.name = name