// TODO: Actually implement permissions
@Override
    public void handleIncoming(SoeUdpConnection connection, ClientIdMsg message) throws Exception {
        // Validate client version
        if (!message.getClientVersion().equals(requiredClientVersion)) {
            ErrorMessage error = new ErrorMessage("Login Error", "The client you are attempting to connect with does not match that required by the server.", false);
            connection.sendMessage(error);
            logger.info("Sending Client Error");
            return;
        }
        SoeAccount account = accountService.validateSession(message.getToken());
        if (account == null) {
            ErrorMessage error = new ErrorMessage("Error", "Invalid Session", false);
            connection.sendMessage(error);
            logger.info("Invalid Session: " + message.getToken());
            return;
        }
        connection.setAccountId(account.getId());
        connection.setAccountUsername(account.getUsername());
        connection.addRole(ConnectionRole.AUTHENTICATED);
        // TODO: Actually implement permissions
        ClientPermissionsMessage cpm = new ClientPermissionsMessage(true, true, true, true);
        connection.sendMessage(cpm);
    }
connection.setAccountUsername(account.getUsername());
connection.addRole(ConnectionRole.AUTHENTICATED);
// TODO: Actually implement permissions
ClientPermissionsMessage cpm = new ClientPermissionsMessage(true, true, true, true);
connection.sendMessage(cpm);
SoeAccount account = accountService.validateSession(message.getToken());
if (account == null) {
ErrorMessage error = new ErrorMessage("Error", "Invalid Session", false);
connection.sendMessage(error);
logger.info("Invalid Session: " + message.getToken());
return;
}
connection.setAccountId(account.getId());
connection.setAccountUsername(account.getUsername());
connection.addRole(ConnectionRole.AUTHENTICATED);
// TODO: Actually implement permissions
ClientPermissionsMessage cpm = new ClientPermissionsMessage(true, true, true, true);
connection.sendMessage(cpm);
}
@Override
public void handleIncoming(SoeUdpConnection connection, ClientIdMsg message) throws Exception {
// Validate client version
if (!message.getClientVersion().equals(requiredClientVersion)) {
ErrorMessage error = new ErrorMessage("Login Error", "The client you are attempting to connect with does not match that required by the server.", false);
connection.sendMessage(error);
logger.info("Sending Client Error");
return;
}
SoeAccount account = accountService.validateSession(message.getToken());
if (account == null) {
ErrorMessage error = new ErrorMessage("Error", "Invalid Session", false);
connection.sendMessage(error);
logger.info("Invalid Session: " + message.getToken());
return;
}
connection.setAccountId(account.getId());
connection.setAccountUsername(account.getUsername());
connection.addRole(ConnectionRole.AUTHENTICATED);
// TODO: Actually implement permissions
ClientPermissionsMessage cpm = new ClientPermissionsMessage(true, true, true, true);
connection.sendMessage(cpm);
}