Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jamasi

    (@jamasi)

    Thanks to your help I got it working.

    In case sb. else is looking for the correct hook:

    function myExlogHashAuthenticator($password, $hashFromDatabase, $username, $externalUserData) {
      // $salt = exlog_get_option("external_login_option_db_salt");
      $salt = $externalUserData[$db_data["salt"]];
    
      $algorithm = 'sha1';
      $calc1 = hash($algorithm, $password);
      $calc2 = hash($algorithm, $salt . $calc1);
        
      return $hashFromDatabase = $calc2;
    }
    add_filter('exlog_hook_filter_authenticate_hash', 'myExlogHashAuthenticator', 10, 4);
    Thread Starter jamasi

    (@jamasi)

    Sorry to be a nuisance, but how can I debug if the hook is installed? So far I get correct looking data from the connection test, but I cannot login with any user.

    Thread Starter jamasi

    (@jamasi)

    After digging into the source of wordpress, I suppose,

    function myExlogHashAuthenticator($password, $hashFromDatabase, $username, $externalUserData) {
    	$user_specific_salt = $externalUserData[$db_data["dbstructure_salt"]];
    	$algorithm = 'sha1';
    	$innerHash = hash($algorithm, $password);
    	$hashCalc = hash($algorithm, $user_specific_salt . $innerHash);
    
        return password_verify($hashCalc, $hashFromDatabase);
    }
    add_filter('exlog_hook_filter_authenticate_hash', 'myExlogHashAuthenticator', 10, 4);

    should work. Still I wonder what settings to use in the configuration page to activate it.

    Thread Starter jamasi

    (@jamasi)

    Hi @tbenyon,

    Thank you for your reply. In the meantime I also fond this hook, but for someone who is not into wordpress code that much the documentation could be a little more verbose.

    I think your code will not work, as the salt is coming from another column of the DB table and thus it is per user. I suppose $externalUserData might have a reference to this, but info on how one could access it would be something I’d really like to find in the docs for this hook.

    Also info on where to put his hook would be needed as putting custom code into the functions.php of the theme seems to be discouraged in general.

    All of this might seem pretty obvious for someone who has been developing wordpress plugins for some time, but for a mere user/admin of a wordpress site it’s quite some digging through the complexity monster of php code that wordpress is.

Viewing 4 replies - 1 through 4 (of 4 total)