Skip to content
This repository was archived by the owner on Jul 10, 2022. It is now read-only.

Invalid authentication & Cooldowns

Ian Castaño edited this page Aug 21, 2020 · 2 revisions

When we are talking about user security we can not go out there and just act like everything's peachy. There will always be malicious people who want to guess a password or a user who forgot to turn off caps.

Invalid Authentication event

Taking the example from the previous section, we will indicate to Centauri that the user did not enter the magic word to access: "Tomato rules".

public void onUserAsyncChat(AsyncPlayerChatEvent event) {
        String message = event.getMessage();
        if (event.getMessage().equalsIgnoreCase("Tomato rules")) {
            Bukkit.getPluginManager().callEvent(new AuthenticationSuccessEvent(tomatoGateway, event.getPlayer()));   
        } else {
            Bukkit.getPluginManager().callEvent(new AuthenticationInvalidEvent(player));
        }
        event.setCancelled(true);
    }

Cooldowns

Seems simple, right?. Actually, it is... But knowing that the authentication was invalid serves more than just sending a message and telling the user that he isn't cool enough to join the server.

Centauri currently generates a 5 minute lockout for those whose attempt to authenticate was invalidated three times in a row. At the moment, you don't have to worry about that, we take care of doing it like this to maintain consistency and security in every gateway.

Clone this wiki locally