Support » Plugin: External Login » [Idea] Adding hash type special for Minecraft Bukkit server plugin called AuthMe

  • Resolved mativve

    (@mativve)


    Hello!

    I’m writting this post because my last client want to use External Login on their page but he want use data used by AuthMe plugin on Bukkit Minecraft server. Unfortunatly External Login doesn’t have this type of hash.

    So I looked in to code of plugin and… I’ve done this but I had to modify External Login a little bit.

    I called this type of hash “Base AuthMe” that’s usually how it works 🙂
    Based on Internet results[1] I’ve create my own hash type for AuthMe.

    I called this “baseauthme” => “Base AuthMe”

    Below I link two files wich I modified:
    – Exlog_built_plugin_data.php
    https://gist.github.com/Mativve/0b2ea2cadd11cdce7aa4a841c3860967

    – validate_password.php
    https://gist.github.com/Mativve/d68f4f363dacaab461d23c516e7ac454

    Unfortunately, I am not sure if the code is 100% correct, but it currently works without complaints at my client’s.

    If such a feature were added, I would be happy.

    Regards, Mativve

    [1] https://dev.bukkit.org/projects/authme/issues/45

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author tbenyon

    (@tbenyon)

    Hi Mativve,

    I try to avoid adding lots of platform specific hashing solutions and have instead opted to provide a hook so that you can add this logic yourself while not modifying the base plugin.

    You can find details on it here:
    https://wordpress.org/plugins/external-login/#what%20hooks%20are%20available%20in%20the%20external%20login%20flow%3F

    There are also a handful of support forum threads that have asked this previously so you can look at those examples too.

    If you have any more questions, please don’t hesitate to get back in contact 🙂

    Thanks,

    Tom

    • This reply was modified 9 months ago by tbenyon.
    Thread Starter mativve

    (@mativve)

    I understand, thank you for the answer and the proposed solution to this.

    For other users, I share the solution. It works for the basic AuthMe config.yml:
    – minPasswordLength: 4
    – passwordMaxLength: 30
    – passwordHash: SHA256
    – legacyHashes: []
    – doubleMD5SaltLength: 8
    – pbkdf2Rounds: 10000

    Below I share code from functions.php

    // 
    // External Login AuthMe
    // 
    function auth_me_exlog($password, $hashFromDatabase, $username, $externalUserData) {
        $pass = $password;
        $hash_string = $hashFromDatabase;
        $hash_arr = explode("$", $hash_string);
        $salt = $hash_arr[2];
        $hashed = $hash_arr[3];
        
        $prepare = '$SHA$' . $salt . '$' . hash('sha256', hash('sha256', $pass) . $salt);
        return ($prepare == $hash_string);
    }
    add_filter('exlog_hook_filter_authenticate_hash', 'auth_me_exlog', 10, 4);
    Plugin Author tbenyon

    (@tbenyon)

    Hey @mativve,

    Really cool of you to share this for others – much appreciated 🙂

    If everything is working for you I’d be grateful if you could write a review or even buy me a beer.

    Thanks,

    Tom 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Idea] Adding hash type special for Minecraft Bukkit server plugin called AuthMe’ is closed to new replies.