Examples of SecuredLoginInfo


Examples of marauroa.server.game.container.PlayerEntry.SecuredLoginInfo

      // verify event
      if (!isValidEvent(msg, entry, ClientState.CONNECTION_ACCEPTED)) {
        return;
      }

      SecuredLoginInfo info = fillLoginInfo(msg, entry);
      DBCommand command = new LoginCommand(info,
          this, entry.clientid,
          msg.getSocketChannel(), msg.getProtocolVersion());
      DBCommandQueue.get().enqueue(command);
  }
View Full Code Here

Examples of marauroa.server.game.container.PlayerEntry.SecuredLoginInfo

    entry.state = ClientState.LOGIN_COMPLETE;
  }

  private SecuredLoginInfo fillLoginInfo(Message msg, PlayerEntry entry) {
    SecuredLoginInfo info = entry.loginInformations;

    if (msg instanceof MessageC2SLoginSendNonceNameAndPassword) {
      MessageC2SLoginSendNonceNameAndPassword msgLogin = (MessageC2SLoginSendNonceNameAndPassword) msg;
      info.clientNonce = msgLogin.getHash();
      info.username = msgLogin.getUsername();
View Full Code Here

Examples of marauroa.server.game.container.PlayerEntry.SecuredLoginInfo


  public void handleDelayedEvent(RPServerManager rpMan, Object data) {
    try {
      LoginCommand command = (LoginCommand) data;
      SecuredLoginInfo info = command.getInfo();

      /*
       * We check that player didn't failed too many time the login, if it
       * did, we reject the login request until the block pass.
       */
      if (command.getFailReason() == MessageS2CLoginNACK.Reasons.TOO_MANY_TRIES) {
        logger.debug("Blocked account for player " + info.username + " and/or address " + info.address);

        /* Send player the Login NACK message */
        MessageS2CLoginNACK msgLoginNACK = new MessageS2CLoginNACK(command.getChannel(),
                MessageS2CLoginNACK.Reasons.TOO_MANY_TRIES);

        msgLoginNACK.setProtocolVersion(command.getProtocolVersion());
        netMan.sendMessage(msgLoginNACK);
       
        /*
         * Disconnect player of server.
         */
        netMan.disconnectClient(command.getChannel());

        return;
      }
     
      /*
       * We verify the username and the password to make sure player is
       * who he/she says he/she is.
       */
      if (command.getFailReason() != null) {
        /*
         * If the verification fails we send player a NACK and record
         * the event
         */
        logger.debug("Incorrect username/password for player " + info.username);
        stats.add("Players invalid login", 1);

        /* Send player the Login NACK message */
        if (info.reason == null) {
          info.reason = MessageS2CLoginNACK.Reasons.USERNAME_WRONG;
        }
        MessageS2CLoginNACK msgLoginNACK = new MessageS2CLoginNACK(command.getChannel(),
            info.reason);

        msgLoginNACK.setProtocolVersion(command.getProtocolVersion());
        netMan.sendMessage(msgLoginNACK);
        playerContainer.remove(command.getClientid());
        return;
      }

      /*
       * We check now the account is not banned or inactive.
       */
      if (command.getFailMessage() != null) {
        logger.info("Banned/Inactive account for player " + info.username + ": " + command.getFailMessage());

        /* Send player the Login NACK message */
        MessageS2CLoginMessageNACK msgLoginMessageNACK = new MessageS2CLoginMessageNACK(command.getChannel(), command.getFailMessage());
        msgLoginMessageNACK.setProtocolVersion(command.getProtocolVersion());
        netMan.sendMessage(msgLoginMessageNACK);

        /*
         * Disconnect player of server.
         */
        netMan.disconnectClient(command.getChannel());

        return;
      }

      /* Now we count the number of connections from this ip-address */
      int count = info.countConnectionsFromSameIPAddress(playerContainer);
      Configuration conf = Configuration.getConfiguration();
      int limit = conf.getInt("parallel_connection_limit", TimeoutConf.PARALLEL_CONNECTION_LIMIT);
      if (count > limit) {
        String whiteList = "," + conf.get("ip_whitelist", "127.0.0.1") + ",";
        if (whiteList.indexOf("," + info.address + ",") < 0) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.