34 lines
974 B
C#
34 lines
974 B
C#
using Tiger.Communication.Messages.Interfaces;
|
|
using Tiger.Communication.Messages.Outgoing.Handshake;
|
|
using Tiger.Communication.Messages.Types;
|
|
using Tiger.Game.Habbos;
|
|
using Tiger.Networking.Game.Sessions;
|
|
using Tiger.Storage;
|
|
|
|
namespace Tiger.Communication.Messages.Incoming.Handshake;
|
|
|
|
public class SsoEvent : IMessageEvent
|
|
{
|
|
private readonly IRepository<Habbo> _habboRepository;
|
|
|
|
public SsoEvent(IRepository<Habbo> habboRepository)
|
|
{
|
|
_habboRepository = habboRepository;
|
|
}
|
|
|
|
public IncomingHeaders Header => IncomingHeaders.Sso;
|
|
public async Task HandleAsync(GameSession gameSession, ClientMessage request)
|
|
{
|
|
var habbo = await _habboRepository.FindOneByAsync(h => h.SsoTicket == request.ReadString());
|
|
|
|
if (habbo == null)
|
|
{
|
|
await gameSession.CloseAsync();
|
|
return;
|
|
}
|
|
|
|
gameSession.Habbo = habbo;
|
|
|
|
await gameSession.SendComposerAsync(new LoginOkComposer());
|
|
}
|
|
} |